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

Roslyn analyzers quickfix: Add option for Suppress / Suppressions #4595

Open
Tracked by #5951
LMSSonos opened this issue Jun 5, 2021 · 5 comments
Open
Tracked by #5951

Roslyn analyzers quickfix: Add option for Suppress / Suppressions #4595

LMSSonos opened this issue Jun 5, 2021 · 5 comments
Assignees

Comments

@LMSSonos
Copy link

LMSSonos commented Jun 5, 2021

Environment data

dotnet --info output: 5.0.203
.NET SDK (reflecting any global.json):
Version: 5.0.203
Commit: 383637d63f

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.203\

VS Code version: 1.56.2
C# Extension version: 1.23.12

Steps to reproduce

I think this is more a feature request than a bug. I
Type some code that the roslyn analyzer shows the issue and the quickfix bulband shows the quickfix (ctrl+.)

Expected behavior

Show option for suppression (as in visual studio) by pressing (ctrl+.) or clicking the bulb

Actual behavior

Shows only quickfix options to fix the code, but no suppression option.

@fgimian
Copy link

fgimian commented Jul 12, 2021

Yes please! And this should apply to all analyzers which are installed similar to Visual Studio. Having the ability to suppress at different levels would also be awesome (similar to Visual Studio). 😄

@mavasani
Copy link
Contributor

mavasani commented Jul 24, 2023

@Cosifne Where are we with support for nested actions? If that is still far away, we should consider adding back the 3 Suppression related actions (pragma/local SuppressMessageAttribute/global SuppressMessageAttribute), and keep the longer set of Configuration related actions hidden.

@Cosifne
Copy link
Member

Cosifne commented Jul 24, 2023

I haven't heard any progress within the VSCode.
After checking with @akhera99 she mentioned the recommended way would be https://code.visualstudio.com/api/ux-guidelines/quick-picks to use that.
I will check if it is possible to extend that in the language client

@Cosifne
Copy link
Member

Cosifne commented Jul 24, 2023

Looks like it is possible.
We can register a call back in the client middleware so it will handle all the code action. https://github.com/microsoft/vscode-languageserver-node/blob/f2ff7d55464a1f58f978cb6635bd8865f050553c/client/src/common/codeAction.ts#L113
For normal code action, forward it to the client.
For nested code actions, call window.ShowQuickPick(), nested as deep as we want. (Title/description might need to be modified a little to get things fit)

@Cosifne
Copy link
Member

Cosifne commented Jul 24, 2023

Maybe it would be best to prototype this and see if it is possible, I might not have time this week, can work on this next week

@Cosifne Cosifne self-assigned this Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants