This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249572 - Autocomplete is inconsistent
Summary: Autocomplete is inconsistent
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-30 15:45 UTC by eternoendless
Modified: 2015-01-06 17:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eternoendless 2014-12-30 15:45:43 UTC
I've found an issue with autocomplete in the javascript editor while developing ExtJS-style classes

Exemple 1 - ExtJS style:
------------------------

Ext.define('My.test.Controller',{
  extend: 'Ext.app.Controller',
  
  /**
   * This method returns an array
   * @param {Object} something
   * @returns {Array}
   */
  giveAnArray: function(something) {
    return [something];
  },
  
  doSomething: function() {
    var self = this;
    
    | <-- caret here
  }
  
});

***

If you type "this.", autocomplete will work as expected, suggesting the three members of the current object (giveAnArray, extend and doSomething).
If you type "self.", autocomplete will give seemingly random suggestions, but none belonging to the current scope.

Exemple 2 - Plain javascript:
-----------------------------

var Static = {
  
  thing: 'Test String',
  
  /**
   * This method returns an array
   * @param {Object} something
   * @returns {Array}
   */
  giveAnArray: function(something) {
    return [something];
  },
  
  doSomething: function() {
    var self = this;
    
    | <-- caret here
  }
  
};

If you type "this", autocomplete will work as expected, suggesting the three members of the current object (giveAnArray, extend and doSomething).
If you type "self", autocomplete will work as expected, suggesting the three members of the current object, plus seemingly random suggestions.

It would seem that the editor is capable of understanding the "self = this" association in the second example, whereas it's unable of resolving it in the first example. This leads to another problem, which is that Cmd+clicking on a method call (ex: self.giveAnArray()) won't take me to the method definition.

As an added request, it would be really cool if it we could get the method documentation in a popup box while Cmd+hovering a property or method call, just like in the PHP editor.
Comment 1 Vladimir Riha 2015-01-05 08:34:35 UTC
Reproducible, thank you for reporting. 

Could you please file the "method documentation" as a separate enhancement to javascript/editor? Thank you


Product Version: NetBeans IDE Dev (Build 201501050001)
Java: 1.7.0_71; Java HotSpot(TM) Client VM 24.71-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_71-b14
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 2 eternoendless 2015-01-06 17:21:38 UTC
No problem! Here it is:
https://netbeans.org/bugzilla/show_bug.cgi?id=249664