Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the warning of Unnecessary Using of Directive in vscode?

I am currently using VS code develop my game with Unity.

Every time I open the editor, there is a 99+ Unnecessary using of directive which makes me unhappy. Since there are lots of dependency of 3rd party plugins, I'am not sure weather I can remove them. So I want to have some method to disable them.

I tried something like:

"csharp.lint.unnecessaryUsingDirective": "ignore"

But obviously, it doesn't work. So I wish there would be something I can do to hide or disable this warning.

like image 934
leon_jun Avatar asked Sep 20 '15 06:09

leon_jun


People also ask

How do I get rid of warnings in VS Code?

enable": false //... } in our settings. json file to disable TypeScript and JavaScript warnings by setting typescript. validate.

How do I get rid of the yellow warning in VS Code?

From 'Workspace Settings' into search field type 'javascript'. From left sidebar look for Extensions -> ESLint. Click 'ESLint' and from right look for 'ESLint: Enable'. Uncheck 'ESLint Enable'.


1 Answers

I think this issue has already been addressed in the latest version of Omnisharp — but because we are forced to use the legacy C# extension for Unity, the solution remains unclear.

We should be able to add something like this to an omnisharp.json file in our project root:

{
    "IgnoredCodeIssues": [
        "^Unnecessary using directive.$"
    ]
}

But presently, this throws an error:

System.FormatException: Unsupported JSON token 'StartArray' was found.
Path 'IgnoredCodeIssues', line 2 position 27.

I have opened a new issue specifically for the legacy C# extension, in hopes that it gets some feedback from the Omnisharp-VSCode team.

like image 175
jlmakes Avatar answered Oct 21 '22 03:10

jlmakes