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

Remove sync over async blocking in Extract Method/Interface options code #76510

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 18, 2024 23:40
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 18, 2024
@CyrusNajmabadi
Copy link
Member Author

@JoeRobich @jasonmalinowski ptal.

@@ -8,63 +8,56 @@
using System.Collections.Generic;
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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.

Copy link
Member

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);
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@CyrusNajmabadi CyrusNajmabadi merged commit 395d298 into dotnet:main Dec 19, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants