Skip to content

LSP: code lens and runnables (specs/lsp/lens.t27) #12238

Closed

Description

@gHashTag

Code lens and runnables: clickable lines above declarations (Run test, 3 references, Show Verilog) and the list of things the user can run from here. Part of the LSP epic, Refs #12209 (wave 1, standard features). Only .t27: no code in any other language, not even scratch probes or a loader; see skill only-t27.

Depends on specs/lsp/index.t27 (reference counts). Commands travel through workspace/executeCommand in specs/lsp/workspace.t27.

Prior art:

Boundary

  • specs/lsp/lens.t27

User Scenarios

  • Given a spec with 4 test blocks and 1 bench, when the client sends textDocument/codeLens, then every test has a lens Run test, the bench has Run bench, and the module header has Run all tests (4).
  • Given a function with 5 callers, when lenses are listed, then the lens title is 5 references, filled by codeLens/resolve so the first answer is fast, and its command opens the references view at the function.
  • Given a spec that has a Verilog backend, when lenses are listed, then a lens Show Verilog opens the generated text in a read-only view (the views are in specs/lsp/views.t27).
  • Given a test finishes, when the lens is refreshed, then the lens shows Run test (passed) or Run test (failed) from the last run.
  • Given a client without code lens support, when initialize arrives, then the capability is not announced.

Requirements

  • FR-001: The module MUST list lenses for tests, benches, invariants, the module header, references, implementations of @extern, and generated output, each lens kind behind its own switch.
  • FR-002: Lenses MUST be returned unresolved (range and data) and resolved by codeLens/resolve with title and command.
  • FR-003: Commands MUST be plain command ids with arguments: t27.runTest, t27.runAll, t27.showReferences, t27.showGenerated; the ids and argument shapes are constants in the module that the client generator reads.
  • FR-004: The module MUST keep the last result per test and MUST send workspace/codeLens/refresh when a result changes.
  • FR-005: The module MUST list runnables as a custom request t27/runnables returning the same items with their command lines, for clients that have no lens support.

Success Criteria

  • At least 20 tests in specs/lsp/lens.t27 pass, run on the lab with t27c test-report (exit 0).
  • A test asserts that the first codeLens answer carries no title for the reference-count lens and that resolve fills it.
  • git diff --name-only master lists only specs/lsp/lens.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