dcaoyuan/nbscala

Scala Find Usages results are in random order within file

Closed this issue · 3 comments

Hi, I was looking for a few easy (I thought) issues to get me started in nbscala, and I thought this one would be straightforward...
when there are multiple results in a file, they are not ordered by line number, but seemingly randomly.

I looked for a similar bug in netbeans, as I couldn't see a problem in nbscala, and I found:
Bug 210379 - [regression] Find Usages displays file results in random order
( https://netbeans.org/bugzilla/show_bug.cgi?id=210379 ) this was fixed in netbeans 2012-03-30, well before 8.1 came out

http://hg.netbeans.org/main-golden/annotate/3d54179a7330/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java

and it seems this fix is not in the module in the netbeans maven repo's RELEASE81 (I'm going to ask them, at least it's not in the source jar)

http://bits.netbeans.org/nexus/content/groups/netbeans/org/netbeans/api/org-netbeans-modules-refactoring-api/RELEASE81/

I checked Java Find Usages, and it orders by line number... could it be using a different version of the refactoring.api jar?

Looking further:
https://hg.netbeans.org/main-golden/annotate/bebcb8289952/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java#l466

Sorting of items removed. Plugins are required to sort their results themselves.
#209410: BG refactoring reports N-1 elements
#204213: Better sorting of result from Find Usages
Issue #209279 - BG find usages: difficult to use partial results from tree

I'll keep looking in nbscala

I think I have a fix. Will tidy up, commit to my clone, and send a pull request if anyone's interested

#160 Fix for issue #159 Scala Find Usages results are in random order within file