refactor(sema): seal sema.zig as editor indexing only (A8.1)

Remove the last compiler dependency on sema as semantic truth and stop
publishing as-you-type sema diagnostics from the LSP.

- core.zig: drop dead `Compilation.analyze()`, the `sema_result` field,
  and the sema->diagnostics merge; drop the now-orphaned sema import.
  The CLI pipeline (parse -> resolveImports -> generateCode) never called
  analyze(), so this removes only dead code.
- lsp/server.zig: rename `analyzeAndPublish` -> `refreshEditorIndex` and
  delete its sema-diagnostic publish (and the now-unused `semaToLspDiags`).
  The editor index (doc.sema) is still refreshed for nav/refs/completion/
  tokens. On-save/on-open diagnostics still come solely from the canonical
  compiler pipeline in `runProjectCheck` (unchanged).
- Document sema as an editor-indexing API (doc.sema field comment).

Intended behavior change: as-you-type sema diagnostics no longer publish;
on-save canonical diagnostics are the sole source. CLI compile output and
the 361-example suite are unchanged (361/0, zero snapshot churn).
This commit is contained in:
agra
2026-06-03 12:56:28 +03:00
parent b7fce30f42
commit f52a24a0fb
3 changed files with 12 additions and 49 deletions

View File

@@ -23,7 +23,9 @@ pub const Document = struct {
version: i64,
/// AST root for this file only (not merged).
root: ?*sx.ast.Node,
/// Sema results for this file (references are relative to this source).
/// Editor index for this file — symbols/references/types for navigation,
/// completion, and hover (references are relative to this source). Not a
/// diagnostic source; see `sema.zig` module doc.
sema: ?sx.sema.SemaResult,
/// Last successful sema (preserved across parse failures for completions).
last_good_sema: ?sx.sema.SemaResult = null,