Skip to content

Fix semantic highlighting cancellation during rapid typing#2301

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-semantic-highlighting-issue
Draft

Fix semantic highlighting cancellation during rapid typing#2301
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-semantic-highlighting-issue

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Rapid typing could cancel completion work in a way that left semantic token delta requests without a response, which prevented VS Code from updating semantic highlighting for newly typed text.

  • Request pipeline

    • Remove serial processing from PsesCompletionHandler registration so completion cancellations no longer block the semantic tokens pipeline.
    • Keep completion requests interruptible without coupling them to DidChangeTextDocument sequencing.
  • Cancellation handling

    • Catch TaskCanceledException in completion-item resolve and return the original item instead of letting cancellation escape through the LSP pipeline.
    • Preserve the existing completion response shape when the underlying command lookup is canceled.
  • Regression coverage

    • Add a test for the completion resolve cancellation path to verify the handler returns cleanly under cancellation.
    • Update the test to use CancelAsync() to avoid synchronous cancellation analyzer violations.
try
{
    CommandInfo commandInfo = await CommandHelpers.GetCommandInfoAsync(..., cancellationToken);

    if (commandInfo is not null)
    {
        return request with
        {
            Documentation = await CommandHelpers.GetCommandSynopsisAsync(
                commandInfo, _executionService, cancellationToken)
        };
    }
}
catch (TaskCanceledException)
{
    return request;
}

Copilot AI changed the title [WIP] Fix semantic highlighting breaks when rapidly typing Prevent semantic token pipeline stalls from completion cancellation Jun 10, 2026
Copilot AI requested a review from JustinGrote June 10, 2026 23:05
Copilot AI changed the title Prevent semantic token pipeline stalls from completion cancellation Fix semantic highlighting cancellation during rapid typing Jun 10, 2026
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.

Semantic Highlighting breaks when rapidly typing due to improper cancellation

2 participants