-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Small improvements to workspace/symbol
#5443
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
Conversation
Duhemm
commented
Nov 14, 2018
- Inspect only source trees
- Exclude local symbols
We were inspecting all trees on the classpath for every project, which was not efficient and lead to duplicate results. This commit changes the implementation so that the language server inspects only the source trees of every project.
ca776a7
to
7fd0c1d
Compare
Rebased |
@smarter can you take a look? |
@@ -466,12 +471,14 @@ class DottyLanguageServer extends LanguageServer | |||
|
|||
override def symbol(params: WorkspaceSymbolParams) = computeAsync { cancelToken => | |||
val query = params.getQuery | |||
def predicate(implicit ctx: Context): NameTree => Boolean = | |||
tree => tree.symbol.exists && !tree.symbol.isLocal && tree.name.toString.contains(query) |
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.
Shouldn't symbol and documentSymbol have similar predicates ? I.e., should we also exclude primary constructors and synthetic symbols here ?
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.
Yes, that makes a lot of sense. I've removed checks that were redundant with those happening in namedTrees
.
I'm also thinking that namedTrees
should be the one excluding primary constructors. I can't think of situations where they should be included, but I may very well be missing something. What do you think?
Some checks were redundant with the checks that are performed in `namedTrees`, and can be removed. Also, exclude primary constructors in `symbol`.
Agreed, as long as go to definition on a new call still goes to the correct place |
We never want to match them, so it's easier to exclude them here rather than always add a check in the predicate function.
language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala
Outdated
Show resolved
Hide resolved
This include flag means that local symbols and trees should be inspected.
6f141db
to
8213555
Compare
👍 |