iamcco / diagnostic-languageserver

diagnostic language server integrate with linters
MIT License
418 stars 28 forks source link

Display diagnostics only for the current file #29

Closed n9v9 closed 4 years ago

n9v9 commented 4 years ago

Hey there, first of all thanks for this nice extension. I am using it mainly for Go with golangci-lint. This linter does checks on directories and it reports all linting errors correctly. However when I have two files say A and B which both contain linting errors and I open A then I also get the errors from B displayed inside A's window:

image

Is it possible to only display the errors for file A and when I switch to file B to then display the errors for file B? When I use the sourceName property implemented in https://github.com/iamcco/diagnostic-languageserver/pull/26, I can see from which file the linting message comes, but all messages are still displayed.

Do you accept pull requests? If so then I would try to come up with a PR that filters the returned ILinterResult[] based on the textDocument.uri path only if the aforementioned sourceName property is given, or something like that.

Thanks!

iamcco commented 4 years ago

Yes, PR is welcome. It would better do not have breaking change.

n9v9 commented 4 years ago

Okay cool, how about an optional flag like filterCurrentFile?: bool that uses the above mentioned method only if it is explicitly set to true in the configuration? This way there should be no breaking changes as it is optional and defaults to the current method.

iamcco commented 4 years ago

looks good to me.