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.
I have declarations to the same method in different .js so when I want to "go to declaration" i need netbeans to show me a list with the posible alternatives. but netbeans open random declarations instead
reproducible, the requested functionality is ok.
Created attachment 93474 [details] Testcase in web project zip file Here is a testcase from 179773 which I am closing. Please refer to the two js files tree.js and tree_1.js in the web folder of the attached testcase. How to reproduce: - Open tree_1.js - Open tree.js - In tree.js, go to line 9, position your cursor on privateFunction(); - Press [Ctrl+B], Go to Declaration - Do the same as above in tree_1.js Expected result: Cursor should go to declaration in same file Actual result: Cursor goes to declaration in other file
*** Bug 179773 has been marked as a duplicate of this bug. ***
If there are multiple occurrences, involving multiple files, then there is a list to chose from. However, the occurrence in the current file is not included in the list. This indicates that the occurrence of the current file is ignored.
No list of choices is shown for me when I try to hyperlink or go to declaration on the method declaration or method usage. It just somehow chooses once particular declaration and uses it. The others are ignored even if they are properly found via find usages.
cause by JsIndex.getAllNames() returning s Set of IndexElement-s. IndexElement however doesn't take the source element file location into account so even if the method properly finds all occurrences, only one is kept randomly in the resulting HashSet. Find usages works because *it doesn't use index at all!!!*. It parses all files from classpath and finds the searched element in the parse trees. Crazy!!!
Now the source FileObject is take into account in the IndexedElemen's equals() and hashCode() methods. This is however still not correct since if there are multiple occurrences of the same method in one source file, the will appear equal. But since the JsIndexer doesn't store the element's offset in the source I cannot easily resolve this. For the sake of fixing the issue the changes are enough.
And I would appreciate if Petr reviews the change since as he is more experienced in this area he may be able to foresee the possible negative consequence I cannot spot. Thanks in advance. fixed in web-main#faabf7291a2a
Integrated into 'main-golden', will be available in build *201102090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/faabf7291a2a User: Marek Fukala <mfukala@netbeans.org> Log: #159704 - go to declaration in js open files at random