nametake / golangci-lint-langserver

golangci-lint language server
MIT License
221 stars 20 forks source link

No errors? #39

Closed toejough closed 4 months ago

toejough commented 4 months ago

Using nightly neovim and nvim-lsp, I can run the server & attach the client, but I don't get any errors. running golangci-lint independently, I get a ton.

I'm not sure how to debug this any further, or what additional data might be helpful. I have the same "connections opened" error in my log as others noted, but I'm not sure that's a real error.

toejough commented 4 months ago

FWIW, I got this working with mason-lspconfig like the following:

require("mason-lspconfig").setup_handlers {
    -- default lsp handler.
    function(server_name) require("lspconfig")[server_name].setup({}) end,
    -- dedicated handlers for specific servers.
    ["golangci_lint_ls"] = function()
        require('lspconfig').golangci_lint_ls.setup {
            filetypes = { 'go', 'gomod' },
            cmd = { 'golangci-lint-langserver' },
            root_dir = require('lspconfig').util.root_pattern('.git', 'go.mod'),
            init_options = {
                command = { "golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json", "--issues-exit-code=1" },
            }
        }
    end,
}