prometeu-studio/discussion/workflow/plans/PLN-0108-move-pbs-editor-assistance-behind-optional-language-service.md
2026-07-15 09:41:54 +01:00

72 lines
3.9 KiB
Markdown

---
id: PLN-0108
ticket: multi-frontend-compiler-vs-language-services
title: Move PBS editor assistance behind optional language service
status: done
created: 2026-07-15
ref_decisions: [DEC-0041]
tags: [compiler, compiler-general, studio, lsp, editor, frontend, multi-frontend]
---
## Briefing
`DEC-0041` allows PBS to keep rich editor assistance, but that behavior must become a PBS-provided optional capability instead of a common frontend requirement. This plan moves PBS completion, hover, signature help, semantic token production, and related editorial behavior behind the optional language-service boundary.
## Objective
Expose PBS editor assistance through `FrontendProvider.languageService()` while preserving current PBS behavior and keeping `FrontendProvider.compiler()` sufficient for compilation.
## Dependencies
- Accepted decision: `DEC-0041`.
- `PLN-0107` should define the documented boundary before final implementation review.
- Existing PBS editorial support classes and LSP bridge behavior.
## Scope
- Introduce or extend PBS language-service implementation under the PBS frontend module.
- Make `PBSFrontendProvider.languageService()` return a PBS language service.
- Keep `PBSFrontendProvider.compiler()` unchanged as the required compiler path.
- Move PBS-specific editorial calls into the PBS language-service implementation or adapter.
- Preserve existing completion, hover, signature help, semantic token, and documentation behavior for PBS.
## Non-Goals
- Change PBS language semantics.
- Add new editor features.
- Rewrite the LSP protocol layer.
- Implement capability-aware LSP fallbacks; that belongs to `PLN-0109`.
- Split every editor feature into independent top-level service interfaces unless strictly required by local implementation shape.
## Execution Method
1. Inspect `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/FrontendLanguageService.java` and define the minimum capability accessors needed by current PBS editor behavior.
2. Add a PBS language-service implementation in the PBS frontend module, colocated with existing PBS editorial support classes.
3. Move or delegate completion, hover, signature help, and semantic token behavior from PBS-specific bridge code into the PBS language-service implementation without changing output models unless the boundary requires neutral compiler-facing DTOs.
4. Update `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/PBSFrontendProvider.java` to return `Optional.of(pbsLanguageService)`.
5. Keep compile/analyze/build paths independent of `languageService()`.
6. Preserve current PBS editorial tests by redirecting setup to the new PBS language-service surface where appropriate.
## Acceptance Criteria
- PBS provider exposes a non-empty optional language service.
- PBS compilation still works when only `compiler()` is used.
- PBS completion, hover, signature help, semantic tokens, and documentation behavior remain equivalent to current behavior.
- Common compiler modules do not instantiate PBS editorial implementation directly.
- No new requirement is introduced for non-PBS frontends to implement editor assistance.
## Tests
- Run PBS frontend tests covering editorial support.
- Run LSP tests that currently assert PBS completion, hover, signature help, semantic tokens, and documentation behavior.
- Add or update provider tests proving PBS has a language service while a compile-only provider can omit it.
- Run targeted Gradle tasks for changed compiler frontend and LSP modules.
## Affected Artifacts
- `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/FrontendLanguageService.java`
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/PBSFrontendProvider.java`
- PBS editorial support classes under `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java`
- Related PBS frontend tests.
- Related LSP bridge tests.