neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.74k stars 2.08k forks source link

puppet server not functional #2855

Closed dadav closed 1 year ago

dadav commented 1 year ago

Description

I'm using this config:

  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        puppet = {
          cmd = { "puppet-languageserver", "--stdio", "--debug", "STDOUT" },
        },
      },
    },
  },

Which leads to this errors on any puppet files:


Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:79: Content-Length not found in headers. "contentFormat\":[\"markdown\",\"plaintext\"],\"dynamicRegistration\":false},\"codeAction\":{\"codeActionLiteralSupport\":{\"codeActionKind\":{\"valueSet\":[\"\",\"quickfix\",\"refactor\",\"refactor.extract\",\"refactor.inline\",\"refactor.rewrite\",\"source\",\"source.organizeImports\"]}},\"dataSupport\":true,\"isPreferredSupport\":true,\"dynamicRegistration\":false,\"resolveSupport\":{\"properties\":[\"edit\"]}},\"callHierarchy\":{\"dynamicRegistration\":false}},\"window\":{\"showDocument\":{\"support\":true},\"workDoneProgress\":true,\"showMessage\":{\"messageActionItem\":{\"additionalPropertiesSupport\":false}}}},\"trace\":\"off\",\"processId\":5457,\"rootPath\":\"\\/tmp\\/puppetlabs-haproxy\",\"initializationOptions\":{},\"workspaceFolders\":[{\"name\":\"\\/tmp\\/puppetlabs-haproxy\",\"uri\":\"file:\\/\\/\\/tmp\\/puppetlabs-haproxy\"}]},\"method\":\"initialize\"}\
---\
D, [2023-10-10T18:54:30.705057 #5461] DEBUG -- : Received initialize method\
I, [2023-10-10T18:54:30.705271 #5461]  INFO -- : Loading Default Data via aggregate (Async)...\
D, [2023-10-10T18:54:30.706702 #5461] DEBUG -- : SidecarQueue Thread: Running sidecar [\"ruby\", \"/home/foobar/.local/share/nvim/mason/packages/puppet-editor-services/libexec/puppet-languageserver-sidecar\", \"--action\", \"default_aggregate\", \"--puppet-version=7.26.0\"]\
D, [2023-10-10T18:54:30.708091 #5461] DEBUG -- : SidecarQueue Thread: Running sidecar [\"ruby\", \"/home/foobar/.local/share/nvim/mason/packages/puppet-editor-services/libexec/puppet-languageserver-sidecar\", \"--action\", \"facts\", \"--puppet-version=7.26.0\"]\
I, [2023-10-10T18:54:30.708787 #5461]  INFO -- : Loading static data (Async)...\
D, [2023-10-10T18:54:30.712971 #5461] DEBUG -- : Importing static data file /home/foobar/.local/share/nvim/mason/packages/puppet-editor-services/libexec/lib/puppet-languageserver/static_data/bolt-aggregate.json...\
I, [2023-10-10T18:54:30.713116 #5461]  INFO -- : Loading Workspace Data via aggregate (Async)...\
D, [2023-10-10T18:54:30.713427 #5461] DEBUG -- : --- OUTBOUND\
{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"textDocumentSync\":1,\"hoverProvider\":true,\"completionProvider\":{\"resolveProvider\":true,\"triggerCharacters\":[\">\",\"$\",\"[\",\"=\"]},\"definitionProvider\":true,\"documentSymbolProvider\":true,\"workspaceSymbolProvider\":true,\"signatureHelpProvider\":{\"triggerCharacters\":[\"(\",\",\"]},\"documentOnTypeFormattingProvider\":{\"firstTriggerCharacter\":\">\"},\"foldingRangeProvider\":true}}}\
---\
Content-Length: 414"
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
    [C]: in function 'nvim_buf_set_option'
    ...nvim/lazy/nvim-notify/lua/notify/service/buffer/init.lua:103: in function 'render'
    .../share/nvim/lazy/nvim-notify/lua/notify/service/init.lua:53: in function 'push'
    ...ocal/share/nvim/lazy/nvim-notify/lua/notify/instance.lua:77: in function <...ocal/share/nvim/lazy/nvim-notify/lua/notify/instance.lua:41>
    ...e/nvim/lazy/noice.nvim/lua/noice/view/backend/notify.lua:169: in function '_notify'
    ...e/nvim/lazy/noice.nvim/lua/noice/view/backend/notify.lua:199: in function <...e/nvim/lazy/noice.nvim/lua/noice/view/backend/notify.lua:176>
    [C]: in function 'xpcall'
    ...local/share/nvim/lazy/noice.nvim/lua/noice/util/call.lua:149: in function 'try'
    ...local/share/nvim/lazy/noice.nvim/lua/noice/view/init.lua:140: in function 'display'
    .../share/nvim/lazy/noice.nvim/lua/noice/message/router.lua:215: in function <.../share/nvim/lazy/noice.nvim/lua/noice/message/router.lua:155>
    [C]: in function 'xpcall'
    ...local/share/nvim/lazy/noice.nvim/lua/noice/util/call.lua:149: in function <...local/share/nvim/lazy/noice.nvim/lua/noice/util/call.lua:134>
    [C]: in function 'pcall'
    ...local/share/nvim/lazy/noice.nvim/lua/noice/util/init.lua:120: in function ''
    vim/_editor.lua: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: cannot resume dead coroutine
stack traceback:
    [C]: in function 'parse_chunk'
    /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:261: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:247>

Neovim version

NVIM v0.9.2 Build type: Release LuaJIT 2.1.1694285958

Nvim-lspconfig version

2b361e0

Operating system and version

Archlinux 6.5.6-arch2-1

Affected language servers

puppet

Steps to reproduce

  1. Open any *.pp file with puppet lsp configured and debug mode enabled

Actual behavior

The server starts but crashes. LspInfo shows that no clients are attached to the buffer.

If I start the server without the debug option, 1 client is attached, but it also gives me not functionality (like auto-completion).

Expected behavior

Server starts without errors and gives auto-completion funcionality.

Minimal config

local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local lspconfig_path = join_paths(package_root, "test", "start", "nvim-lspconfig")

if vim.fn.isdirectory(lspconfig_path) ~= 1 then
    vim.fn.system({ "git", "clone", "https://github.com/neovim/nvim-lspconfig", lspconfig_path })
end

vim.lsp.set_log_level("trace")
require("vim.lsp.log").set_format_func(vim.inspect)
local nvim_lsp = require("lspconfig")
local on_attach = function(_, bufnr)
    local function buf_set_option(...)
        vim.api.nvim_buf_set_option(bufnr, ...)
    end

    buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")

    -- Mappings.
    local opts = { buffer = bufnr, noremap = true, silent = true }
    vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
    vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
    vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
    vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
    vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
    vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
    vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
    vim.keymap.set("n", "<space>wl", function()
        print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
    end, opts)
    vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
    vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
    vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
    vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
    vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
    vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
    vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
end

-- Add the server that troubles you here
local name = "puppet"
local cmd = { "puppet-languageserver", "--stdio", "--debug", "STDOUT" } -- needed for elixirls, lua_ls, omnisharp
if not name then
    print("You have not defined a server name, please edit minimal_init.lua")
end
if not nvim_lsp[name].document_config.default_config.cmd and not cmd then
    print([[You have not defined a server default cmd for a server
    that requires it please edit minimal_init.lua]])
end

nvim_lsp[name].setup({
    cmd = cmd,
    on_attach = on_attach,
})

print(
    [[You can find your log at $HOME/.cache/nvim/lsp.log. Please paste in a github issue under a details tag as described in the issue template.]]
)

LSP log

no logs get created with minimal_init.lua

dadav commented 1 year ago

Ahh, it tries to parse the debug message... which has no content-length. I'll check what's going on..

justinmk commented 1 year ago

Thanks for your report. The configs in this repo are unsupported and provided only as a starting point. We depend on users (like you) to troubleshoot issues with their specific LSP setups and send improvements.

If you found a bug in the core Nvim vim.lsp module (not part of this repo), the best way to get it fixed is to report to Nvim (not nvim-lspconfig) with: