From ecde08941b72cc0dc12c30073e5fce690efc5005 Mon Sep 17 00:00:00 2001 From: jdhao Date: Sat, 13 Aug 2022 23:08:25 +0800 Subject: [PATCH 1/2] update lua-language-server conf lua-language-server has changed its running method significantly, so we need to change it in the nvim-lspconfig. --- lua/config/lsp.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 6273231..16f4a30 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -148,17 +148,13 @@ if utils.executable('bash-language-server') then }) end -local sumneko_binary_path = fn.exepath("lua-language-server") -if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then - local sumneko_root_path = fn.fnamemodify(sumneko_binary_path, ":h:h:h") - +if utils.executable("lua-language-server") then local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") lspconfig.sumneko_lua.setup({ on_attach = custom_attach, - cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" }, settings = { Lua = { runtime = { From 97f302084f40bafc1e429d1021e55908c75b532a Mon Sep 17 00:00:00 2001 From: jdhao Date: Sun, 14 Aug 2022 17:53:40 +0800 Subject: [PATCH 2/2] update sumneko lua settings 1. remove runtime.path settings. It seems that it is not necessary, https://github.com/neovim/nvim-lspconfig/commit/03a047ef52d1bb68a96051c48855799f14a4623b. 2. update workspace.library, ref plugin ii14/emmylua-nvim --- lua/config/lsp.lua | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 16f4a30..6604553 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -149,10 +149,7 @@ if utils.executable('bash-language-server') then end if utils.executable("lua-language-server") then - local runtime_path = vim.split(package.path, ";") - table.insert(runtime_path, "lua/?.lua") - table.insert(runtime_path, "lua/?/init.lua") - + -- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings . lspconfig.sumneko_lua.setup({ on_attach = custom_attach, settings = { @@ -160,20 +157,18 @@ if utils.executable("lua-language-server") then 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 = api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, + -- Make the server aware of Neovim runtime files, + -- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace . + -- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua . + library = { fn.stdpath('data') .. "/site/pack/packer/opt/emmylua-nvim" }, + maxPreload = 2000, + preloadFileSize = 50000, }, }, },