Skip to content

LSP: check on save (specs/lsp/check.t27) #12255

Closed

Description

@gHashTag

Check on save: run the full compiler checks when the user saves, the way rust-analyzer runs cargo check (flycheck) and ZLS runs the build. The server's own analysis is fast and partial; the full check is slow and complete, and both feed the same problems list. 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/diagnostics.t27 (a second diagnostic source) and specs/lsp/window.t27 (progress).

Prior art:

Boundary

  • specs/lsp/check.t27

User Scenarios

  • Given the setting check.onSave is typecheck, when the user saves a spec, then the server runs t27c typecheck on it and its dependents, shows progress Checking, and publishes the findings with source t27c typecheck, separate from the live findings.
  • Given the user saves again while a check is running, when the second save arrives, then the running check is cancelled and a new one starts.
  • Given the user sends t27/clearCheck, when the request arrives, then the findings from the check source disappear and the live ones stay.
  • Given check.overrideCommand is set to a command line, when the user saves, then that command runs instead, and its output is parsed in the compiler's JSON error shape.
  • Given the compiler is not found, when the check cannot start, then the server shows one message with the path it looked at, once, and not on every save.

Requirements

  • FR-001: The module MUST implement textDocument/didSave triggered checks with the commands check, typecheck and lint, a setting for which runs, and the requests t27/runCheck, t27/clearCheck and t27/cancelCheck.
  • FR-002: The command runner MUST be a seam (a function value taking a command line and returning lines), so tests inject recorded output and the module never needs a compiler binary in a test.
  • FR-003: The module MUST parse the compiler's machine-readable output into diagnostics with ranges and codes, and a test parses 3 recorded real outputs (clean, 1 error, 3 errors across 2 files).
  • FR-004: Findings from a check MUST be kept apart by source and replaced as a set when the next check ends, so stale findings disappear.
  • FR-005: Checks MUST NOT run on every keystroke and MUST NOT run in parallel for the same workspace.

Success Criteria

  • At least 20 tests in specs/lsp/check.t27 pass, run on the lab with t27c test-report (exit 0), using the injected runner.
  • A negative control saves twice quickly and asserts exactly one set of findings is published and the first run was cancelled.
  • git diff --name-only master lists only specs/lsp/check.t27 (0 files in other languages).

Activity

  1. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    LSP spec created (typecheck OK, tests pass).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/specs.t27 spec files and conformanceenhancementNew feature or requestspec

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions