Commit cbb1394
Yogthos
feat(lsp): B3-10 — pull-diagnostic fallback for lazy LSP servers
lsp/client.rs:261-289 wait_for_push is push-only. For servers that
don't push on demand — clojure-lsp's lazy semantic check, jdtls
during cold-start, clangd before background indexing — the 10s
DIAGNOSTIC_WAIT times out and the post-write/edit diagnostic block
reports CLEAN even when errors actually exist. opencode races push
against textDocument/diagnostic (LSP 3.17) at lsp/client.ts:540-582.
New wait_for_push_or_pull:
1. Send textDocument/diagnostic pull request with 3s bound.
2. On success: inject items into state.push + last_push_at,
bump push_signal so concurrent waiters wake. Return Ok.
3. On error (method not found, transport): fall back to push wait
for the remaining time budget (min 100ms). Net behaviour for
push-only servers is identical to the prior wait_for_push.
Sequential pull-then-push rather than tokio::select! because the
select! version had a future-move issue — pull-success cases don't
need the push at all, so the sequential path is simpler and avoids
re-pinning.
State injection is the key piece: callers downstream (e.g.
write/edit's append_lsp_block) read state via diagnostics_for(path)
which is agnostic to push vs pull origin. After this fix, lazy
servers' diagnostics surface through the same code path as
push servers.
manager.rs touch_file() switches from wait_for_push to
wait_for_push_or_pull so all tool-end diagnostic waits benefit.
Tests: existing 123 lsp tests still pass; no new tests added since
the pull path requires a mock LSP server (no such fixture in
tree). The control-flow shape is straightforward and the fallback
to push preserves prior behaviour on unsupported servers.
Closes dirge-ims. Batch 3 complete — all 10 items closed.
Audit cycle done:
- Batch 1 (8 critical security/data-loss): 4 commits
- Batch 2 (3 context-fidelity): 1 commit
- Batch 3 (10 polish + features): 5 commits
- 21 audit issues closed across 10 commits.1 parent 927b9b6 commit cbb1394
3 files changed
Lines changed: 105 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
291 | 382 | | |
292 | 383 | | |
293 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
427 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
428 | 439 | | |
429 | 440 | | |
430 | 441 | | |
| |||
0 commit comments