-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improvement: sorting workspace members with same name by frequency #6393
Conversation
c19e31b
to
b764a3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a really nice idea, and limiting it to the symbols with the same name only looks like a safe bet that shouldn't disrupt anything. 🙂
metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala
Outdated
Show resolved
Hide resolved
b764a3a
to
bf42d0d
Compare
mtags-interfaces/src/main/java/scala/meta/pc/PresentationCompiler.java
Outdated
Show resolved
Hide resolved
tests/cross/src/test/scala/tests/pc/CompletionContextSuite.scala
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-2/scala/meta/internal/pc/completions/Completions.scala
Outdated
Show resolved
Hide resolved
mtags-interfaces/src/main/java/scala/meta/pc/ReferenceCountProvider.java
Outdated
Show resolved
Hide resolved
bf42d0d
to
3e1f2f3
Compare
2d23ffe
to
e67d5d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments plus you need to rebase your PR and run scalafmt
mtags-interfaces/src/main/java/scala/meta/pc/CompletionItemPriority.java
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-3/scala/meta/internal/pc/ScalaPresentationCompiler.scala
Outdated
Show resolved
Hide resolved
mtags/src/main/scala-2/scala/meta/internal/pc/completions/Completions.scala
Outdated
Show resolved
Hide resolved
val futureCompletionResult: List[String] = | ||
List("Future - scala.concurrent", "Future - java.util.concurrent") | ||
|
||
checkItems( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use check
it would still be visible which one is first.
e67d5d3
to
361b2fc
Compare
361b2fc
to
3c047b4
Compare
3c047b4
to
71f7d34
Compare
71f7d34
to
6d42fa1
Compare
6d42fa1
to
ed3a875
Compare
ed3a875
to
4467bc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, so minor comments from me.
metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala
Outdated
Show resolved
Hide resolved
4467bc7
to
e5fea0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
scalameta/metals#6620 - only test added, it already worked in `scala3` pc scalameta/metals#6625 scalameta/metals#6393
inspired by: scalameta/metals-feature-requests#254 (comment)
Added ranking by frequency for workspace symbols with the same name.
It useful when project has multiple objects with same name (like Future (scala, java, twitter) or Clock (java, cats, zio))
It uses ReferenceProvider to count files where workspace member could have been referenced
False positive result from bloom filter is counted as reference in file to keep sorting fast (if we wanted to make it precise we should read semanticdb of matching paths which is expensive)