--- id: PLN-0112 ticket: multi-frontend-remove-pbs-branches title: Migrate semantic tokens to generic frontend language service status: done created: 2026-07-15 completed: 2026-07-15 ref_decisions: [DEC-0042] tags: [compiler, compiler-general, compiler-pbs, studio, frontend, coupling, multi-frontend] --- ## Briefing `DEC-0042` requires the LSP common path to project semantic token behavior from the selected frontend through generic frontend contracts. Semantic presentation already lives mostly in `FrontendSpec`, so this is the lowest-risk capability migration. ## Objective Make LSP semantic token handling consume generic frontend language-service APIs while preserving frontend-owned semantic presentation and PBS semantic token behavior. ## Dependencies - Depends on `PLN-0111` for the generic frontend editorial surface. - Requires accepted decision `DEC-0042`. ## Scope - Route semantic token requests through the provider's optional generic language service. - Preserve `FrontendSpec.getSemanticPresentation()` as the source of token keys, host projections, themes, and default theme. - Keep deterministic empty semantic tokens when a frontend has no language service or no semantic-token capability. ## Non-Goals - Changing PBS semantic classification rules. - Implementing semantic-token improvements from PBS-specific agendas. - Migrating completion, hover, or signature help. - Removing every PBS import from `CompilerLanguageServiceBridge`. ## Execution Method 1. Inspect `CompilerLanguageServiceBridge.semanticTokens(...)` and `PBSFrontendLanguageService.semanticTokens(...)`. 2. Add a generic semantic-token method to the frontend language-service surface if not already introduced by `PLN-0111`. 3. Adapt `PBSFrontendLanguageService` to return generic frontend semantic token records or a compatible generic token model. 4. Update `CompilerLanguageServiceBridge.semanticTokens(...)` to resolve `FrontendProvider` by `context.languageId()`, read presentation from `provider.specification()`, and call the generic semantic-token capability when present. 5. Ensure missing capability returns an empty token list with the frontend presentation legend. 6. Keep VS Code/LSP4J mapping inside `prometeu-lsp`. ## Acceptance Criteria - LSP semantic token handling no longer needs PBS-specific language-service casts. - Frontend semantic presentation remains frontend-owned. - PBS semantic token regression tests continue to pass. - Compile-only or no-language-service providers return deterministic empty semantic tokens. ## Tests - Existing LSP semantic token tests. - PBS frontend semantic presentation tests. - Missing language-service fallback tests in `CompilerLanguageServiceBridgeTest`. ## Affected Artifacts - `prometeu-lsp/prometeu-lsp-v1/src/main/java/p/studio/lsp/services/compiler/CompilerLanguageServiceBridge.java` - `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/PBSFrontendLanguageService.java` - `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/...` - LSP semantic-token tests.