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

Move to new API for GetSuggestedActions #39914

Merged
merged 9 commits into from
Dec 6, 2019

Conversation

mavasani
Copy link
Contributor

Editor team recently added a new GetSuggestedActions API overload that allows providing a more detailed operation scope message. This PR moves us to that API for Roslyn suggested actions. We now display the name of the executing analyzer/fixer/refactoring when user hits Ctrl + Dot to bring up the light bulb. This should help the users identify the slow extension and help us in improving performance of our analyzers/fixers/refactorings.

GatheringSuggestions_SlowAnalyzer

GatheringSuggestions_SlowCodeFixer

Editor team recently added a new GetSuggestedActions API overload that allows providing a more detailed operation scope message. This PR moves us to that API for Roslyn suggested actions. We now display the name of the executing analyzer/fixer/refactoring when user hits Ctrl + Dot to bring up the light bulb. This should help the users identify the slow extension and help us in improving performance of our analyzers/fixers/refactorings.
@mavasani mavasani added this to the 16.5 milestone Nov 21, 2019
@mavasani mavasani requested review from a team as code owners November 21, 2019 01:14
@CyrusNajmabadi
Copy link
Member

This is definitely interesting. But my preference woudl be more than when i'm invoking a code-action i get good feedback about what is going on. We used to support that, but now all i see is something vague like "applying code action to 'project'" which is effectively useless.

@CyrusNajmabadi
Copy link
Member

done with pass.

@mavasani
Copy link
Contributor Author

But my preference woudl be more than when i'm invoking a code-action i get good feedback about what is going on. We used to support that, but now all i see is something vague like "applying code action to 'project'" which is effectively useless.

Thanks, that would be a separate feature request. This PR mainly aims at improving the messaging when computing diagnostics + code actions for light bulb, so we can tackle some of the delays we are seeing light bulb showing up after Ctrl + Dot.

@sharwell
Copy link
Member

@mavasani Can you submit the NRT changes to master, and then we'll update this to a simpler form?

@mavasani
Copy link
Contributor Author

Can you submit the NRT changes to master, and then we'll update this to a simpler form?

Seems like lot of unnecessary duplicate work… the NRT changes are minimal, so is there a big concern in doing it within this PR? I believe it is best to keep enabling nullable as and when we update/fix code. Splitting into separate PR makes sense for large refactoring where nullable is enabled across large number of files/projects...

@CyrusNajmabadi
Copy link
Member

Thanks, that would be a separate feature request.

Agreed. Though my general feedback is: can we fix our existing bad behavior (and regressions) in this space prior to doing more feature work?

@mavasani
Copy link
Contributor Author

Seems like we still want to know when analyzers are running outside of lightbulb scenarios, just not for cases where the results are already computed and available from a cache.

Yes, but that should probably come at some other place. This code path does not guarantee analyzers are executed, their results might be used from the cache on this path.

@CyrusNajmabadi
Copy link
Member

I'm on the fence about the nullable changes. I think ther'es enough value here to keep in this PR. but it definitely added noise. However, as the king of making noisy chnages, it would be hypocritical of me to protest when i'm reviewing myself :D

Copy link
Contributor

@olegtk olegtk left a comment

Choose a reason for hiding this comment

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

In terms of using new LightBulb API looks good.

@mavasani
Copy link
Contributor Author

@sharwell @CyrusNajmabadi Any further feedback? thanks!

@mavasani
Copy link
Contributor Author

mavasani commented Nov 22, 2019

@jasonmalinowski Test failures in this PR seem to be coming from the inferred indentation kicking in at

private bool TryGetOptionForBuffer(ITextBuffer textBuffer, OptionKey option, out object? value)
{
if (option.Option == FormattingOptions.UseTabs)
{
value = !_indentationManagerService.UseSpacesForWhitespace(textBuffer, explicitFormat: false);
return true;
}
. This seems to be likely due to the fact that we are moving to a newer VS platform assemblies. Failing tests are:

  1. Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.DocumentationComments.DocumentationCommentTests.TestPressingEnter_Indentation5_UseTabs
  2. Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.DocumentationComments.DocumentationCommentTests.TestOpenLineBelow4_Tabs
  3. Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.DocumentationComments.DocumentationCommentTests.TestOpenLineAbove4_Tabs
  4. Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DocumentationComments.DocumentationCommentTests.TestOpenLineAbove4_Tabs
  5. Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DocumentationComments.DocumentationCommentTests.TestOpenLineBelow4_Tabs
  6. Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.DocumentationComments.DocumentationCommentTests.PressingEnter_Indentation5_UseTabs

I can do one of the following to resolve this (in order of my preference):

  1. Skip the failing tests with a tracking bug assigned to you
  2. Update the test to not have mixed tabs/spaces so inferred indentation does not kick in
  3. Add support (possibly an option) to allow disabling inferred indentation for unit tests

Let me know what you prefer. I took the first approach and filed #39967 - let me know if you feel otherwise.

@mavasani mavasani closed this Nov 24, 2019
@mavasani mavasani reopened this Nov 24, 2019
@mavasani
Copy link
Contributor Author

@dotnet/roslyn-infrastructure What is the version of Visual Studio being used for our integration tests? Have we moved to latest 16.4 public preview or are the integration tests still running on 16.3?

@mavasani mavasani changed the base branch from master-vs-deps to master December 5, 2019 22:36
@mavasani mavasani merged commit ea40cc4 into dotnet:master Dec 6, 2019
@mavasani mavasani deleted the NewSuggestedActionsApi branch December 6, 2019 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants