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.
(also occurs in 6.7 M3, but used to work in 6.5) Although "@type" of a function is defined in JSDoc, the function doesn't show up in the appropriate auto complete list. Also already in 6.5 auto-complete didn't work for functions of the same class: "this.getFoo()." would not display Foo's functions. From the outside it works in 6.5, but no longer in 6.7 I'll attach an example with more detailed explanations...
here's an example... comment in the last line explains what happens ----------------------- /** * @constructor */ var Foo = function () { /** * @type Bar */ this.getBar = function () { return new Bar("fooo"); }; } /** * @constructor * @param {String} input */ var Bar = function (input) { this.bar = input + "baaaaaaaaaaar"; /** * @type String */ this.getOutput = function () { return this.bar; } } var f = new Foo(); f.getBar(). //completion doesn't show getOutput()
The example works fine for me (f.getBar().| + CC offers getOutput()), can you verify on latest build?
tried it again on netbeans-trunk-nightly-200904171401-ml-windows.exe still doesn't show getOutput() f.getBar().| + CC offers a very long list starting with "Some results omitted [...]" maybe the time it looks for possible results is too short or my pc is too slow; just a thought i had...
getOutput() is not first in the list, but If you narrow the query by typing getO, you should be able to see the item. Can you please verify that please? If not, reopen again.
OTOH you are right that the getOutput() method is not shown as a member of the Bar class at the top of the completion list above the line separator, it is just listed as a function without context.
sorry, i wasn't too clear about where i looked for it in the list; but that's exactly what i meant. If Bar's methods and attributes are not shown at the top, above the line, the whole JsDoc and CC feature is rendered quite useless and Netbean's JS-editor is just another code-highlighter.
fixed in web-main#89bcbda9ebe8. The problem looks like introduced by the parsig.api migration where some bug in indexing suppor was fixed and revealed a "typo" in the javascript code.
Integrated into 'main-golden', will be available in build *200904220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/89bcbda9ebe8 User: Marek Fukala <mfukala@netbeans.org> Log: #162305 - code completion based on JSDoc is broken
verified Product Version: NetBeans IDE Dev (Build 200910270201) Java: 1.6.0_16; Java HotSpot(TM) Client VM 14.2-b01 System: Linux version 2.6.28-11-generic running on i386; UTF-8; en_US (nb)
Auto-complete didn't work for functions of the same class: /** * @constructor */ var Foo = function () { /** * @type Bar */ this.getBar = function () { return new Bar("fooo"); }; /** * @type Foo */ this.getFoo = function () { return new Foo(); }; this.test = function () { this.getBar(). //completion doesn't show getOutput() }; this.test2 = function () { this.getFoo(). //completion doesn't show getBar() and other methods }; } /** * @constructor * @param {String} input */ var Bar = function (input) { this.bar = input + "baaaaaaaaaaar"; /** * @type String */ this.getOutput = function () { return this.bar; } } Tested on NetBeans IDE 6.7.1 and NetBeans IDE Dev (Build 200911241400); Java: 1.6.0_10; Windows XP SP2;
I will look at this.
For the comment from vitrilo. The code completion now shows function in both cases, but there are not at the top.
Than you Petr Pisl for interesting this bug. I try to clarify a little. STR 1: 1. Create new "Web Application" project. 2. Create new file inside project with type "Javascript File" and any name (like "newjavascript.js"). 3. Paste source code of my comment #10 into created js file. 4. Fix code to be fully valid. 5. Start typing in line this.getBar() - pop-up with JSDoc opened for getBar() method with type=Bar (Okay!) 6. Type dot after this.getBar() to get Bar class methods - pop-up opened with "Some results omitted. Type more to narrow search." (Bug) Note: these pop-up contains all method from all objects in project, and if project are very small - yep - you will see required in list bottom: (In reply to comment #12) > For the comment from vitrilo. The code completion now shows function in both > cases, but there are not at the top. - Yep, this is true STR 2: 1-4. All steps the same, except, you already have project with BIG number of .js files with BIG number of .js classes. 5. Start typing in line this.getBar() - pop-up with JSDoc opened for getBar method with type=Bar (Okay!) 6. Type dot after this.getBar() to get Bar class methods - pop-up opened with "Some results omitted. Type more to narrow search." (Bug) Note: You will NOT see required methods in the list, because this pop-up tried to show top of all methods of all objects inside a project. In real live - I have project with 25k lines of js code written in OOP-style, so I reproduced STR 2 in 99% of cases. Tested on NetBeans IDE 6.9 RC1 and NetBeans IDE Dev (Build 201005270001); Java: 1.6.0_10; Windows XP SP2;
JSDOC is NOT working in netbeans 6.10. I've even set it up _exactly_ like jsdoc requires, but there is no support for it. The following code causes no completition to be shown. /** *Rounding with precision * *Allows for one to round a number with decimal precision in mind if they so wish. * *@param n the number to be rounded *@param x [optional]the precision for the rounding after the decimal *@return the rounded value */ function round(n,x){ var y=0; if(x!==undefined){ y=n.toFixed(x); } n=Math.round(n); if(y!==n&&x!==undefined){ return y; } else{ return n; } } When typing r in any other documents, there is no completion at all. Even typing rand( doesn't cause it to be called forth. Since it is defined as it should be, there is nothing going on here. Netbeans is just ignoring it.
In the new JS editor the first case is in the completion as well as in the last case documentation is correctly shown. Anyway the return types from functions aren't still guessed. But because this issue become really obfuscated, I'm marking this issue as duplicate of the newer one - the "guess function return type" one. *** This bug has been marked as a duplicate of bug 215764 ***