nametake / golangci-lint-langserver

golangci-lint language server
MIT License
201 stars 19 forks source link

Language server crash on nvim with lspconfig #8

Closed othalla closed 2 years ago

othalla commented 3 years ago

Hello,

Installed this lib with neovim & lspconfig but seems not working for me.

Go 1.16.2 golangci-lint-langserver 0.0.5 novim NVIM v0.5.0-dev+1233-g82ac44d01 nvim-lspconfig master

Having this error [ ERROR ] 2021-04-15T12:48:17+0200 ] ...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]>-"rpc">"golangci-lint-langserver">-"stderr">-"unexpected end of JSON input\n"

nametake commented 2 years ago

It could not be reproduced with the following init.vim.

call plug#begin('~/.vim/plugged')
Plug 'neovim/nvim-lspconfig'
call plug#end()

lua << EOF
vim.lsp.set_log_level("debug")
local lspconfig = require 'lspconfig'
local configs = require 'lspconfig/configs'

if not lspconfig.golangcilsp then
  configs.golangcilsp = {
    default_config = {
      cmd = {'golangci-lint-langserver'},
      root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
      init_options = {
        command = { "golangci-lint", "run", "--enable-all", "--out-format", "json" };
      }
    };
  }
end
lspconfig.golangcilsp.setup {
    filetypes = {'go'}
}
EOF
screenshot

Please check your settings.

golangci-lint-langserver: v0.0.5

$ nvim -v
NVIM v0.5.0
Build type: Release
LuaJIT 2.1.0-beta3
othalla commented 2 years ago

Hi, I finally made it work. This module is great ;) Thanks !