Skip to content

LSP: file operations, rename and create and delete (specs/lsp/file_ops.t27) #12244

Closed

Description

@gHashTag

File operations: when the user renames, creates or deletes a spec in the explorer, the server fixes what points at it. TypeScript's import-updating rename is the feature people name when they say a server "just works". 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 (who uses the module) and specs/lsp/rename.t27 (the use rewrite).

Prior art:

Boundary

  • specs/lsp/file_ops.t27

User Scenarios

  • Given specs/numeric/gf.t27 is renamed to specs/numeric/golden.t27 in the explorer, when the client sends workspace/willRenameFiles, then the answer is a WorkspaceEdit that rewrites the use lines in every dependent and the module header if it names the old file.
  • Given a new empty file specs/x/new.t27, when the client sends workspace/willCreateFiles, then the answer inserts a header: the module line, a comment for the purpose and an empty test block, matching the name of the file.
  • Given a spec that 4 others use is deleted, when willDeleteFiles arrives, then the server returns a message request listing the 4 dependents and the edit that removes their use lines is offered, never applied silently.
  • Given a folder is renamed, when the request arrives, then every spec under it is handled as a rename and the edits do not overlap.
  • Given the did* notifications, when they arrive after the operation, then the index and the store reflect the new paths.

Requirements

  • FR-001: The module MUST implement all six notifications and requests, with file operation filters (glob **/*.t27, files and folders) registered in the server capabilities.
  • FR-002: Rename edits MUST use documentChanges and a change annotation that needs confirmation, and MUST be computed from the index, not from a text search.
  • FR-003: The header template for a new file MUST be one constant in the module that t27c conformance (module first, an English comment, a test block) accepts; a test compiles the template.
  • FR-004: Deleting MUST never apply an edit by itself; it offers actions only.
  • FR-005: After a didRenameFiles the index MUST contain no entry under the old path.

Success Criteria

  • At least 20 tests in specs/lsp/file_ops.t27 pass, run on the lab with t27c test-report (exit 0), including the folder rename and the template compile.
  • A negative control renames a file that nobody uses and asserts the edit is empty.
  • git diff --name-only master lists only specs/lsp/file_ops.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