H3: Phpactor UX: fast tick while indexing, progress, messages, php -l

- Session tick: 1 ms while Phpactor reports work-done progress and in a
  session's first 120 s, otherwise 25 ms as before. Fast intervals use
  thread::sleep, because recv_timeout wakes at most ~64/s on Windows.
  First useful completion on 2,000 classes: 71.6 s -> 20.7-26.9 s.
- $/progress -> lspProgress {active, title?, message?, percentage?},
  progress in lsp.status, a status-bar item (LspProgressItem).
- window/showMessage -> notification.lsp.message (repeats within 30 s and
  the known Windows lint-provider complaint only logged); showMessage,
  logMessage and stderr in a 1,000-line log, new command lsp.log.
- Lutra's own php -l on Windows (lsp/php_lint.rs): on open and save, one
  worker thread, lutra_proc::spawn, stdin, 10 s timeout, output caps;
  merged into diagnosticsChanged with source "php -l".
- editor.completion.delayMs stays 0 (measured: 100 ms only delays the
  list; Phpactor marks every list incomplete).
- Fake server: scripted notifications after initialized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-25 17:33:26 +01:00
parent 8701f50d37
commit e128400246
21 changed files with 1752 additions and 48 deletions

View file

@ -18,8 +18,8 @@ Hours are the estimated agent wall-clock hours for one agent to reach behaviour
| Project view, VFS | 6 | 8% (est.) | views list (project / scopes), toolbar (Select Opened File, Expand/Collapse All), sort and display options, show/hide excluded, distinct icons for library and excluded folders, file colours, speed search, preview, file operations | ~37 (est.) | `lutra-vfs` (M1.2): lazy sorted listing, ignore rules (.gitignore, .ignore, info/exclude, global excludes, Lutra defaults), native file watching via `notify` with a polling fallback, capped UTF-8 reads, atomic writes; 34 tests on temp dirs, watcher tests run on both backends (`crates/vfs/tests`). M1.5: project tree UI (lazy listing, keyboard navigation, dimmed ignored entries, event refresh) in `ui/src/components/project/`, Vitest against a mocked engine. M1.3: `project.open`, `project.close`, `project.children` (watches listed directories, capped at 256 native / 32 polling, least recently listed dropped), `treeChanged` events from disk, `events.subscribe` on the control channel with a TCP test (`crates/control/tests/events.rs`). M1.4: the tree runs against the engine in the app: folder picker (`project.openDialog`) and `lutra-desktop --control PORT PATH` open a project, the tree lists it lazily with ignored (`var/` from `.gitignore`) and excluded (`node_modules`) entries dimmed, a file created on disk appears in an expanded folder within ~100 ms; verified with `ui.screenshot` on Windows 11 and Vitest (`ui/tests/project/`, `ui/tests/ipcEvents.test.ts`). M1.13: a directory listed only partly (more than 100,000 entries) ends with a "Listing truncated" note row (Vitest). M1.12: a folder that cannot be opened from the picker or the command line (including `unsaved_changes` when switching projects) and stopped file watching show as toasts instead of stderr (`apps/lutra-desktop/src/host.rs`, `ui/src/stores/notifications.ts`, `ui/tests/notifications/`, 19 Vitest tests; live check pending, gaming mode); score unchanged. Graded against `plan/phpstorm/02-project-view.md`: tool window, folder-first tree, dimmed ignored/excluded, keyboard navigation and live refresh exist; most toolbar, view and display options do not |
| Navigation | 10 | 13% (est.) | go to declaration: type declaration, implementations, the hover link underline; find usages: popup variant, usages highlighted in the file, scopes, grouping options, read/write access; go-to: recent files on an empty query, a non-project toggle (library items always show), file-type filter, `:line` suffixes, actions and text tabs, sending the list to Find; recent files and locations, navigation history, File Structure popup, Structure speed search, sorting and filters (visibility, inherited members), autoscroll from the caret, navigation bar, bookmarks (M1.8: a command palette over commands only) | ~96 (est.) | M3.5: Go to Definition (`lsp.definition`, F12 or Mod+click with a pointer cursor while Mod is held) through Phpactor: one location revealed, several in a picker (one modal at a time), none as a toast; Find References (`lsp.references`, Shift+F12) in a References tab of the bottom panel, grouped by file with the line preview and the name marked, click or Enter reveals. Requests wait off the engine lock (pending outcomes) and see every edit sent before them. Live against Phpactor 2026.06.25.0 on Windows (port 7935, three-file temp project, debug build, tick on): class definition across files 93 ms cold, 7–18 ms warm; references (4 uses in 3 files, incl. a CRLF file) ~140 ms (measured). Tests: `crates/engine/tests/lsp_nav.rs` (fake server with scripted answers; an ignored real-Phpactor test), Vitest `ui/tests/nav/`. The F12 and F2 keys were not pressed in the live app (no key input without stealing the owner's focus); the key and click paths are covered by Vitest. M2.6: go-to popup `ui/src/components/goto/` with Files / Classes / Symbols tabs (Tab and Shift+Tab or a click switch, the text stays), UI commands `goto.fileOpen` `Mod+P`, `goto.classOpen` `Mod+Alt+C`, `goto.symbolOpen` `Mod+T` (optional `{query}` for agents), live query against `goto.*` (60 ms debounce, stale answers dropped), matched characters marked, directory / namespace / container column, library rows dimmed and labelled (`goto.file` items now carry `library`), an indexing hint with progress and a re-query on `indexReady`, Enter or a click opens through `editor.reveal`, Escape closes, one modal at a time; Vitest `ui/tests/goto/`, live-checked in the app (port 7826). M2.7: Structure tool window (`ui/src/components/structure/`) in a new left stripe with Project | Structure: the active tab's outline as a tree with Lucide kind icons and signatures, follows the active tab and edits (`outlineChanged`), click or Enter jumps through `editor.reveal`, arrows fold, `view.toggleStructure` `Mod+2`; engine `syntax.outline {id}` from a per-buffer tree-sitter tree reparsed off the engine lock on a worker thread (200 ms debounce). Tests: 11 engine unit tests, engine integration tests with a proptest of random edit sequences (end at a fresh parse's outline), a control-channel test (`crates/control/tests/syntax.rs`), 13 Vitest tests (`ui/tests/structure/`). Checked in the app on Windows 11 (bundled UI, control port 7827): a class file with namespace, interface, enum, trait, class with promoted property and a function; `outlineChanged` 149 ms after `file.open`, `view.toggleStructure` shows the tree, a jump to `find` centres line 62, an added method appears about 0.3 s after `buffer.edit` (debug build). Rows were not clicked in the app (the control channel has no input method); click and Enter are covered by Vitest. 1 MB file: `buffer.edit` ≤ 0.25 ms and `pump_vfs` ≤ 3.8 ms under the lock, edit to `outlineChanged` 0.43–0.76 s, `syntax.outline` 82 ms (release, measured). Graded against `plan/phpstorm/09-structure.md`. M2.5: symbol index in `crates/index` (every project file listed, `.php` parsed in parallel from tree-sitter outlines, vendor marked library, incremental on disk and buffer changes, capped at 200,000 files) and the engine commands `index.status`, `goto.file`, `goto.class`, `goto.symbol` (fuzzy, file names weighted, `Class::member`, project before library, partial results with `indexing: true`), events `indexProgress`/`indexReady`; 20k-file / 88 MB generated project indexed in 3.9–4.2 s (release, measured), queries 2–12 ms; tests `crates/index/tests/`, `crates/engine/tests/goto.rs`, `crates/control/tests/goto.rs`; reached from the UI by M2.6. M2.1: file outline in `crates/syntax` (namespaces braced and unbraced, classes, interfaces, traits, enums with cases, functions, methods, properties incl. promoted ones, constants; UTF-16 ranges and short signatures), the base for the Structure window (M2.7) and the symbol index (M2.5); not reachable from the UI yet, score unchanged. M1.8: `ui/src/components/palette/`, `ui/src/commands/` (fuzzy ranking, recent commands, global keymap), Vitest `ui/tests/palette/`, `ui/tests/commands/` |
| Search and replace | 6 | 8% (est.) | find in the current file, replace in files and in a file, scopes (module, directory, open files, custom), comment/string filters, search history, a tab per search, grouping options, merging matches on one line, find in path from the tree, structural search | ~70 (est.) | M2.4 Find tool window in a new resizable, collapsible bottom panel: query with case / whole word / regex toggles, include and exclude globs, streamed results grouped by file (sorted) with the match highlighted in the line preview, counts and elapsed time, cancel, a truncated hint, a refused regex or glob shown in place; Enter or click opens the match through `editor.reveal`, arrow keys / Page / Home / End walk the results; `find.open` (`Mod+Alt+F`, Lutra's own) prefills the selection or the word at the cursor, `find.open {query}` from an agent searches at once; a new search cancels the running one. Tests: 26 Vitest store and component tests (`ui/tests/find/FindToolWindow.test.ts`). Live check (bundled-ui debug build, control port 7824, 3-file temp project): `find.open {query}` over `uiCommand` showed 14 matches in 3 files (vendor included) grouped and highlighted in 17 ms; with `*.php` include 2 matches; revealing a result's position opened the file at the match; `find.open` without params prefilled the word at the cursor; a bad regex showed the engine's message in place (screenshots read, measured). Opening a result by mouse or Enter is covered by Vitest only (the control channel cannot click). M2.3 backend: `crates/search` (parallel `ignore` walk + `grep-searcher`: literal/regex, case, whole word, include/exclude globs, project ignore rules with `vendor/` searched and `node_modules` skipped, binary and > 8 MiB files skipped, match cap, cancel) and engine `search.find` / `search.cancel` with `searchResults` / `searchDone` events through the pump; dirty buffers are searched in their buffer text. Tests: 9 library tests incl. a property test of random queries and file bytes (`crates/search/tests/search.rs`), 3 preview/column unit tests, 4 engine tests (`crates/engine/tests/search.rs`), a TCP control-channel test (find → results → done, invalid regex, cancel; `crates/control/tests/search.rs`). 20k-file generated tree, release: first result 10–43 ms, full walk 0.66–1.43 s (measured); live over the control channel against the running app: first result 55 ms, done 386 ms on a 5,900-file project (debug build, measured) |
| Code completion | 10 | 5% (est.) | type-matching and second-invocation completion, postfix completion, live templates, path completion, ranking options and the replace-on-accept variant, accept characters, auto-insert of a single suggestion, auto-import checked against the real Phpactor (applied when the server sends it; tested with the fake server only), completion settings beyond H4's auto popup and delays (case sensitivity, sorting), parameter info settings, a documentation tool window, type info, faster indexing on Windows (Phpactor's tick-driven loop takes ~65 s for 2,000 classes) | ~240 (est.) | M3.4: completion, hover and signature help from Phpactor. Engine `lsp.completion {id, position, triggerCharacter?}` (items with label, kind, detail, Markdown documentation, insertText, textEdit, additionalTextEdits, sortText; at most 500, sorted by sortText, `incomplete` when cut or when the server says so; snippets turned into plain text), `lsp.hover` (Markdown, range) and `lsp.signatureHelp` (UTF-16 parameter spans), sent off the engine lock through M3.5's pending outcomes (`crates/engine/src/cmd/lsp_assist.rs`). Editor (`ui/src/components/editor/assist/`): a CodeMirror completion source with Lutra's own triggers (identifiers, `$`, `->`, `?->`, `::`, namespace `\`; not in strings or comments unless asked), the server's ranking as boost, local filtering for complete lists, text edits and imports applied in UTF-16 (CRLF files too), Lucide kind icons; hover documentation after 350 ms and on demand (`editor.quickDocumentation` `Mod+I`); signature help on `(` and `,` that follows the cursor (`editor.parameterInfo`); `editor.complete`; Markdown rendered by Lutra's own renderer without any HTML (XSS-tested). Tests: 6 engine tests against the fake server, 9 unit tests, 29 Vitest tests, an ignored test against the real PHAR. Measured with the real Phpactor on Windows 11 (debug build, 25 ms tick): completion while typing 61–109 ms (median 76 ms; ~107 ms through the control channel in the app), hover 4–91 ms (median 15–16 ms), signature help 4–28 ms (median 16 ms); a useful list 2.3 s after opening a file of a 20-class project and 65 s for 2,000 classes (Phpactor indexes first and answers with an empty incomplete list until then). Checked in the app (port 7934): completion after `->`, quick documentation of a class, parameter info with the active parameter, screenshots read. Graded against `plan/phpstorm/12-completion.md`: the depth comes from Phpactor (members, classes, variables, keywords; detail and documentation often missing), Lutra has no type inference of its own |
| Inspections and quick-fixes | 8 | 4% (est.) | Lutra's own inspections and their settings, severities per inspection, quick-fixes (LSP code actions), suppression, inspection profiles, running inspections on a scope, PHP lint syntax errors on Windows, the editor's problem counter and scrollbar marks, next/previous problem, a current-file Problems view and severity filters, external tools (PHPStan, Psalm, PHP_CodeSniffer) | ~290 (est.) | M3.3: diagnostics from Phpactor (worse reflection: missing members, unknown classes, …) as wavy underlines, gutter markers and hover messages in the editor (`ui/src/components/editor/lint.ts`, tokens only), and a Problems tab in the bottom panel grouped by file with click to reveal (`ui/src/components/problems/`, `problems.open` `Mod+Alt+P`); engine `diagnosticsChanged`, `diagnostics.list`, `lspStatus` (`crates/engine/src/lsp/`). Tests: 10 engine tests against a fake server incl. a sync proptest, a TCP test, 16 Vitest tests, an ignored test against the real PHAR. Checked in the app on Windows 11 with the real Phpactor (port 7933): five errors underlined and listed; first diagnostics 2.7 s after `file.open`, 2.7–2.9 s after an edit (debug build, measured, incl. Phpactor's 1 s debounce). Graded against `plan/phpstorm/11-problems.md`: the depth comes from Phpactor, Lutra has no inspections of its own |
| Code completion | 10 | 5% (est.) | type-matching and second-invocation completion, postfix completion, live templates, path completion, ranking options and the replace-on-accept variant, accept characters, auto-insert of a single suggestion, auto-import checked against the real Phpactor (applied when the server sends it; tested with the fake server only), completion settings beyond H4's auto popup and delays (case sensitivity, sorting), parameter info settings, a documentation tool window, type info | ~238 (est.) | H3: Phpactor indexes ~3× faster on Windows (a 1 ms tick while it reports progress and in a session's first 120 s): the first useful completion on a 2,000-class project after 20.7–26.9 s instead of 71.6 s (measured, debug build); its indexing progress shows in the status bar; `editor.completion.delayMs` stays 0 (Phpactor CPU per request and a request-count model measured; 100 ms only delays the list). M3.4: completion, hover and signature help from Phpactor. Engine `lsp.completion {id, position, triggerCharacter?}` (items with label, kind, detail, Markdown documentation, insertText, textEdit, additionalTextEdits, sortText; at most 500, sorted by sortText, `incomplete` when cut or when the server says so; snippets turned into plain text), `lsp.hover` (Markdown, range) and `lsp.signatureHelp` (UTF-16 parameter spans), sent off the engine lock through M3.5's pending outcomes (`crates/engine/src/cmd/lsp_assist.rs`). Editor (`ui/src/components/editor/assist/`): a CodeMirror completion source with Lutra's own triggers (identifiers, `$`, `->`, `?->`, `::`, namespace `\`; not in strings or comments unless asked), the server's ranking as boost, local filtering for complete lists, text edits and imports applied in UTF-16 (CRLF files too), Lucide kind icons; hover documentation after 350 ms and on demand (`editor.quickDocumentation` `Mod+I`); signature help on `(` and `,` that follows the cursor (`editor.parameterInfo`); `editor.complete`; Markdown rendered by Lutra's own renderer without any HTML (XSS-tested). Tests: 6 engine tests against the fake server, 9 unit tests, 29 Vitest tests, an ignored test against the real PHAR. Measured with the real Phpactor on Windows 11 (debug build, 25 ms tick): completion while typing 61–109 ms (median 76 ms; ~107 ms through the control channel in the app), hover 4–91 ms (median 15–16 ms), signature help 4–28 ms (median 16 ms); a useful list 2.3 s after opening a file of a 20-class project and 65 s for 2,000 classes (Phpactor indexes first and answers with an empty incomplete list until then). Checked in the app (port 7934): completion after `->`, quick documentation of a class, parameter info with the active parameter, screenshots read. Graded against `plan/phpstorm/12-completion.md`: the depth comes from Phpactor (members, classes, variables, keywords; detail and documentation often missing), Lutra has no type inference of its own |
| Inspections and quick-fixes | 8 | 5% (est.) | Lutra's own inspections and their settings, severities per inspection, quick-fixes (LSP code actions), suppression, inspection profiles, running inspections on a scope, the editor's problem counter and scrollbar marks, next/previous problem, a current-file Problems view and severity filters, external tools (PHPStan, Psalm, PHP_CodeSniffer) | ~287 (est.) | H3: PHP syntax errors on Windows from Lutra's own `php -l` (on open and save, off the engine lock, killed with Lutra), merged into the editor underlines and the Problems tab with source `php -l`; the language server's messages as notifications and its log as `lsp.log`. Tests: `crates/engine/tests/lsp_ux.rs`, unit tests incl. a parser proptest. M3.3: diagnostics from Phpactor (worse reflection: missing members, unknown classes, …) as wavy underlines, gutter markers and hover messages in the editor (`ui/src/components/editor/lint.ts`, tokens only), and a Problems tab in the bottom panel grouped by file with click to reveal (`ui/src/components/problems/`, `problems.open` `Mod+Alt+P`); engine `diagnosticsChanged`, `diagnostics.list`, `lspStatus` (`crates/engine/src/lsp/`). Tests: 10 engine tests against a fake server incl. a sync proptest, a TCP test, 16 Vitest tests, an ignored test against the real PHAR. Checked in the app on Windows 11 with the real Phpactor (port 7933): five errors underlined and listed; first diagnostics 2.7 s after `file.open`, 2.7–2.9 s after an edit (debug build, measured, incl. Phpactor's 1 s debounce). Graded against `plan/phpstorm/11-problems.md`: the depth comes from Phpactor, Lutra has no inspections of its own |
| Refactoring | 7 | 3% (est.) | rename: preview of all changes, comments/strings and text occurrences, scope, renaming files with classes, one undo across files (closed files written on disk are not undone by the editor); extract variable/method/constant, inline, move, change signature, safe delete, pull up/push down, introduce parameter | ~244 (est.) | M3.5: Rename (`lsp.prepareRename` then `lsp.rename`, F2) through Phpactor with an inline field over the symbol that shows how many uses in how many files change. The workspace edit is checked completely first (inside the project, ranges fit, open buffers unchanged since the request, no file operations); then closed files are written atomically through the VFS (written ones restored if a later write fails), open buffers change through `buffer.edit` (dirty, one undo step each in the editor), Phpactor reindexes the written files (sent as `didOpen`/`didSave`/`didClose`; its index followed in 140 ms, measured) and a summary notification follows. Live: renaming a method used in 3 files took 28 ms (open buffer + 2 closed files, CRLF kept). Tests: `crates/engine/tests/lsp_nav.rs` (multi-file rename incl. a closed CRLF file, an edit outside the project refused, a bad range refused, a buffer edited meanwhile refused; ignored real-Phpactor rename and rename back), Vitest `ui/tests/nav/`. |
| Code style and formatting | 4 | 0% | everything | ~120 (est.) | — |
| Git | 8 | 1% (est.) | everything visible: Changes window, commit UI, gutter markers, status colours, diff viewer, branch widget (C5 wave 2/3); log, blame, conflicts, stash, remotes (C6); ignored files in the status; chunk staging | ~148 (est.) | M4.1 (backend only, reachable through the palette, control channel and MCP): `git.status`, `git.stage`, `git.unstage` (also before the first commit), `git.commit {message, amend}` with hooks, `git.show` at HEAD or the index, `git.branches`, `git.checkout` (remote → tracking branch), `git.createBranch`; `gitChanged` after changes and from a `.git` poll plus the project watcher. Runs the installed git ≥ 2.30 (`git.executable`), porcelain v2 / `-z` only, no prompts, timeouts and caps, off the engine lock. Tests against real temp repositories (`crates/vcs/tests/repo.rs`, `crates/engine/tests/git.rs`). Graded against `plan/phpstorm/16-vcs-basics.md`: nothing a user sees yet, so the score stays near zero. |
@ -65,6 +65,7 @@ The project tree is the first user-visible feature (Project view 8%, estimated);
| Date | Change | Summary |
|---|---|---|
| 2026-10-25 | minor | H3: Inspections and quick-fixes 4% → 5% (est.), `php -l` on Windows; Code completion evidence (indexing ~3× faster), score unchanged; hours 290 → 287 and 240 → 238 |
| 2026-10-25 | minor | M4.1: Git 0% → 1% (est.), Git backend without UI; hours 150 → 148 |
| 2026-10-25 | minor | H5: Settings row evidence (banner-aligned themes, diagnostic and VCS tokens); score unchanged |
| 2026-10-24 | minor | H4: Settings 7% → 8% (est.), string and path controls, completion and tooltip settings; hours 60 → 58 |