anott03 / nvim-lspinstall

88 stars 6 forks source link

Can't get lua-language-server executable #5

Closed trevarj closed 3 years ago

trevarj commented 3 years ago

I'm having this error when I use the following config:

Error, cmd ["$HOME/.local/share/nvim/lspinstall/lua-language-server/bin/Linux/lua-language-server"] is not executable.

Config:

-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
local sumneko_root_path = "$HOME/.local/share/nvim/lspinstall/lua-language-server"
local sumneko_binary = sumneko_root_path.."/bin/Linux/lua-language-server"

require'lspconfig'.sumneko_lua.setup {
  cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
  settings = {
    Lua = {
      runtime = {
        -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
        version = 'LuaJIT',
        -- Setup your lua path
        path = vim.split(package.path, ';'),
      },
      diagnostics = {
        -- Get the language server to recognize the `vim` global
        globals = {'vim'},
      },
      workspace = {
        -- Make the server aware of Neovim runtime files
        library = {
          [vim.fn.expand('$VIMRUNTIME/lua')] = true,
          [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
        },
      },
    },
  },
}
trevarj commented 3 years ago

User error, sorry.

vuki656 commented 3 years ago

How did you fix it?

trevarj commented 3 years ago

@vuki656 make the lua-language-server executable with chmod +x lua-language-server

anott03 commented 3 years ago

Looking at this again, I wouldn't call it user error @trevarj (though I appreciate you finding a solution) this is probably something this extension should do... especially since the instructions don't tell people they need to make it executable. Thanks for bringing it up (again)!

DanielTate commented 2 years ago

For anyone else this may help I had installed the lua lsp using :LspInstall command this expects your lua language server to be placed at a specific location. Make sure once you have compiled it you have it in the correct place.

https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#sumneko_lua

m42martin commented 2 years ago

I saw this error today while setting up sumenko_lua lsp. I moved the executable to a different folder and forgot to update the path info in the lsp-config.lua file.

My fault, but the error was not informative in this case. It should have told me that the exe lua-language-server cannot be found.

anott03 commented 2 years ago

@m42martin good to know! I will try to get to that when I have a free moment.