-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Allow semantic tokens to be provided by more than one provider #135602
Merged
alexdima
merged 12 commits into
microsoft:main
from
rchiodo:dev/rchiodo/multiple_providers
Oct 25, 2021
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5f161f2
Multiplex providers into one
rchiodo 02b5209
Build problem
rchiodo 3daf66b
Cache last used provider for legends call
rchiodo 6da697c
Cache last provider for range token provider too
rchiodo e9d68a1
Put back old method for use in viewportSemanticTokens
rchiodo eef5a74
Add test for multiple providers
rchiodo ae6066d
Double check called both providers
rchiodo 31662e1
Make sure to cache result id and use the appropriate legend
rchiodo a0d62ed
:lipstick:
alexdima 3703c27
Use `CompositeDocumentRangeSemanticTokensProvider` only when having 2…
alexdima 21b22af
Add support for invoking multiple equal scored `DocumentRangeSemantic…
alexdima 42aa33c
Add support for invoking multiple equal scored `DocumentSemanticToken…
alexdima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 static introduces another subtle bug in the case of having two files opened at the same time, even when having a single provider.
If
file1.ts
andfile2.ts
are shown side-by-side, and iffile1.ts
makes a request and has theresultId
1
, and thenfile2.ts
makes a request and has theresultId
2
, then after typing infile1.ts
the request will not useresultId
1
(which would be correct) because the last request to this provider returned theresultId
2
forfile2.ts
.IMHO there is a problem with the lifecycle of
CompositeDocumentSemanticTokensProvider
here. Before,getDocumentSemanticTokens
could be implemented stateless, but IMHO that is no longer the case now, as some state needs to be captured between semantic tokens requests (like e.g. what was the last selected provider).I will try to refactor how
ModelSemanticColoring
interacts with theDocumentSemanticTokensProviderRegistry
, but IMHO this can no longer be done with a statelessgetDocumentSemanticTokens
call. I am working directly on your branch, please hold off from pushing for now.