-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Properly await calls to ensure exception handling works for sync and async scenarios #81826
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,7 @@ protected void EnqueueRefreshNotification(DocumentUri? documentUri) | |
| } | ||
| } | ||
|
|
||
| private ValueTask FilterLspTrackedDocumentsAsync( | ||
| private async ValueTask FilterLspTrackedDocumentsAsync( | ||
| LspWorkspaceManager lspWorkspaceManager, | ||
| IClientLanguageServerManager notificationManager, | ||
| ImmutableSegmentedList<DocumentUri?> documentUris, | ||
|
|
@@ -117,7 +117,11 @@ private ValueTask FilterLspTrackedDocumentsAsync( | |
| { | ||
| try | ||
| { | ||
| return notificationManager.SendRequestAsync(GetWorkspaceRefreshName(), cancellationToken); | ||
| // Fire the notification and immediately return. Refresh notifications are server-wide, and are not | ||
| // associated with a particular project/document. So once we've sent one, we can stop processing | ||
| // entirely. | ||
| await notificationManager.SendRequestAsync(GetWorkspaceRefreshName(), cancellationToken).ConfigureAwait(false); | ||
| return; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: this preserves thee old behavior. we were returning. so this would stop after the first hit. but i don't know if that's actually what we want here. note: if i don't return we get a high amount of memory use (presumably because we're issuing the refresh for a ton of cases. given that we dont' pass the docUri in, i'm guessing we do want tehse semantics.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, the old behavior is correct. refresh notifications are typically server-wide, and don't apply to a specific document or project. Once we've sent one, we don't need to send any more as a single request indicates everything (for that feature) is out of date. |
||
| } | ||
| catch (Exception ex) when (ex is ObjectDisposedException or ConnectionLostException) | ||
| { | ||
|
|
@@ -128,7 +132,6 @@ private ValueTask FilterLspTrackedDocumentsAsync( | |
| } | ||
|
|
||
| // LSP is already tracking all changed documents so we don't need to send a refresh request. | ||
| return ValueTask.CompletedTask; | ||
| } | ||
|
|
||
| public virtual void Dispose() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.