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.
We have several issues around Go To Declaration that it sometimes doesn't jump where you expect. This is a general problem in Ruby, since if you ask to go to say the class "TestCase", it can be defined in many places - so which one should we show? I've been thinking for a while that it should really ask the user. I was a bit reluctant to attempt this for NetBeans 6.0 since I thought this was a "new" thing in NetBeans. However, I discovered that Netbeans already does something very similar if you try to Go To Superclass for a class which implements a method that is defined in multiple interfaces. It pops up a dialog asking you to choose which superclass to jump to. That's the precedent I needed. I've implemented this, but it's disabled for now. You can enable it by running with the very latest build and this flag: -J-Druby.show_all_decls=true Try jumping to a class like TestCase, or a method like chomp, or ... Obviously, when there is only one match, it will jump to the declaration without asking. In the dialog, I include matches that are marked with ":nodoc:" (which typically means they are implementation classes or methods so probably not an interesting go to target). However, if all but one match is nodoc, I just jump to the non-nodoc'ed class. I also sort the list such that you first see the "best" match (in bold), then all the documented classes, at the very end the nodoc'ed classes, and the rest in the middle (sorted by filename). The "best match" is one I've picked based on heuristics. That's the one I would just jump to until now - and which isn't always right. (You can also make it just jump to the best match by running with another flag.)
Some issues related to this are: 94857: go to declaration is non-deterministic 116734: Jump to method goes to wrong place I also have some private e-mail requesting some solutions to this.
To see the same behavior in Java, add this code: interface A1 { void foo(); }; interface A2 { void foo(); }; class C1 implements A1, A2 { public void foo() { } } Then "Go To Super" on "public void foo".
The change looks good to me from UI point of view. I would just suggest to use "Go to Declaration" for title of the popup.
Thanks Jano and Gail for approving. I've changed the title as Jano suggested and enabled this in the builds. IDE:------------------------------------------------- IDE: [10/21/07 10:25 AM] Committing started cvs server: scheduling file `PopupUtil.java' for addition cvs server: scheduling file `DeclarationPopup.java' for addition cvs server: scheduling file `DeclarationPopup.form' for addition cvs server: scheduling file `Bundle.properties' for addition cvs server: use 'cvs commit' to add these files permanently IDE: [10/21/07 10:25 AM] Diffing finished Checking in gsf/src/org/netbeans/modules/retouche/editor/hyperlink/GoToSupport.java; /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/GoToSupport.java,v <-- GoToSupport.java new revision: 1.4; previous revision: 1.3 done RCS file: /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/PopupUtil.java,v done Checking in gsf/src/org/netbeans/modules/retouche/editor/hyperlink/PopupUtil.java; /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/PopupUtil.java,v <-- PopupUtil.java initial revision: 1.1 done RCS file: /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/Bundle.properties,v done Checking in gsf/src/org/netbeans/modules/retouche/editor/hyperlink/Bundle.properties; /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/Bundle.properties,v <-- Bundle.properties initial revision: 1.1 done RCS file: /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.form,v done Checking in gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.form; /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.form,v <-- DeclarationPopup.form initial revision: 1.1 done RCS file: /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.java,v done Checking in gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.java; /cvs/ruby/gsf/src/org/netbeans/modules/retouche/editor/hyperlink/DeclarationPopup.java,v <-- DeclarationPopup.java initial revision: 1.1 done Checking in editing/src/org/netbeans/modules/ruby/Bundle.properties; /cvs/ruby/editing/src/org/netbeans/modules/ruby/Bundle.properties,v <-- Bundle.properties new revision: 1.11; previous revision: 1.10 done Checking in editing/src/org/netbeans/modules/ruby/DeclarationFinder.java; /cvs/ruby/editing/src/org/netbeans/modules/ruby/DeclarationFinder.java,v <-- DeclarationFinder.java new revision: 1.20; previous revision: 1.19 done Checking in stubs/indexhelper/nbproject/build-impl.xml; /cvs/ruby/stubs/indexhelper/nbproject/build-impl.xml,v <-- build-impl.xml new revision: 1.2; previous revision: 1.1 done Checking in stubs/indexhelper/nbproject/genfiles.properties; /cvs/ruby/stubs/indexhelper/nbproject/genfiles.properties,v <-- genfiles.properties new revision: 1.2; previous revision: 1.1 done IDE: [10/21/07 10:25 AM] Committing finished IDE:------------------------------------------------- IDE: [10/22/07 2:08 PM] Committing started Checking in DeclarationFinder.java; /cvs/ruby/editing/src/org/netbeans/modules/ruby/DeclarationFinder.java,v <-- DeclarationFinder.java new revision: 1.21; previous revision: 1.20 done IDE: [10/22/07 2:08 PM] Committing finished