2.1 KiB
| id | ticket | title | status | created | resolved | decision | tags | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AGD-0050 | pbs-lsp-semantic-tokens-semantic-classification | PBS LSP Semantic Token Classification | open | 2026-07-15 |
|
Pain
Domain owner: studio/lsp
PBS semantic highlighting exists, but parts of the token classification can remain lexical or superficial, which limits visual accuracy for same-looking identifiers with different semantic roles.
Context
The current LSP announces full semantic tokens and maps frontend semantic presentation to VS Code. The compiler has semantic read surfaces that can classify symbols more accurately than raw tokenization.
Open Questions
- Which token categories must become semantic identity-based first?
- Should semantic tokens be produced from compiler semantic surfaces, parser AST, lexer tokens, or layered output?
- How should tokens behave in files with syntax or semantic errors during active editing?
Options
Option A - Lexical tokens with semantic overlays
- Approach: Keep lexer-based tokenization as baseline and overlay semantic categories where resolution succeeds.
- Pro: Stable during broken edits and incremental to improve.
- Con: Some unresolved identifiers remain visually generic.
- Maintainability: Strong because fallback behavior is explicit.
Option B - Fully semantic token stream
- Approach: Generate all semantic tokens from compiler semantic surfaces.
- Pro: Maximum accuracy when analysis succeeds.
- Con: Highlighting may disappear or degrade sharply on incomplete code.
- Maintainability: Risky unless snapshot/error recovery is excellent.
Tradeoffs
Highlighting must be resilient while the user is typing. A perfect semantic pass that fails on partial code is worse than a layered model.
Recommendation
Prefer Option A: lexical baseline plus semantic overlays from resolved symbols.
Discussion
This can proceed independently but benefits from LSP snapshot/cache work.
Resolution
Ainda em aberto.
Next Step
Choose semantic overlay categories for the first pass.