F3: suspended Phpactor start, ConPTY shell in a job, cancel superseded completions, syntax proptest

- lutra_proc::spawn_suspended: CREATE_SUSPENDED, join the kill-on-close
  job, resume via a Tool Help thread snapshot. Opt-in for long-lived
  children (Phpactor); git, php -l and the probe keep spawn because the
  snapshot costs ~60 ms per start.
- lutra_proc::adopt + Guard (Windows): the terminal's ConPTY shell joins a
  job, so processes it started end with the tab or with Lutra.
- lsp.completion cancels the previous pending completion on the same
  server ($/cancelRequest); the cancelled command resolves empty.
- Syntax proptests compare leaf kinds, outline and folding instead of the
  S-expression (tree-sitter-php 0.25.1 keeps a union_type wrapper after
  an undo); Malte's seed added.
- docs/development.md: data dirs, target dir inside the repo, parallel
  builds, deleting ui/node_modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-27 17:28:54 +01:00
parent 7ad3005217
commit ebbc89832c
17 changed files with 468 additions and 36 deletions

View file

@ -147,6 +147,39 @@ fn completion_sees_the_edit_before_it_and_is_capped() {
assert_eq!(items[0]["label"], "item000");
}
#[test]
fn a_new_completion_cancels_the_one_it_supersedes() {
let (_dir, mut engine) = project(&[("a.php", "<?php\nSLOW")], true);
let id = open(&mut engine, "a.php");
let mut slow = engine
.execute(
"lsp.completion",
json!({"id": id, "position": {"line": 1, "column": 4}}),
)
.unwrap();
let slow = slow.pending.take().unwrap();
engine
.execute(
"buffer.edit",
json!({"id": id, "baseVersion": 1, "edits": [{"from": 6, "to": 10, "insert": ""}]}),
)
.unwrap();
let fresh = ask(
&mut engine,
"lsp.completion",
json!({"id": id, "position": {"line": 1, "column": 0}}),
)
.unwrap();
assert_eq!(fresh["items"].as_array().unwrap().len(), 4);
let started = std::time::Instant::now();
let superseded = engine.resolve(slow.wait()).unwrap().value;
assert!(
started.elapsed() < std::time::Duration::from_secs(5),
"the superseded request was not cancelled"
);
assert_eq!(superseded, json!({"items": [], "incomplete": false}));
}
#[test]
fn hover_and_signature_help() {
let (_dir, mut engine) = project(&[("a.php", "<?php\r\npair(1, 2);\r\n")], true);