Lock DSC-0066 on Q1-A and Q2-A. Retire AGD-0048 through AGD-0056 into AGD-0069, DEC-0058, and PLN-0137. Published editor diagnostics use the bound frontend language id as source. For PBS that is pbs. The stable compiler code stays in code and is not copied into source. Related locations, phase, and repair payload stay unpublished.
63 lines
2.2 KiB
Markdown
63 lines
2.2 KiB
Markdown
---
|
|
id: AGD-0050
|
|
ticket: pbs-lsp-semantic-tokens-semantic-classification
|
|
title: PBS LSP Semantic Token Classification
|
|
status: abandoned
|
|
created: 2026-07-15
|
|
resolved:
|
|
decision:
|
|
tags: [studio, lsp, vscode, compiler-pbs, editor, semantic-tokens]
|
|
---
|
|
|
|
## 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
|
|
|
|
Aposentada em 2026-09-22. O tema foi consolidado em [AGD-0069](AGD-0069-pbs-lsp-remaining-editor-surface.md) / DSC-0066. Este texto não é normativo.
|
|
|
|
## Next Step
|
|
|
|
Choose semantic overlay categories for the first pass.
|