nvim: fix error relating to lua lsp loading
This commit is contained in:
parent
8715300a8f
commit
ffc613da83
1 changed files with 34 additions and 32 deletions
|
@ -212,7 +212,7 @@ M.lspconfig = function()
|
||||||
bashls = 'bash-language-server',
|
bashls = 'bash-language-server',
|
||||||
}
|
}
|
||||||
for lsp, exe in pairs(lsp_servers) do
|
for lsp, exe in pairs(lsp_servers) do
|
||||||
if (vim.fn.executable(exe) == 1) then
|
if (vim.fn.executable(exe) == true) then
|
||||||
nvim_lsp[lsp].setup {
|
nvim_lsp[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = {
|
flags = {
|
||||||
|
@ -223,7 +223,6 @@ M.lspconfig = function()
|
||||||
end
|
end
|
||||||
-- Custom servers >>>
|
-- Custom servers >>>
|
||||||
-- lua >>>
|
-- lua >>>
|
||||||
-- From kickstart.nvim:
|
|
||||||
local sumneko_root_path
|
local sumneko_root_path
|
||||||
local sumneko_binary
|
local sumneko_binary
|
||||||
if (vim.fn.exepath('lua-language-server') ~= '') then
|
if (vim.fn.exepath('lua-language-server') ~= '') then
|
||||||
|
@ -236,38 +235,41 @@ M.lspconfig = function()
|
||||||
sumneko_binary = sumneko_root_path .. '/lua-language-server'
|
sumneko_binary = sumneko_root_path .. '/lua-language-server'
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Make runtime files discoverable to the server
|
-- From kickstart.nvim:
|
||||||
local runtime_path = vim.split(package.path, ';')
|
if (vim.fn.executable(sumneko_binary) == true) then
|
||||||
table.insert(runtime_path, 'lua/?.lua')
|
-- Make runtime files discoverable to the server
|
||||||
table.insert(runtime_path, 'lua/?/init.lua')
|
local runtime_path = vim.split(package.path, ';')
|
||||||
|
table.insert(runtime_path, 'lua/?.lua')
|
||||||
require('lspconfig').sumneko_lua.setup {
|
table.insert(runtime_path, 'lua/?/init.lua')
|
||||||
cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' },
|
|
||||||
on_attach = on_attach,
|
require('lspconfig').sumneko_lua.setup {
|
||||||
capabilities = capabilities,
|
cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' },
|
||||||
settings = {
|
on_attach = on_attach,
|
||||||
Lua = {
|
capabilities = capabilities,
|
||||||
runtime = {
|
settings = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
Lua = {
|
||||||
version = 'LuaJIT',
|
runtime = {
|
||||||
-- Setup your lua path
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
path = runtime_path,
|
version = 'LuaJIT',
|
||||||
},
|
-- Setup your lua path
|
||||||
diagnostics = {
|
path = runtime_path,
|
||||||
-- Get the language server to recognize the `vim` global
|
},
|
||||||
globals = { 'vim' },
|
diagnostics = {
|
||||||
},
|
-- Get the language server to recognize the `vim` global
|
||||||
workspace = {
|
globals = { 'vim' },
|
||||||
-- Make the server aware of Neovim runtime files
|
},
|
||||||
library = vim.api.nvim_get_runtime_file('', true),
|
workspace = {
|
||||||
},
|
-- Make the server aware of Neovim runtime files
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
library = vim.api.nvim_get_runtime_file('', true),
|
||||||
telemetry = {
|
},
|
||||||
enable = false,
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
end
|
||||||
-- lua <<<
|
-- lua <<<
|
||||||
-- Custom servers <<<
|
-- Custom servers <<<
|
||||||
-- Load servers <<<
|
-- Load servers <<<
|
||||||
|
|
Loading…
Add table
Reference in a new issue