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 94857 - go to declaration is non-deterministic
Summary: go to declaration is non-deterministic
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker with 1 vote (vote)
Assignee: Torbjorn Norbye
URL:
Keywords: USABILITY
Depends on:
Blocks:
 
Reported: 2007-02-07 15:00 UTC by Tomas Danek
Modified: 2007-10-22 22:18 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Danek 2007-02-07 15:01:00 UTC
#47 (nbextras)
-------------------------
1) create ruby app
2) generate new unit tests
3) invoke Goto declaration on assert method; 
assert(false, 'Assertion was false.')
4) repeat it several times, sometimes you are navigated to breakpoint.rb, 
sometimes to asserions.rb

cannot guess severity, did not found any other case, but P2 for sure..feel free
to downgrade if you evaluate as a rare case...
Comment 1 Martin Krauskopf 2007-03-06 22:26:23 UTC
Probably pop-up with possible destinations should be offered when it is not
possible to infer exact type. Similarly to code-completion.
Comment 2 Torbjorn Norbye 2007-03-13 23:55:00 UTC
The difficulty here is that since Ruby has open classes, there are many declaration points for the same 
class - and while the method definitions may wary, with *restargs it's hard to know which method is the 
best fit.

I've improved the algorithm a bit such that at least matches which are documented are preferred over 
undocumented ones. That still doesn't help choose between breakpoint.rb and assertions.rb. I have plans 
for additional heuristics to make this smarter, such as looking at the transitive closure of require 
statements to see which declaration is most likely the relevant one.
Comment 3 Torbjorn Norbye 2007-06-19 20:28:45 UTC
I might find some more heuristics which may help, but solving this in general probably won't happen for 6.0.
Comment 4 Jiri Kovalsky 2007-07-03 14:04:30 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 5 Torbjorn Norbye 2007-08-02 19:33:48 UTC
I've improved things about as far as I can take it with the current approach (picking the "best" location which is heuristics based).

The next step would be to offer a set of locations to the user when you try to go to declaration (a completion popup of some sort) showing all the matches. 
That's feature work though so marking as Enhancement.
Comment 6 kagrama 2007-09-24 19:14:16 UTC
Any chance the completion popup will make 6.0?  I love this product, but so far for me this is its biggest shortcoming!  (and BTW, Ruby DLTK handles this 
nicely...)
Comment 7 Torbjorn Norbye 2007-10-21 18:26:55 UTC
I have started some work on this that I will now take through the late UI changes process.

To test, run with
-J-Druby.show_all_decls=true

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
Comment 8 Torbjorn Norbye 2007-10-22 22:12:04 UTC
This is now resolved as part of issue 119586.  While the actual "best guess" that the IDE comes up with can still vary
it should be more stable now that it's sorting by filenames and more importantly sorting the alternatives by some
heuristics and then asking the user which reference to go to.
Comment 9 kagrama 2007-10-22 22:18:02 UTC
Dude, you're totally awesome.  Thanks!