Closed ckaznocha closed 5 years ago
Yeah this seems like a very reasonable feature request. One potential issue is the code in your editor is not necessarily the code on disk. So a requirement for integrating a linter would be it supporting linting a file, but us sending the contents of it over stdin/etc.
I'm currently working on getting this implemented.
As far as I can tell, the language server doesn't currently implement any linting. The only diagnostics come from type checking errors. I'm not missing anything am I?
vscode-go currently supports golint
, gometalinter
, megacheck
, golangci-lint
, and revive
. I think gometalinter
and golangci-lint
would be a good start.
@ianlopshire thanks! Yes there is no support for linters currently. There are two routes you can take here:
Shelling out is likely the easiest and most maintainable approach for now. Unless of course a linter exposes a nice API to use.
@keegancsmith I've started down the shelling out path. From what I can see none of the popular linters will read from stdin. I understand this will prevent linting from being ran on unsaved files, but is there any reason not to implement lint on save (textDocument/didSave
)?
My WIP implementation does this and it seems to work, but I want to make sure I'm not going down a dead end.
great. on save seems fine to me.
We have support now for linters, and it is relatively easy to add support for more now. Thanks @ianlopshire!
Hi! Some users of my client are looking to use alternate linters for diagnostics, specifically golangci/golangci-lint. Could multiple linters be supported much like multiple formatters are now supported? I'd be happy to send a PR but I may not be able to get to it for a while.
For reference: https://github.com/ckaznocha/ide-go/issues/31
Thanks!