Merge pull request #66471 from NousResearch/ethie/typescript-lsp

fix(lsp): never report stale diagnostics — version-gated freshness for slow servers
This commit is contained in:
ethernet 2026-07-20 14:16:50 -04:00 • committed by GitHub
commit 18ca0e862c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 503 additions and 93 deletions

View file

@ -151,6 +151,12 @@ lsp:
# How long to wait for diagnostics after each write.
wait_mode: document # "document" or "full"
# Max seconds to wait for the server to re-check the file after an
# edit. Only *fresh* diagnostics (produced for the post-edit
# content) are ever reported; if the server doesn't finish within
# this budget, the edit reports "no LSP data" rather than stale
# errors from before the edit. Raise this for slow servers on big
# projects (tsserver, rust-analyzer mid-indexing).
wait_timeout: 5.0
# How to handle missing server binaries.
@ -209,6 +215,13 @@ budget is `wait_timeout` seconds — typically the server responds in
tens of milliseconds for pyright/tsserver and a few seconds for
rust-analyzer mid-indexing.
Diagnostics are **freshness-gated**: a result only counts when the
server produced it for the content of the current edit (a
`publishDiagnostics` push at/after the change, or a pull request
answered after it). Slow servers that haven't re-checked yet result
in "no data" for that edit — never in yesterday's errors being
re-reported as current.
Servers are kept alive for the life of the Hermes process. There's
no idle-timeout reaper — the cost of restarting the server's index
on every write would be far higher than holding the daemon.