Repository navigation
Closed
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Description
Inactive regions and reachability: show the user which code does not run. clangd greys out code under a false #if; Odin fades the untaken when branch; Pyright marks unreachable code. t27 has compile-time conditions and t27c deadcode, so the same fade is available. Part of the LSP epic, Refs #12209 (wave 2, beyond the standard). Only .t27: no code in any other language, not even scratch probes or a loader; see skill only-t27.
Depends on specs/lsp/analysis.t27 and specs/lsp/diagnostics.t27 (the Unnecessary tag). t27c deadcode is the reference for what is dead.
Prior art:
- clangd
inactiveRegionsnotification: https://clangd.llvm.org/features - Odin language server: untaken
whenbranches are faded: https://github.com/DanielGavin/ols - Pyright reachability analysis and the
reportUnreachable-style hint: https://microsoft.github.io/pyright/
Boundary
- specs/lsp/inactive.t27
User Scenarios
- Given a block guarded by a compile-time condition that is false for the active target, when the snapshot is built, then the server sends
t27/inactiveRegionswith the range of that block, and the client shows it faded. - Given statements after an unconditional
return, when diagnostics run, then they carry theUnnecessarytag and a hintunreachable code. - Given a private function nobody calls, when diagnostics run, then its name has the
Unnecessarytag and the hintunused function, matchingt27c deadcode. - Given the active target changes in settings, when the setting arrives, then the regions are recomputed and re-sent.
- Given a region contains an error, when diagnostics run, then the error is still reported (inactive code must still parse), at hint severity if the setting says so.
Requirements
- FR-001: The module MUST compute inactive regions from the compile-time conditions with the active target as input, unreachable ranges after terminators, and dead private items, and MUST return them as a sorted list of non-overlapping ranges.
- FR-002: The module MUST send
t27/inactiveRegionsto clients that announced it, and MUST also publish the ranges asUnnecessarydiagnostics for clients that did not. - FR-003: The dead-item list MUST equal the output of
t27c deadcodeon the same file; a test compares them on 10 specs. - FR-004: Regions MUST be recomputed on a target change and MUST not be re-sent when they are equal to the last ones.
- FR-005: The module MUST NOT evaluate conditions itself; it reads the compiler's evaluation from the snapshot.
Success Criteria
- At least 20 tests in
specs/lsp/inactive.t27pass, run on the lab witht27c test-report(exit 0), including the no-resend rule. - On the lab the dead-item agreement test passes on 10 named specs; the command and the list are pasted in the issue.
git diff --name-only masterlists onlyspecs/lsp/inactive.t27(0 files in other languages).
Metadata
Metadata
Assignees
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Activity
gHashTag commentedon Nov 17, 2026
LSP spec created (typecheck OK, tests pass).