-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Remove sync over async blocking in Extract Method/Interface options code #76510
Conversation
@JoeRobich @jasonmalinowski ptal. |
@@ -8,63 +8,56 @@ | |||
using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view with whitespace off.
_typeAnalysisResult.DocumentToExtractFrom, | ||
_typeAnalysisResult.TypeToExtractFrom, | ||
_typeAnalysisResult.ExtractableMembers, | ||
containingNamespaceDisplay, | ||
cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this was the goal. Note: This was terrifying as the impl was doing a JTF switch to teh ui thread. this was only ok as we're guaranteed to always be on the UI thread to begin with when calling GetOptions (guaranteed as a publicly documented contract of CodeActionWithOptions:
/// <summary>
/// Gets the options to use with this code action.
/// This method is guaranteed to be called on the UI thread.
/// </summary>
SyntaxFormattingOptions formattingOptions, | ||
CancellationToken cancellationToken) | ||
{ | ||
var result = _omniSharpExtractClassOptionsService.GetExtractClassOptionsAsync(document, originalType, selectedMembers).WaitAndGetResult_CanCallOnBackground(cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoeRobich If you can make the omnisharp ea interface synchronous, this can go away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation is already synchronous in O#. So feel free to update the EA interface and I'll fix things up accordingly with the next insertion.
string languageName, | ||
CancellationToken cancellationToken) | ||
{ | ||
var result = _omniSharpExtractInterfaceOptionsService.GetExtractInterfaceOptionsAsync(extractableMembers, defaultInterfaceName).WaitAndGetResult_CanCallOnBackground(cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
note: this is no worse than before. but now it's just isolated to the EA layer for omnisharp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
No description provided.