How can I configure the omnisharp syntastic syntax

2019-04-07 19:10发布

问题:

I've followed this guide for setting up my vim for c#. I works beautifully, but I've got an annoyance: The syntastic checker is a bit too harsh on me. Specifically it advises me to change this line:

var parser = new Parser(configuration, findReservations: true);

with the message "Redundant argument name specification". Of course I COULD just do as it says, but I happen to like my redundant argument specification. The reader of my code might not remember what that boolean is for otherwise. So... how can I tell syntastic (or omnisharp) to relax about this kind of warning?

回答1:

Modify the config.json file in the /bin/Debug folder of the server. On my machine the server is located in ~/.vim/bundle/Omnisharp/server/OmniSharp.

You'll see some example ignored code issues in the default config file.

To ignore this particular issue, add this rule:

"^Redundant argument name specification$"

If this is the only rule, besides the default rules, the IgnoredCodeIssues section of the config.js file will look like this:

"IgnoredCodeIssues": [
  "^Keyword 'private' is redundant. This is the default modifier.$",
  ".* should not separate words with an underscore.*",
  "^Redundant argument name specification$" 
],