From ffc613da83b2bda77844894979c45bab9b4a9cb2 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Mon, 15 Nov 2021 21:44:52 -0800 Subject: [PATCH] nvim: fix error relating to lua lsp loading --- .config/nvim/lua/blake/lsp.lua | 66 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/.config/nvim/lua/blake/lsp.lua b/.config/nvim/lua/blake/lsp.lua index a20a6e6..f28a6eb 100644 --- a/.config/nvim/lua/blake/lsp.lua +++ b/.config/nvim/lua/blake/lsp.lua @@ -212,7 +212,7 @@ M.lspconfig = function() bashls = 'bash-language-server', } 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 { on_attach = on_attach, flags = { @@ -223,7 +223,6 @@ M.lspconfig = function() end -- Custom servers >>> -- lua >>> - -- From kickstart.nvim: local sumneko_root_path local sumneko_binary if (vim.fn.exepath('lua-language-server') ~= '') then @@ -236,38 +235,41 @@ M.lspconfig = function() sumneko_binary = sumneko_root_path .. '/lua-language-server' end - -- Make runtime files discoverable to the server - local runtime_path = vim.split(package.path, ';') - table.insert(runtime_path, 'lua/?.lua') - table.insert(runtime_path, 'lua/?/init.lua') - - require('lspconfig').sumneko_lua.setup { - cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' }, - on_attach = on_attach, - capabilities = capabilities, - 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 = runtime_path, - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { 'vim' }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file('', true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, + -- From kickstart.nvim: + if (vim.fn.executable(sumneko_binary) == true) then + -- Make runtime files discoverable to the server + local runtime_path = vim.split(package.path, ';') + table.insert(runtime_path, 'lua/?.lua') + table.insert(runtime_path, 'lua/?/init.lua') + + require('lspconfig').sumneko_lua.setup { + cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' }, + on_attach = on_attach, + capabilities = capabilities, + 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 = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { 'vim' }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file('', true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, }, }, - }, - } + } + end -- lua <<< -- Custom servers <<< -- Load servers <<<