prometeu-studio/discussion/workflow/plans/PLN-0024-implement-read-only-fe-diagnostics-symbols-and-definition.md
2026-03-31 11:12:52 +01:00

121 lines
3.5 KiB
Markdown

---
id: PLN-0024
ticket: studio-editor-write-wave-supported-non-frontend-files
title: Implement read-only FE diagnostics, symbols, and definition over VFS snapshots
status: review
created: 2026-03-31
completed:
tags: [studio, lsp, diagnostics, symbols, definition, frontend]
---
## Objective
Implement the non-highlight semantic capabilities of DEC-0011 for read-only frontend documents by consuming VFS snapshots through the integrated LSP seam.
## Background
DEC-0011 defines a minimum semantic-read phase for FE documents.
This plan focuses on the analysis-driven capabilities that do not depend on frontend highlight/color delivery:
- diagnostics,
- symbols/outline,
- and definition.
The compiler pipeline already exposes `analyze` as a no-write semantic entrypoint suitable for tooling.
## Scope
### Included
- diagnostics for FE documents
- symbol/outline data for FE documents
- definition for FE documents
- VFS-snapshot-backed analysis for open docs and filesystem fallback for closed docs
### Excluded
- frontend highlight
- completion
- frontend editing
## Execution Steps
### Step 1 - Build Analysis Snapshot Ingestion
**What:**
Connect the integrated LSP runtime to the compiler `analyze` pipeline over VFS-provided document state.
**How:**
Implement the runtime path that:
- reads open-document snapshot state from VFS,
- falls back to filesystem-backed state for closed docs,
- produces analysis snapshots,
- and keeps build-side persistence out of scope.
**File(s):**
- `prometeu-lsp/prometeu-lsp-v1/src/main/java/**`
- `prometeu-compiler/prometeu-build-pipeline/**` callsites as needed
### Step 2 - Expose Diagnostics
**What:**
Surface FE diagnostics through the integrated LSP contracts.
**How:**
Map analysis results into LSP-facing DTOs/messages and ensure Studio consumers can receive them without requiring frontend editing.
**File(s):**
- `prometeu-lsp/prometeu-lsp-api/src/main/java/**`
- `prometeu-lsp/prometeu-lsp-v1/src/main/java/**`
### Step 3 - Expose Symbols, Outline, and Definition
**What:**
Provide enough semantic structure for FE read-only navigation.
**How:**
Use analysis facts to expose:
- document symbols,
- workspace symbols,
- outline-facing structure,
- go-to-definition.
**File(s):**
- `prometeu-lsp/prometeu-lsp-api/src/main/java/**`
- `prometeu-lsp/prometeu-lsp-v1/src/main/java/**`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorOutlinePanel.java`
## Test Requirements
### Unit Tests
- analysis snapshot ingestion from open and closed document sources
- diagnostics mapping
- symbol/definition mapping
### Integration Tests
- end-to-end FE semantic-read test over a project-session VFS snapshot
### Manual Verification
- open FE docs and confirm diagnostics appear
- confirm outline/symbol navigation works without unlocking editing
- confirm definition resolves from open in-memory docs
## Acceptance Criteria
- [ ] FE diagnostics work from VFS-backed analysis
- [ ] FE symbols and outline data are available in read-only mode
- [ ] go-to-definition works against the same semantic substrate
- [ ] open docs use in-memory snapshot state while closed docs can use filesystem fallback
## Dependencies
- DEC-0011 accepted
- PLN-0023 review completed or otherwise stable enough to provide runtime seams
- DEC-0010/editor-session substrate major pieces sufficiently stable
## Risks
- analysis ingestion may accidentally bypass VFS and read files directly
- outline/symbol shape may drift if not modeled cleanly in API contracts
- definition support may require compiler facts not yet surfaced cleanly