Semantic tokens allow for a single provider #135580
Labels
feature-request
Request for new features or functionality
insiders-released
Patch has been released in VS Code Insiders
semantic-tokens
Semantic tokens issues
verification-needed
Verification of issue is requested
verified
Verification succeeded
Milestone
This request is to allow semantic tokens to not just pick the first most provider in the list of providers. But instead pick the provider that actually has tokens to return.
The use case for this is to support jupyter notebook token colorization.
Right now there are at least 2 language servers returning tokens for python notebooks:
Python extension has a language server registered for all 'python' files. There's no way to 'exclude' files from a DocumentFilter so it has a middleware piece that excludes all notebook cells.
Jupyter extension has one ore more language servers registered for all notebook cells. One or more is because the language server in use can only support one python interpreter at a time, so one language server is created per python interpreter in use for any notebook (multiple interpreters can be in use in one VS code session). When semantic tokens are requested the middleware piece in the juptyer extension will skip sending token requests to pylance if they're not for the appropriate document.
This creates a problem with the current implementation because the first registered language server wins. This can randomly be python's (where no tokens are returned) or one of the jupyter one's (where it might return tokens if the interpreter for the document matches).
I believe this could all be accomplished by making a compositing token provider in the VS code source. Something like so:
The text was updated successfully, but these errors were encountered: