- 
                Notifications
    You must be signed in to change notification settings 
- Fork 726
Implement semantic tokens #1990
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR implements semantic token support for the TypeScript language server, enabling syntax highlighting based on semantic understanding of code (types, symbols, modifiers) rather than just syntax. This is a major editor feature that enhances the developer experience.
Key changes:
- Added semantic token generation in the language service layer with type-based classification and modifier detection
- Integrated semantic token handlers into the LSP server with support for both full-document and range-based requests
- Created extensive test infrastructure with 40+ test files covering various semantic classification scenarios
Reviewed Changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description | 
|---|---|
| internal/ls/semantictokens.go | New file implementing semantic token collection, classification, and LSP encoding logic | 
| internal/lsp/server.go | Adds LSP handlers for semantic tokens requests and advertises semantic token capability | 
| internal/fourslash/semantictokens.go | Test utilities for verifying semantic token output | 
| internal/fourslash/fourslash.go | Updates test framework to support semantic token client capabilities | 
| internal/fourslash/_scripts/convertFourslash.mts | Adds parsing support for semantic classification test cases | 
| testdata/baselines/reference/*.jsonc | Updated test baselines showing improved behavior for rename/reference operations | 
| internal/fourslash/tests/gen/*.go | 40+ generated test files for semantic token verification | 
| internal/fourslash/tests/manual/*.go | Manual test for semantic token classification | 
| 
 Wasn't the same true for document highlights and semantic tokens? Does it feel reasonable in a larger codebase? | 
| Ah, but we didn't make more checkers. | 
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.
Pull Request Overview
Copilot reviewed 56 out of 56 changed files in this pull request and generated 3 comments.
Fixes #1894
I am a little scared of this one. VS Code seems to ask for doc highlights, semantic tokens, diags, all in quick succession. All three of those require checkers, which means we are likely creating 3 checkers to handle these.