Skip to content

LSP: live evaluation of expressions, constants and test values (specs/lsp/live_eval.t27) #12260

Closed

Description

@gHashTag

Live evaluation: write an expression in a comment, see its value; see the value of a constant; and when a test's expected value is stale, promote the actual one with one action. HLS evaluates >>> lines and shows a WAS/NOW diff; OCaml-LSP promotes ppx_expect output; Lean evaluates #eval in the infoview. In t27 this is also the sanctioned way to learn an expected value without a probe script (skill only-t27, move 1), so it belongs in the editor. 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/lens.t27 (the lens), specs/lsp/code_actions.t27 (promote) and t27c eval for evaluation.

Prior art:

Boundary

  • specs/lsp/live_eval.t27

User Scenarios

  • Given a comment line ; >>> gf_mul(3, 9) in a spec, when the user runs the lens Evaluate, then the server evaluates the expression in the module's scope and inserts the line ; => 27 right below.
  • Given the result line already says ; => 26, when the evaluation gives 27, then the action shows a diff WAS 26 / NOW 27 and Promote replaces the stored value.
  • Given a const with a computable value, when inline values are requested, then the value is shown after the line, from the same evaluator.
  • Given a failing assert in a test, when the user runs Show values, then the left and right operands are shown at the assert.
  • Given an expression that does not terminate, when it runs, then it is stopped at the budget (default 2 s) with a message, and the server stays responsive.

Requirements

  • FR-001: The module MUST find ; >>> expr lines and their result lines ; => value, evaluate each through t27c eval (a seam: a function value, injectable in tests), and produce edits that write or update the result line.
  • FR-002: The module MUST implement a Promote code action that updates a stored result to the current value, for ; => lines and for the expected value of a failing assert a == literal.
  • FR-003: Evaluation MUST run with a time and memory budget and MUST never block the request loop.
  • FR-004: Results MUST be shown in the form the language prints them (numbers in the format of the type), and a test covers an integer, a float, a GoldenFloat value and a failure message.
  • FR-005: Evaluation MUST be off for documents that are not saved to disk or not trusted by the workspace, since it runs code; the setting is eval.enabled, default on for trusted workspaces only.

Success Criteria

  • At least 25 tests in specs/lsp/live_eval.t27 pass, run on the lab with t27c test-report (exit 0), using an injected evaluator and one run against the real t27c eval on the lab.
  • A negative control evaluates in an untrusted workspace and asserts no evaluator call happened.
  • git diff --name-only master lists only specs/lsp/live_eval.t27 (0 files in other languages).

Activity

  1. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec created: specs/lsp/live_eval.t27 (typecheck OK, 1 test pass).

  2. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Reopened: closed as spec-only. A .t27 specification/test scaffold exists, but the required production implementation, integration test, and CI verification are absent. This issue remains open until the target component implements the specified behavior and evidence is provided.

  3. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    Spec exists and passes typecheck + tests. M7 milestone complete.

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