Feature request: opt-in setting to clear diagnostics immediately on didChange
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Is your feature request related to a problem? Please describe.**
When pyright is used as a language server by AI coding tools, stale diagnostics cause problems. The tool edits a file via `textDocument/didChange`, then reads diagnostics to decide what to do next. Because reanalysis is async, the diagnostics it reads are from the previous state. This causes the tool to re-fix already-fixed errors, miss newly introduced errors, or loop on diagnostics that no longer apply.
This isn't a problem for interactive editors where a human is still typing and the debounce is desirable.
**Describe the solution you'd like**
An opt-in setting (`pyright.eagerDiagnosticInvalidation`, default `false`) that publishes empty diagnostics for a file immediately on `didChange`, before reanalysis completes. No behavior change for anyone who doesn't enable it.
The setting would be configured by tool vendors in their LSP initialization config, not by end users.
I have a working implementation with tests if there's interest.
Contributor guide
Research direction
Start by locating the language-server handling for textDocument/didChange and the initialization settings for Pyright. Verify how diagnostics are published before and after asynchronous reanalysis, then add coverage for the opt-in setting, ensuring enabled changes publish empty diagnostics immediately while the default remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100