Skip to content

LSP: notebook document sync (specs/lsp/notebook.t27) #12247

Closed

Description

@gHashTag

Notebook document sync: the part of LSP 3.17 that lets a server see a sequence of cells as one program. t27 specs are run and evaluated in cells by t27c eval, so a notebook client should get the same diagnostics, hover and completion as a file. 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/documents.t27 (the store) and specs/lsp/analysis.t27 (the snapshot).

Prior art:

Boundary

  • specs/lsp/notebook.t27

User Scenarios

  • Given a notebook with 3 t27 code cells and 1 markdown cell, when notebookDocument/didOpen arrives, then the store holds the 3 code cell documents and ignores the markdown cell.
  • Given the user edits cell 2, when notebookDocument/didChange arrives with cells.textContent, then only cell 2's text changes, and the analysis of cells 2 and 3 is redone, not cell 1.
  • Given cell 3 uses a function declared in cell 1, when a diagnostics or definition request is made on cell 3, then the name resolves, and the location returned points into cell 1's uri.
  • Given cells are reordered, when the change arrives with structure.array, then the order seen by the analysis follows the new order.
  • Given the notebook closes, when didClose arrives, then every cell document and its diagnostics are dropped.

Requirements

  • FR-001: The module MUST implement the four notebook notifications with cells.structure (insert, delete), cells.data, cells.textContent and metadata, and the cell selector { language: "t27" }.
  • FR-002: The analysis input for a cell MUST be the ordered concatenation of earlier code cells plus itself, with a position map in both directions; the map is a pure function with its own tests.
  • FR-003: Diagnostics, hover and definition on a cell MUST report ranges inside that cell, never inside the concatenation.
  • FR-004: Cell documents MUST live in the same store as files, with versions, so specs/lsp/documents.t27 rules (no older version after a newer one) apply unchanged.
  • FR-005: Notebook sync MUST be advertised only when the module is wired.

Success Criteria

  • At least 20 tests in specs/lsp/notebook.t27 pass, run on the lab with t27c test-report (exit 0), including reorder and the position map in both directions on 10 sampled positions.
  • A negative control sends a diagnostics request for a markdown cell and asserts the answer is empty.
  • git diff --name-only master lists only specs/lsp/notebook.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