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

Add MS.CA.CSharp.Workspaces and MS.CA.VB.Workspaces as VSIX analyzer … #57294

Merged
merged 4 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -84,6 +84,26 @@ class Program
VisualStudio.Editor.Verify.CodeAction("using System;");
}

[WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnusedValues)]
[WorkItem(57293, "https://github.com/dotnet/roslyn/issues/57293")]
public void RemoveRedundantAssignmentCodeFix()
Copy link
Member

Choose a reason for hiding this comment

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

Just want to point out that this change is required at the moment to cover Core host sceanrios.

{
SetUpEditor(@"
using System;

public class Program
{
public static void Main(string[] args)
{
int x = 2;
x = 5;$$
}
}
");
VisualStudio.Editor.InvokeCodeActionList();
VisualStudio.Editor.Verify.CodeAction("Unnecessary assignment of a value to 'x'");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akhera99 Thanks for adding the test. Shouldn't the code action string here be 'Remove redundant assignment'?

image

Copy link
Member

Choose a reason for hiding this comment

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

yes sorry, it was late

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akhera99 You may need to fix the added integration test with a separate test-only PR.

}

[WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
public void FastDoubleInvoke()
{
Expand Down
2 changes: 2 additions & 0 deletions src/VisualStudio/Setup/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.EditorFeatures.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.Features.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.Workspaces.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.CSharp.Features.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" Path="Microsoft.CodeAnalysis.VisualBasic.Features.dll" />
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="XamlVisualStudio" Path="|XamlVisualStudio|" />
Expand Down