prometeu-studio/discussion/workflow/plans/PLN-0025-implement-fe-semantic-highlight-consumption.md
2026-03-31 17:19:08 +01:00

109 lines
3.6 KiB
Markdown

---
id: PLN-0025
ticket: studio-editor-write-wave-supported-non-frontend-files
title: Implement FE semantic highlight and editor consumption for the read-only LSP phase
status: done
created: 2026-03-31
completed: 2026-03-31
tags: [studio, lsp, highlight, frontend, editor]
---
## Objective
Implement frontend highlight delivery through `prometeu-lsp` semantics while leaving non-frontend highlighting Studio-local as DEC-0011 requires.
## Background
DEC-0011 explicitly separates highlight ownership:
- non-frontend highlight may remain local to the Studio editor,
- frontend highlight must come from the integrated LSP semantic layer and frontend-owned color semantics.
This deserves its own plan because it crosses API, runtime, and editor presentation boundaries.
## Scope
### Included
- FE semantic highlight contracts in LSP
- FE semantic highlight production in runtime
- editor consumption path for FE highlight
- frontend-owned color semantics integration
### Excluded
- non-frontend highlight rewrite
- completion
- frontend editing
## Execution Steps
### Step 1 - Define FE Highlight Contracts
**What:**
Add LSP-facing contracts for semantic highlight delivery.
**How:**
Define DTOs/messages that carry FE semantic highlight spans and any required theme/color semantics without forcing Studio-local token rules onto FE documents.
**File(s):**
- `prometeu-lsp/prometeu-lsp-api/src/main/java/**`
### Step 2 - Implement Runtime Highlight Production
**What:**
Produce FE highlight data from the integrated LSP runtime.
**How:**
Implement the runtime path that derives semantic highlight facts for FE docs from the same read-only analysis substrate used by diagnostics and symbols.
**File(s):**
- `prometeu-lsp/prometeu-lsp-v1/src/main/java/**`
### Step 3 - Consume FE Highlight in the Editor
**What:**
Make the editor choose FE highlight from LSP while leaving other document types on the existing local path.
**How:**
Update editor presentation routing so:
- FE docs use LSP semantic highlight results and frontend-owned color semantics,
- non-FE docs continue using Studio-local highlighting.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorDocumentPresentationRegistry.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/syntaxhighlight/**`
- `prometeu-studio/src/main/resources/themes/editor/**`
## Test Requirements
### Unit Tests
- FE highlight DTO/runtime mapping
- editor routing between FE LSP highlight and non-FE local highlight
### Integration Tests
- FE document read-only semantic highlight test through Studio + VFS + LSP path
### Manual Verification
- open FE docs and confirm semantic highlight comes from LSP-driven data
- open non-FE docs and confirm existing local highlighting still works
## Acceptance Criteria
- [ ] FE highlight is produced by the integrated LSP runtime
- [ ] FE highlight uses frontend-owned color semantics rather than Studio-local fallback token rules
- [ ] non-FE highlighting remains on the existing local Studio path
- [ ] editor presentation routing clearly separates FE and non-FE highlight ownership
## Dependencies
- DEC-0011 accepted
- PLN-0023 review completed or otherwise stable enough for LSP contracts/runtime
- PLN-0024 review completed or otherwise stable enough to provide shared FE semantic facts
## Risks
- FE highlight could accidentally duplicate or conflict with local Studio token rules
- color-semantics contracts may become too UI-coupled if not modeled carefully
- editor routing may become fragile if FE and non-FE ownership boundaries are not explicit