Parent: #27
Goal
Make diagnostics preserve the same source/project identity guarantees as navigation, and ensure changes to included/open-overlay sources refresh diagnostics for affected documents instead of leaving stale editor state.
Context
M10 remediation made definition/references source-aware and added open-document overlays, but diagnostics are still range-only from the requesting document perspective. A diagnostic originating from an included source can therefore lose its source identity, and didChange currently republishes only the changed URI rather than dependent root/open documents.
This issue should close the source → diagnostic → dependency-refresh contract without introducing a speculative incremental compiler.
Scope
- Introduce an editor-neutral source-aware diagnostic representation (for example
SourceDiagnostic) carrying:
- source/document identity;
- precise range;
- severity/code/message;
- relevant version/provenance information.
- Convert compiler/analyzer spans using the text of the span's actual source, not the requesting document.
- Reuse Wright's project/include/source model to determine which open/root documents depend on a changed include or overlay.
- When an included/open-overlay source changes, recompute and republish diagnostics for affected documents.
- Define and test
didClose diagnostic cleanup so previously published diagnostics do not remain visible for a closed document.
- Keep deterministic full recomputation acceptable while current measurements justify it.
Non-goals
- Building a general incremental query engine or complex dependency cache.
- Adding new
.opy language features.
- Expanding LSP feature breadth beyond diagnostics/project correctness.
Acceptance criteria
- Diagnostics originating in included files preserve the correct source identity and source-local UTF-16 range.
- Syntax and semantic/static-analysis diagnostics do not map included-file spans through the requesting document text.
- Changing an included open document automatically refreshes diagnostics for affected dependent documents at the LSP boundary.
- A valid → invalid → valid unsaved include edit produces corresponding dependent diagnostic refreshes without reopening the root document.
- Closing a document clears or otherwise correctly retires diagnostics previously published for that document.
- Filesystem-backed includes and open unsaved overlays have regression coverage.
- The implementation reuses Wright-owned project/source semantics and does not create a diagnostics-only project model.
Planning notes
This should be implemented and independently audited before project-wide rename work proceeds. Correct source ownership here is a prerequisite for later multi-document edits.
Parent: #27
Goal
Make diagnostics preserve the same source/project identity guarantees as navigation, and ensure changes to included/open-overlay sources refresh diagnostics for affected documents instead of leaving stale editor state.
Context
M10 remediation made definition/references source-aware and added open-document overlays, but diagnostics are still range-only from the requesting document perspective. A diagnostic originating from an included source can therefore lose its source identity, and
didChangecurrently republishes only the changed URI rather than dependent root/open documents.This issue should close the source → diagnostic → dependency-refresh contract without introducing a speculative incremental compiler.
Scope
SourceDiagnostic) carrying:didClosediagnostic cleanup so previously published diagnostics do not remain visible for a closed document.Non-goals
.opylanguage features.Acceptance criteria
Planning notes
This should be implemented and independently audited before project-wide rename work proceeds. Correct source ownership here is a prerequisite for later multi-document edits.