mattn / efm-langserver

General purpose Language Server
MIT License
1.36k stars 61 forks source link

"Client 1 quit with exit code 2 and signal 0" with twig filetype #127

Open dklymenk opened 3 years ago

dklymenk commented 3 years ago

I want to use prettier with twig via efm. I have prettier and the necessary extension for twig installed globally. Prettier works fine via both cli and efm. Here are some relevant lua configs:

local prettier_twig = {formatCommand = "prettier --tab-width 4 --stdin-filepath ${INPUT}", formatStdin = true}

require"lspconfig".efm.setup {
    cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
    init_options = {documentFormatting = true, codeAction = false},
    filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "json", "yaml", "markdown", "vue", "twig"},
    root_dir = require('lspconfig/util').root_pattern("node_modules", "tsconfig.json", "jsconfig.json", ".git"),
    settings = {
        languages = {
            ...
            twig = {prettier_twig}
        }
    }
}

So formatting works, but every time I exit vim I see "Client 1 quit with exit code 2 and signal 0" error. Relevant logs from ~/.cache/nvim/lsp.log:

[ START ] 2021-05-11T14:36:29+0300 ] LSP logging initiated
[ ERROR ] 2021-05-11T14:36:30+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]  "rpc"   "/home/dklymenk/.local/share/nvim/lspinstall/efm/efm-langserver"       "stderr"        "2021/05/11 14:36:30 efm-langserver: no configuration file\n2021/05/11 14:36:30 efm-langserver: reading on stdin, writing on stdout\n"
[ ERROR ] 2021-05-11T14:36:31+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]  "rpc"   "/home/dklymenk/.local/share/nvim/lspinstall/efm/efm-langserver"       "stderr"        "2021/05/11 14:36:31 lint for LanguageID not supported: twig\n"
[ ERROR ] 2021-05-11T14:36:32+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]  "rpc"   "/home/dklymenk/.local/share/nvim/lspinstall/efm/efm-langserver"       "stderr"        "panic: runtime error: invalid memory address or nil pointer dereference\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x55f2ca]\n\ngoroutine 7 [running]:\n"
[ ERROR ] 2021-05-11T14:36:32+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]  "rpc"   "/home/dklymenk/.local/share/nvim/lspinstall/efm/efm-langserver"       "stderr"        "time.(*Timer).Stop(...)\n\t/usr/lib/go/src/time/sleep.go:78\ngithub.com/mattn/efm-langserver/langserver.(*langHandler).handleShutdown(0xc00012e000, 0x5efd10, 0xc000014110, 0xc000132000, 0xc0000663c0, 0x58ff60, 0xc000011010, 0xc000125d60, 0x5455d4)\n\t/home/dklymenk/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/mattn/efm-langserver@v0.0.29/langserver/handle_shutdown.go:10 +0x2a\ngithub.com/mattn/efm-langserver/langserver.(*langHandler).handle(0xc00012e000, 0x5efd10, 0xc000014110, 0xc000132000, 0xc0000663c0, 0x0, 0x0, 0x0, 0x0)\n\t/home/dklymenk/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/mattn/efm-langserver@v0.0.29/langserver/handler.go:559 +0x19c\ngithub.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0xc0000104d0, 0x5efd10, 0xc000014110, 0xc000132000, 0xc0000663c0)\n\t/home/dklymenk/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20191222043438-96c4efab7ee2/handler_with_error.go:21 +0x72\ngithub.com/sourcegraph/jsonrpc2.(*Conn).readMessages(0xc000132000, 0x5efd10, 0xc000014110)\n\t/home/dklymenk/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20191222043438-96c4efab7ee2/jsonrpc2.go:522 +0x57e\ncreated by github.com/sourcegraph/jsonrpc2.NewConn\n\t/home/dklymenk/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20191222043438-96c4efab7ee2/jsonrpc2.go:334 +0x1d5\n"

One of the errors is 2021/05/11 14:36:31 lint for LanguageID not supported: twig\n, but I'm not exactly sure if disabling linting would resolve other errors.

Actually, while formatting works flawlessly, it also produces a bunch of "error" logs in ~/.cache/nvim/lsp.log. Stuff like no configuration file and invalid memory address or nil pointer deference is present there as well, but I honestly don't care about how clean those logs are, I kinda only care about the Client 1 quit with exit code 2 and signal 0 error when I close vim.

Please let me know if I should to provide any additional information. Thanks.

Nickroll commented 3 years ago

I am seeing a similar issue with efm on both python and lua file types. Funnily enough it only seems to happen when quitting neovim without writing (i.e :q gives the error while :wq does not).

Everything seems to be working fine though.

Relevant logs from~/.cache/nvim/lsp.log

[ ERROR ] 2021-05-12T19:23:58-0400 ] /squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]    "rpc"   "/home/nick/.local/share/nvim/lspinstall/efm/efm-langserver"    "stderr"    "2021/05/12 19:23:58 efm-langserver: no configuration file\n2021/05/12 19:23:58 efm-langserver: reading on stdin, writing on stdout\n"
[ ERROR ] 2021-05-12T19:23:58-0400 ] /squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]    "rpc"   "/home/nick/.local/share/nvim/lspinstall/efm/efm-langserver"    "stderr"    "2021/05/12 19:23:58 lint for LanguageID not supported: lua\n"
[ ERROR ] 2021-05-12T19:23:58-0400 ] /squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]    "rpc"   "/home/nick/.local/share/nvim/lspinstall/efm/efm-langserver"    "stderr"    "panic: runtime error: invalid memory address or nil pointer dereference\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x563a4a]\n\ngoroutine 19 [running]:\n"
[ ERROR ] 2021-05-12T19:23:58-0400 ] /squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]    "rpc"   "/home/nick/.local/share/nvim/lspinstall/efm/efm-langserver"    "stderr"    "time.(*Timer).Stop(...)\n\t/usr/local/go/src/time/sleep.go:76\ngithub.com/mattn/efm-langserver/langserver.(*langHandler).handleShutdown(0xc0000f2000, 0x5f6640, 0xc0000a8000, 0xc0000f6000, 0xc0000c0370, 0x595200, 0xc000096f20, 0xc0000f87c0, 0x0)\n\t/home/nick/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/mattn/efm-langserver@v0.0.29/langserver/handle_shutdown.go:10 +0x2a\ngithub.com/mattn/efm-langserver/langserver.(*langHandler).handle(0xc0000f2000, 0x5f6640, 0xc0000a8000, 0xc0000f6000, 0xc0000c0370, 0x595200, 0xc000096f20, 0x0, 0x0)\n\t/home/nick/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/mattn/efm-langserver@v0.0.29/langserver/handler.go:559 +0x19c\ngithub.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0xc000096480, 0x5f6640, 0xc0000a8000, 0xc0000f6000, 0xc0000c0370)\n\t/home/nick/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20191222043438-96c4efab7ee2/handler_with_error.go:21 +0x73\ngithub.com/sourcegraph/jsonrpc2.(*Conn).readMessages(0xc0000f6000, 0x5f6640"
[ ERROR ] 2021-05-12T19:23:58-0400 ] /squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]    "rpc"   "/home/nick/.local/share/nvim/lspinstall/efm/efm-langserver"    "stderr"    ", 0xc0000a8000)\n\t/home/nick/.local/share/nvim/lspinstall/efm/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20191222043438-96c4efab7ee2/jsonrpc2.go:334 +0x1d5\n"

Relevant efm lua


-- Python
local python_arguments = {}
local flake8 = {
    LintCommand = 'flake8 --ignore=E501,E252,E124,E741 --stdin-display-name ${INPUT} -',
    lintStdin = true,
}
local isort = {formatCommand = "isort --quiet -", formatStdin = true}
local black = {formatCommand = "black --quiet -", formatStdin = true}

table.insert(python_arguments, flake8)
table.insert(python_arguments, isort)
table.insert(python_arguments, black)

require"lspconfig".efm.setup {
    cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
    init_options = {documentFormatting = true, codeAction = false},
    filetypes = {
       "lua",
       "python",
       "sh",
       },
    settings = {
        rootMarkers = {".git/"},
        languages = {
            python = python_arguments,
            lua = lua_arguments,
            sh = sh_arguments,
       }
   }
}
pocco81 commented 3 years ago

Same here. Is there any setting that controls this? While this is solved, how could I "suppress" this message?

mattn commented 3 years ago

As far as I understand, this should be fixed.

https://github.com/mattn/efm-langserver/commit/96808fdc7c4408b3637a0decf3c52a854ea094b0

mjlbach commented 3 years ago

For everyone asking about this, it's neovim that prints the warning, not EFM.

AckslD commented 3 years ago

@mattn @mjlbach I started getting this yesterday on 0.0.31 which unless I'm mistaken includes the commit above. Are you not seeing it anymore?