improvement: Rework IndexedContext to reuse the previously calculated scopes#22898
improvement: Rework IndexedContext to reuse the previously calculated scopes#22898tgodzik merged 2 commits intoscala:mainfrom
Conversation
|
I wonder if this strategy helps #22430 (which I haven't returned to yet) Edit: I guess only in the sense of "moral support". |
|
I think I am actually doing it all wrong and might be possible that IndexedContext is not really needed 😅 |
3e69d9e to
21aa3b8
Compare
d27ca2c to
376f628
Compare
… scopes It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now.
|
|
||
| object Completion: | ||
|
|
||
| def scopeContext(pos: SourcePosition)(using Context): CompletionResult = |
There was a problem hiding this comment.
Ideally this would get deduplicated with normal rawCompletions being invoked, but I will try to do it as a separate step afterwards.
| """ | ||
| |object A { | ||
| | val e: Either[Int, String] = ??? | ||
| | type Left = String |
There was a problem hiding this comment.
type val actually fine here, but val causes an error
| | ??? | ||
| | } | ||
| | val x/*: AB<<scala/collection/AbstractMap#>>[Int<<scala/Int#>>, String<<scala/Predef.String#>>]*/ = test(Set/*[Int<<scala/Int#>>]*/(1), Set/*[Char<<scala/Char#>>]*/('a')) | ||
| | val x/*: AB<<scala/collection/AbstractMap#>>[Int<<scala/Int#>>, String<<java/lang/String#>>]*/ = test(Set/*[Int<<scala/Int#>>]*/(1), Set/*[Char<<scala/Char#>>]*/('a')) |
There was a problem hiding this comment.
This was inconsistent previously
kasiaMarek
left a comment
There was a problem hiding this comment.
Some nitpicks and questions, but overall looks really cool 🎉
| if !id.symbol.is(Synthetic) && !id.symbol.is(Implicit) => | ||
| symbols + tree.symbol | ||
| case sel: Select => | ||
| indexedContext.lookupSym(sel.symbol) match |
There was a problem hiding this comment.
I'm questioning this right now. Shouldn't we actually just collect the symbol of the qualifier? (Sort of a side comment not connected to the PR)
There was a problem hiding this comment.
This was causing the + method etc. to be reported as conflicting, which was not really a problem.
… conflciting constructors
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now.
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now. [Cherry-picked 9d90ff5][modified]
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now.
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now. [Cherry-picked 9d90ff5][modified]
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now.
… scopes (scala#22898) It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does. There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now. [Cherry-picked 9d90ff5][modified]
It turns out the work being done in IndexedContext was already done in Completions, but better, since it doesn't try to read files as the separate logic does.
There is still some improvement to be done to not calculate it twice, but in order to keep this PR as simple as possible I will skip that for now.