Repository navigation
Closed
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Description
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:
- Pyright and Pylance: notebook cells are analysed as one concatenated document, with positions mapped back to cells: https://microsoft.github.io/pyright/
- LSP
notebookDocument/didOpen,didChange,didSave,didCloseand thenotebookDocumentSynccapability with cell selectors: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ - 3.18 adds the
notebookcode action kind: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/
Boundary
- specs/lsp/notebook.t27
User Scenarios
- Given a notebook with 3 t27 code cells and 1 markdown cell, when
notebookDocument/didOpenarrives, then the store holds the 3 code cell documents and ignores the markdown cell. - Given the user edits cell 2, when
notebookDocument/didChangearrives withcells.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
didClosearrives, 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.textContentandmetadata, 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.t27rules (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.t27pass, run on the lab witht27c 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 masterlists onlyspecs/lsp/notebook.t27(0 files in other languages).
Metadata
Metadata
Assignees
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Activity
gHashTag commentedon Nov 17, 2026
LSP spec created (typecheck OK, tests pass).