Skip to content

Feature request: opt-in setting to clear diagnostics immediately on didChange #11308

@alliprice

Description

@alliprice

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions