Skip to content

Delay squiggles - #3545

Draft
Andrew Casey (amcasey) wants to merge 6 commits into
mainfrom
amcasey/DelaySquiggles
Draft

Delay squiggles#3545
Andrew Casey (amcasey) wants to merge 6 commits into
mainfrom
amcasey/DelaySquiggles

Conversation

@amcasey

@amcasey Andrew Casey (amcasey) commented Aug 1, 2026

Copy link
Copy Markdown
Member

300ms when idle, 1500ms during active typing.
Squiggles for documents other than the one being edited refresh immediately. When the squiggle count drops to zero, refresh immediately.

Note: Does not affect computation of squiggles - only display.
Note: Doesn't affect the playground, which is deliberately bare-bones.

Caveat: Basically doesn't work without #3534 because the setTimeouts get starved.

300ms when idle, 1500ms during active typing.
Squiggles for documents other than the one being edited refresh immediately.
When the squiggle count drops to zero, refresh immediately.

Note: Does not affect computation of squiggles - only display.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a debounced “diagnostics publisher” so the VS Code extension can delay displaying squiggles for the actively edited document (while still computing diagnostics as before), reducing churn during typing.

Changes:

  • Introduces a DiagnosticsPublisher utility in the qsharp-lang npm package to debounce publishing for a single “hot” document with an idle delay and a maximum cap.
  • Integrates DiagnosticsPublisher into the VS Code language-service diagnostics pipeline and tracks the “hot” document based on text-change events.
  • Adds node-based unit tests for DiagnosticsPublisher and exports the new utility/types from the npm package entrypoint.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
source/vscode/src/language-service/diagnostics.ts Wraps diagnostic publishing with DiagnosticsPublisher and tracks the hot document from VS Code edit events.
source/npm/qsharp/test/diagnosticsPublisher.test.mjs Adds focused unit tests verifying debounce/cap/flush/dispose behavior.
source/npm/qsharp/src/main.ts Exports DiagnosticsPublisher and DiagnosticsPublisherOptions from the public npm API.
source/npm/qsharp/src/language-service/diagnosticsPublisher.ts Implements the debounced publisher logic (idle delay + max cap + immediate publish when cleared).

Comment thread source/vscode/src/language-service/diagnostics.ts Outdated
@amcasey

Copy link
Copy Markdown
Member Author

Offline copilot review found that the delays are based on diagnostic events, rather than edit events. Re-evaluating (though it seems to work well in practice).

@amcasey

Copy link
Copy Markdown
Member Author

We're reporting the same diagnostics as before, just later. The main consequence I can think of is that VS Code has some handling for stale squiggles - if you type within a squiggled span, the squiggle will expand to accommodate the new characters. We're losing that (for edits within a brief window) but the whole point of the change is to not have squiggles around the cursor while typing, so I think that's acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants