OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Support for analyzers #683

Closed frarees closed 3 years ago

frarees commented 3 years ago

~/.omnisharp/omnisharp.json

{
  "cake": {
     "enabled": false
  },
  "script": {
     "enabled": false
  },
  "RoslynExtensionsOptions": {
    "enableAnalyzersSupport": true,
    "locationPaths": [
      "./extensions/Microsoft.Unity.Analyzers.dll"
    ]
  },
  "FormattingOptions": {
    "EnableEditorConfigSupport": true
  }
}

This doesn't seem to load Microsoft.Unity.Analyzers.dll. IIRC OmniSharp already has some support for them, so maybe it's me not setting things up properly, or omnisharp-vim not supporting this yet?

nickspoons commented 3 years ago

Does this config get you Unity analyser support in vscode?

frarees commented 3 years ago

Setting up vscode helped me understand the constraints.

locationPaths is treated as a relative path from the loaded sln, even when using a global omnisharp.json. I was also using a path to a specific dll which was wrong. In my specific case, I ended up using "Library/Analyzers", and placed the .dll file there.

Aside, it seems it doesn't priorize the analyzer. So for example:

private void FixedUpdate()
{
}

Using ALE it hints me IDE0051: Private member is unused. But if I launch code actions, I can see the additional UNT0001: Remove empty Unity message.

Is there any way to control diagnostics priority or order?

frarees commented 3 years ago

Is there any way to control diagnostics priority or order?

Actually, the concept I was behind is suppressors, and support is not available yet (see https://github.com/OmniSharp/omnisharp-roslyn/issues/1711).