LSP §9c: workspace file operations — renames rewrite includes
workspace/willRenameFiles rewrites every `include whose RESOLVED target is a renamed file — never a name match — sweeping sources() so unopened files count and open buffers contribute unsaved text. Rewrites preserve the include's form where the new location allows (bare stays bare in-dir; otherwise the shortest suffix that resolves under the rungs that form uses; ../ last; absolute stays absolute), a still-resolving include gets no edit, and an unrewritable one is left untouched with a warning rather than given an invented path. Directory renames ride the same prefix mapping for free, and the mirror case — the including file itself moving breaks its own-dir rung — ships with the same machinery. didRenameFiles/didDeleteFiles nudge the index through the watcher's own predicate. Three checks guard the write path: the edit range is the path token minus delimiters by construction; the rewritten line re-scans and re-lexes to exactly one include of the same form; and the rewritten path must resolve_as_if to exactly the new location against the post-rename filesystem — with every edit addressed to the PRE-rename uri, the spec detail a client silently drops edits over, pinned on the wire by QA. QA's corpus probe (a real ibex header, 87 real includers) caught the round's one real bug — unnormalized includer paths turning same-directory renames into false warnings — fixed with one normalize. Batch renames do not compound; recorded as a documented choice bounded by the safety net. 42 tests added (dev 33 + QA 9). verify.rs untouched. docs/features/file-operations/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
bf17ddd1e5
commit
45db6cd14f
9 files changed
+2524
-27
No files matched your search
@@ -52,6 +52,8 @@ looks like language knowledge in here is a bug or a `Handshake` request.
|
||||
| `workspace/codeLens/refresh` | — | Server-**initiated**, once per workspace rescan, straight after the indexing bar comes down: a rescan can change any count on screen. Only for a client that advertised `workspace.codeLens.refreshSupport`; never at startup, where no buffer holds lenses. Same feature README |
|
||||
| `workspace/symbol` | `WorkspaceIndex::workspace_symbols` | Capped at 256 hits |
|
||||
| `workspace/didChangeWatchedFiles` | `Workspace::rebuild_index` | Registered dynamically after the handshake, for a client that advertised it. One rebuild per *notification*, however many files it names. See `docs/features/file-watching/README.md` |
|
||||
| `workspace/willRenameFiles` | `includes::IncludeGraph` (through `resolve_as_if`) | The client is about to rename files and asks what that costs: every `` `include`` in scope whose **resolved** target moves — never a filename match — is re-spelled so it still resolves, in the form it was written in (bare stays bare where a rung reaches it, angled resolves through `+incdir+`s only, absolute stays absolute), shortest resolving suffix first and a `../`-relative spelling only as a last resort. An include written *in* a file that moves is re-spelled too. An include no spelling can reach is **left exactly as written** and named in a `window/showMessage` warning — nothing is invented. `null` when there is nothing to do. Folders are answered as well as files (LSP sends only the folder's URI; a folder is a path prefix). Every edit covers the path token alone and is verified three ways before it is emitted — see `docs/features/file-operations/README.md` |
|
||||
| `workspace/didRenameFiles`, `workspace/didDeleteFiles` | `Workspace::rebuild_index` | One `reindex()` per notification whose paths touch the index's scope, filtered by the same predicate a watched-file event is. Deliberately not deduplicated against the watcher: a client may send both, and a second rebuild re-reads the tree rather than changing an answer. Source-file filters only — a folder move reaches the index through the watcher's own events. Same feature README |
|
||||
| `window/workDoneProgress/create` + `$/progress` | — | Server-**initiated**: one indeterminate bar per workspace rescan, titled "Indexing Verilog workspace", ending with the indexed file count. Only for a client that advertised `window.workDoneProgress`. See `docs/features/work-done-progress/README.md` |
|
||||
| `$/cancelRequest` | — | Best-effort, and honoured exactly when the cancel reaches the loop in the same burst as the request it names: that request is answered `RequestCancelled` (-32800) instead of computed. A cancel for anything else is dropped where it is read, `shutdown` is never cancellable, and nothing already running is interrupted. See `docs/features/cancel-request/README.md` |
|
||||
|
||||
@@ -587,6 +589,11 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
|
||||
`docs/features/type-hierarchy/README.md`.
|
||||
- [x] Single-step macro expansion on a hover card (`src/expand.rs`, M14) —
|
||||
`docs/features/macro-expansion/README.md`.
|
||||
- [x] `workspace/willRenameFiles` + `didRenameFiles`/`didDeleteFiles` —
|
||||
delivered by **file-operations** (2026-08-27, TODO.md §9c): a rename
|
||||
rewrites the `` `include``s that resolve to the moved file, folders
|
||||
included, and never invents a path that would not resolve.
|
||||
`docs/features/file-operations/README.md`.
|
||||
- [x] `$/cancelRequest` — delivered by **cancel-request** (2026-08-26,
|
||||
completing TODO.md §9b): the loop reads in bursts and answers a queued
|
||||
request whose cancel is in the same burst with `RequestCancelled`,
|
||||
|
||||
Reference in new issue
Block a user