Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pause a short while before computing if fixes or refactorings are available at a particular line #73755

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ private void OnTextViewClosed(object sender, EventArgs e)
public async Task<ISuggestedActionCategorySet?> GetSuggestedActionCategoriesAsync(
ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken)
{
// This function gets called immediately after operations like scrolling. We want to wait just a small
// amount to ensure that we don't immediately start consuming CPU/memory which then impedes the very
// action the user is trying to perform. To accomplish this, we wait 100ms. That's longer than normal
// keyboard repeat rates (usually around 30ms), but short enough that it's not noticeable to the user.
await Task.Delay(100, cancellationToken).NoThrowAwaitable();
if (cancellationToken.IsCancellationRequested)
return null;

using var state = _state.TryAddReference();
if (state is null)
return null;
Expand Down
Loading