Skip to content

Large file edits trigger too many sequential analysis requests (no coalescing/cancellation) #744

Description

@MegaCoolBlood

Description

When editing large SQL files, it appears that the full file content is sent to the language server on every change (potentially every keystroke), and each request is then processed one-by-one.

This causes a backlog:

If I make many quick edits, many requests are queued.
Responses arrive slowly and are effectively stale (for older document versions).
Even after I stop typing, the server continues processing old versions for a long time.
Example scenario

10 edit bursts
~10 keystrokes each
~100 analysis requests queued
I can finish editing in ~5 minutes, but diagnostics/completions keep catching up on outdated versions (response 15, 16, 18, etc.)
Expected behavior

Coalesce rapid document changes.
Cancel or skip outdated in-flight/queued analysis for old document versions.
Prioritize only the latest document snapshot once prior work completes.
Avoid processing stale versions when a newer version is available.
Suggested approach

Debounce didChange handling for expensive analysis.
Track document version and discard results for non-current versions.
Add cancellation tokens for long-running DB-backed analysis.
Limit queue depth per document to 1 pending “latest” request (replace older pending ones).
Why this matters
This creates noticeable lag and unnecessary load for both the language server and database, especially on large files and fast typing workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions