LSP §9c: didChangeWorkspaceFolders + server-pull configuration
Folders: workspace.workspaceFolders advertised with change notifications; added/removed folders adjust the root set through one 8-line Workspace::change_roots (removals first, dedup, did-it-move bool) and one reindex per moving notification — progress bar, code- lens refresh and diagnostics generation all ride along, pinned. Open buffers in a removed folder keep today's rootless conventions with no new code. The source watcher's base-less glob needs no re- registration; the absolute-path filelist watcher re-registers through the same before/after comparison the settings push already ran. Configuration: clients advertising workspace.configuration get one pull at startup and one per empty didChangeConfiguration; the answer funnels through the same parser and applier as the push, so the two doors cannot drift, and every malformed answer shape lands on defaults, silently. The outstanding-request routing refactored to one Pending enum map — applyEdit's shipped behavior re-proven under three-way out-of-order interleaving. Push-with-payload stays the unchanged legacy path. 38 tests added (dev 27 + QA 11, closing every claim that lacked one: roots.first() reordering, last-root-removed totality, double pulls, stale answers, the pull-answer-moves-the-filelist chain, rootless- gains-first-folder). QA's F1 — a subfolder added as its own root is its own root, outside the parent's exclude — accepted as the per-root model and documented in Assumptions. docs/features/folders-and-config/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
8dc8f6489f
commit
17fb2129db
9 files changed
+2097
-52
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/didChangeWorkspaceFolders` | `Workspace::change_roots` + `rebuild_index` | Folders added and removed mid-session, since 2026-08-27. One rescan per *notification* (the event carries both lists), and none at all for an event that leaves the root set where it was — a folder already held, one never held, an empty event, a non-`file:` folder. A removed folder's files leave the index; its open buffers stay open and keep being diagnosed, exactly as an out-of-scope buffer always has. Advertised as `workspace.workspaceFolders: { supported, changeNotifications }` — both halves, because a client reads them separately. See `docs/features/folders-and-config/README.md` |
|
||||
| `workspace/configuration` | `settings::from_section` → `from_payload` | Server-**initiated**, since 2026-08-27: the `lucisv` section, asked for once at startup and again on every *empty* `didChangeConfiguration` (the 3.17 client's "something changed, ask me"). Only for a client that advertised `workspace.configuration`; a push with a payload still applies directly, so the legacy path is untouched. The answer is entry 0 of an array and goes through the same parser a push does; an error, a `null`, an empty array or junk all mean the defaults, and none of them says anything to the user. Same feature README |
|
||||
| `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` |
|
||||
@@ -231,7 +233,7 @@ reasoning and the measurements: `docs/features/cancel-request/README.md`.
|
||||
| layer | rebuilt when | cost |
|
||||
|---|---|---|
|
||||
| a document's `Semantics` + tokens + diagnostics | every `didOpen`/`didChange` — **once per notification**, however many ranges it carried | one file, full recompute |
|
||||
| the `WorkspaceIndex` | `initialize`, every `didSave`, every `workspace/didChangeWatchedFiles`, and a changed `lucisv.exclude`/`lucisv.filelist` | full re-scan of the roots |
|
||||
| the `WorkspaceIndex` | `initialize`, every `didSave`, every `workspace/didChangeWatchedFiles`, every `workspace/didChangeWorkspaceFolders` that moves the root set, and a changed `lucisv.exclude`/`lucisv.filelist` (pushed **or** pulled) | full re-scan of the roots |
|
||||
| the `` `include`` graph | with the `WorkspaceIndex`, from the same file list | a line scan per file (~6ms over the 860-file corpus). An open buffer's *own* includes are re-resolved on every request instead, so a line just typed is clickable before the next save |
|
||||
|
||||
**Per-file recompute on every keystroke** is the strategy TODO.md §6 states
|
||||
@@ -282,6 +284,23 @@ model above; nested `-f` filelists are not watched, only the root one;
|
||||
rebuild from any cause picks it up); and there is no time-based debouncing, so
|
||||
a burst arriving as several separate notifications costs one rebuild each.
|
||||
|
||||
**Settings arrive two ways since 2026-08-27** (folders-and-config): pushed, as
|
||||
they always were, and *pulled*. A client that advertised
|
||||
`workspace.configuration` is sent one `workspace/configuration` for the
|
||||
`lucisv` section at startup, and another whenever it sends a
|
||||
`didChangeConfiguration` whose payload is empty — which is the 3.17 client's
|
||||
way of saying "something changed, come and ask", and is what
|
||||
`vscode-languageclient` sends once no legacy `synchronize.configurationSection`
|
||||
is configured. A push that carries a real payload still applies directly, so
|
||||
nothing about the old path moved. Both doors lead to one parser
|
||||
(`settings::from_payload`) and one applier (`Server::apply_settings`), so a
|
||||
setting cannot mean two things depending on how it arrived, and
|
||||
`exclude`/`filelist` cost the same rescan either way. A pulled answer can land
|
||||
*after* the first index build — as a pushed one always could, since neither
|
||||
can arrive before `initialized` — so the first index is built against the
|
||||
default scope and a narrowing setting costs one extra rescan when it lands.
|
||||
Rules: `docs/features/folders-and-config/README.md`.
|
||||
|
||||
**Definition targets in other files need that file's text** to turn a
|
||||
`TextRange` into a `Range`, and the index deliberately keeps no file contents.
|
||||
The server resolves a target by taking the **open buffer's text if that path
|
||||
@@ -313,6 +332,13 @@ not see.
|
||||
on a POSIX path legitimately named `/C:`.
|
||||
- **The workspace walk is plain.** `initialize`'s `workspace_folders` (falling
|
||||
back to `root_uri`) are walked recursively for `*.v`/`*.sv`/`*.vh`/`*.svh`.
|
||||
~~They are read once and frozen for the session.~~ **Superseded
|
||||
(folders-and-config, 2026-08-27): `workspace/didChangeWorkspaceFolders`
|
||||
adjusts the root set mid-session, one rescan per notification. A removed
|
||||
folder's files leave the index while its open buffers stay open and keep
|
||||
being diagnosed, and removing the *last* folder simply becomes rung 3 of
|
||||
the scope ladder — the rootless case — with no special handling. See
|
||||
`docs/features/folders-and-config/README.md`.**
|
||||
~~`.gitignore` and `--exclude` are **not** honored~~ **Superseded by
|
||||
lucisv-core-lift (lead note): the scan now uses the lifted `lucisv_core` walk —
|
||||
`.gitignore` always on, workspace-root config excludes applied. The old
|
||||
|
||||
Reference in new issue
Block a user