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

EditorConfig: .NET ErrorCodes have no effect #4165

Closed
nonsensation opened this issue Oct 30, 2020 · 4 comments · Fixed by OmniSharp/omnisharp-roslyn#2028
Closed

EditorConfig: .NET ErrorCodes have no effect #4165

nonsensation opened this issue Oct 30, 2020 · 4 comments · Fixed by OmniSharp/omnisharp-roslyn#2028

Comments

@nonsensation
Copy link

I have the EditorConfig extension and using OmniSharp (latest version, checked for updates in VSCode)
The .editorconfig file gets loaded and changes to it take effect on save.

# DO NOT WORK
[*.cs]
dotnet_diagnostic.IDE0044.severity = none # Make field readonly
dotnet_diagnostic.IDE0060.severity = none # Remove unused parameter
dotnet_diagnostic.IDE0063.severity = none # 'using' statement can be simplified
dotnet_diagnostic.CA1805.severity = none # Member is explicitly initialized to its default value
dotnet_diagnostic.IDE0052.severity = none # Private member can be removed as the value assigned to it is never read.
dotnet_diagnostic.CA1822.severity = none # Member does not access instance data and can be marked as static

# DO WORK
# dotnet_analyzer_diagnostic.category-performance.severity = error
# dotnet_analyzer_diagnostic.severity = error

The last 2 lines (commented out) do have an effect and work as expected, however none of the above, where the Errorcode is set explicitly, have any effect.

I have EditorConfig enabled in VSCode-Settings (settings.json):

    "omnisharp.enableEditorConfigSupport": true,
    "omnisharp.enableRoslynAnalyzers": true,

and in OmniSharp-setting (omnisharp.json):

{
    "FormattingOptions": {
      "enableEditorConfigSupport": true
    },
    "RoslynExtensionsOptions": {
      "enableAnalyzersSupport": true
    }
}

I've read several Issues (#3991, #4062, #4082) in which these settings did work, so it is me, but what did I do wrong?

Appreciate every help I can get,
thank you very much.

Extension version: 1.23.4
VS Code version: Code 1.50.1 (d2e414d9e4239a252d1ab117bd7067f125afd80a, 2020-10-13T15:06:15.712Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz (4 x 3293)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 10.96GB (5.95GB free)
Process Argv --crash-reporter-id f024d62d-25ea-4f0f-b0e2-c340c1a896f7
Screen Reader no
VM 0%
@justinmchase
Copy link

justinmchase commented Nov 11, 2020

I'm getting the same thing. Actually I had to restart omnisharp after making some changes to make it work.

@ffMathy
Copy link

ffMathy commented Nov 18, 2020

I'm experiencing the same issue.

@filipw
Copy link
Contributor

filipw commented Nov 18, 2020

@nonsensation would you be able to provide a project that reproduces this? Looks like it's specific to your project somehow.

It definitely should work, however as @justinmchase points out at the moment live reload is not there.
For example CA1052 rule (apologies for my German locale):

Bildschirmfoto 2020-11-18 um 14 06 28

Bildschirmfoto 2020-11-18 um 14 08 02

@nonsensation
Copy link
Author

nonsensation commented Nov 19, 2020

I haven't used VSCode for the last past 2 weeks, just opened it now to reproduce this.
Updated before VSCode to 1.51.1 and EditorConfig-Extension is at 0.15.1, OmniSharp v1.23.6

dotnet --version 5.0.100

With these versions, suppressing individual errorcodes.

However, I came across of unreproducible bugs (suddenly showing up all supressed warnings, sometimes changes in .edfitorconfig reflected in the code withjout restarting VSCode, sometimes needed to restart and so on).
When I figure out how to reproduce them, I'll report back.

But it seems to work for the most part for now.

Thank you for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants