dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

Hidden diagnostics are not displayed in the problems panel #3167

Closed ExceptionGit closed 5 days ago

ExceptionGit commented 5 years ago

Issue Description

Maybe after this https://github.com/OmniSharp/omnisharp-vscode/pull/2873 , the csharp.suppressHiddenDiagnostics option does nothing.

Environment data

C# Extension version: 1.20.0 , v1.21.0-beta1 , v1.21.0-beta2

Steps to reproduce

"csharp.suppressHiddenDiagnostics": false or "csharp.suppressHiddenDiagnostics": true

Expected behavior

Hidden diagnostics should be displayed in the problems panel.

Actual behavior

Hidden diagnostics are not displayed in the problems panel.

savpek commented 5 years ago

They were modified work so that csharp.suppressHiddenDiagnostics controls will hidden diagnostic be hidden or hints instead. Hints are visible as small dots in editor. However they are not visible in problem panel.

image

suppressHiddenDiagnostics was actually bit misleading, it didn't control visibility of issues but instead changed their severity in place from hidden -> information. There is mismatch between roslyn - vscode diagnostics since vscode doesn't have hidden diagnostic level at all.

As far as i know from PR/code history origin for this flag was workaround issue with unused usings where they were not visible since only analysis for them without analyzers had hidden severity. Back then there were no way to control how diagnostics behaved or what their severity was.

You can have fine grained control of issue severity and visibility with .ruleset files which are now supported in bot analyzers enabled and disabled.

Can you solve your use case with .rulesets? If not can you describe use case?

ExceptionGit commented 5 years ago

Can you solve your use case with .rulesets?

Yes, thanks @savpek . Would be nice to change the flag description to a more detailed.

rchande commented 5 years ago

@savpek Is there a way to do this without using a ruleset file?

savpek commented 5 years ago

@rchande I don't think that can be done without rulesets at current release.

fgimian commented 3 years ago

I will admit that this behaviour confused me too. My expectation would be that such errors would appear in the Problems panel after disabling csharp.suppressHiddenDiagnostics. It would be awesome to see a setting that allowed this to be the case without editing the ruleset or .editorconfig file.

JoeRobich commented 5 days ago

VS Code does not display hint diagnostics in the problems panel. See https://github.com/Microsoft/vscode/issues/45436