M3.5: go to definition, find references and rename through Phpactor
Engine (`cmd/lsp_nav.rs`, on the pending outcomes of 20d1d28):
- `lsp.definition` (F12) and `lsp.references` (Shift+F12, sorted, with
line previews) return project-relative locations; locations outside
the project, such as PHAR stubs and symlink escapes, are dropped.
- `lsp.prepareRename` uses the word at the cursor when the server has
no prepareProvider.
- `lsp.rename` (F2) applies the workspace edit (`lsp_nav/edit.rs`):
1. Check everything first: inside the project, ranges fit (UTF-16,
CRLF), open buffers unchanged since the request, no file
operations, no incomplete edit.
2. Write closed files atomically through the VFS, restoring earlier
writes when a later one fails.
3. Change open buffers through `buffer.edit` (dirty, undoable).
4. Send each written file to Phpactor as didOpen/didSave/didClose
plus didChangeWatchedFiles; without this its index kept the old
names. Then the summary notification `notification.lsp.renamed`.
UI (`components/editor/nav/`):
- Mod+click goes to the definition, with a pointer cursor while Mod is
held.
- A location picker for several definitions (exclusive modal).
- A References tab in the bottom panel, grouped by file.
- An inline rename field with a use/file count (exclusive modal).
- `BufferSync.beginUndoableRemote` puts the engine's rename edit into
the editor history as one undo step per buffer.
- Catalog strings and tokens only.
Fake LSP server: `--script FILE` with scripted capabilities and
answers (additive next to M3.4's arms).
Tests:
- `crates/engine/tests/lsp_nav.rs` (fake): definition; bad positions;
references; prepareRename; a multi-file rename incl. a closed CRLF
file; refusals for outside the project, a bad range, a stale buffer,
bad names and no server.
- The ignored real-Phpactor test covers definition, references and a
rename and back across 3 files.
- Vitest `ui/tests/nav/`.
Live (Phpactor 2026.06.25.0, Windows, port 7935, tick on):
- definition 93 ms cold / 7-18 ms warm
- references ~140 ms
- prepareRename ~11 ms
- rename 28-59 ms
- index follows written files in 140 ms
- Phpactor 57 MB working set, ~1.6% of a core while ticking idle
Gate: 13 steps, 197 s, Vitest 484 + 1 skipped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b3fd7c6478
commit
578160a2ba
28 changed files with 3730 additions and 34 deletions
|
|
@ -108,9 +108,24 @@
|
|||
"menu.group.help": "Help",
|
||||
"menu.group.view": "View",
|
||||
"menu.label": "Main menu",
|
||||
"nav.definition.none": "No definition found for {name}",
|
||||
"nav.picker.line": "line {line}",
|
||||
"nav.picker.title": "Definitions of {name}",
|
||||
"nav.references.failed": "Find References failed: {message}",
|
||||
"nav.references.label": "References",
|
||||
"nav.references.none": "No references to {name} found",
|
||||
"nav.references.searching": "Searching references to {name}…",
|
||||
"nav.references.summary": "{uses} references to {name} in {files} files",
|
||||
"nav.references.title": "References",
|
||||
"nav.rename.busy": "Renaming…",
|
||||
"nav.rename.counting": "Counting uses…",
|
||||
"nav.rename.label": "New name for {name}",
|
||||
"nav.rename.notHere": "There is nothing to rename at the cursor",
|
||||
"nav.rename.preview": "Changes {uses} uses in {files} files. Enter to rename, Escape to cancel",
|
||||
"notification.close": "Close notification",
|
||||
"notification.command.failed": "{command} failed: {message}",
|
||||
"notification.lsp.failed": "The PHP language server stopped: {reason}. Run Restart PHP Language Server to try again.",
|
||||
"notification.lsp.renamed": "Renamed to {name}: {edits} changes in {files} files ({written} closed files saved)",
|
||||
"notification.project.notLocal": "The chosen folder is not on this computer: {reason}",
|
||||
"notification.project.openFailed": "Cannot open {path}: {reason}",
|
||||
"notification.project.unsavedChanges": "Cannot open {path} while {what} has unsaved changes. Save or close it first.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue