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

@ -24,10 +24,13 @@
//! (then `RequestCancelled` and the notification `fake/cancelled`),
//! `fake/crash` exits with code 7, `fake/garbage` writes malformed frames
//! before answering. `shutdown` answers `null`; `exit` exits with 0.
//! - `--script FILE` reads a JSON object `{capabilities?, responses?}`:
//! `capabilities` are merged into the `initialize` answer, and
//! `responses` maps a request method to the result it gets, before the
//! built-in answers (M3.5: references, prepareRename, rename).
//! - `--script FILE` reads a JSON object
//! `{capabilities?, responses?, notifications?}`: `capabilities` are
//! merged into the `initialize` answer, `responses` maps a request
//! method to the result it gets, before the built-in answers (M3.5:
//! references, prepareRename, rename), and `notifications`
//! (`[{method, params}]`) are sent in order after `initialized` (H3:
//! messages and progress).
use std::collections::HashMap;
use std::io::{self, BufReader, Write};
@ -316,6 +319,18 @@ impl Fake {
"params": {"token": "t"}}),
);
notify("window/logMessage", json!({"type": 3, "message": "hello"}));
let scripted = self
.script
.get("notifications")
.and_then(Value::as_array)
.cloned()
.unwrap_or_default();
for n in scripted {
notify(
at(&n, "/method").as_str().unwrap_or_default(),
at(&n, "/params").clone(),
);
}
}
"exit" => exit(0),
"$/cancelRequest" => {