nvim: lsp: Drop support for lua

We had added lua-language-server thinking it would be helpful for
Wireplumber development, but, due to the nature of lua and server
itself, the experience is utter crap in comparison to using LSP in
other languages.
This commit is contained in:
Sanchayan Maity 2021-11-28 17:06:56 +05:30
parent 00f67243f7
commit 3be8a76fe7

View file

@ -148,46 +148,6 @@ local on_attach = function(client, bufnr)
vim.cmd [[autocmd CursorHold,CursorHoldI <buffer> lua require'nvim-lightbulb'.update_lightbulb()]]
end
-- See https://github.com/sumneko/lua-language-server/wiki/Setting-without-VSCode#neovim-with-built-in-lsp-client
-- on why we do this library thing
-- Idea taken from https://gist.github.com/folke/fe5d28423ea5380929c3f7ce674c41d8
local determine_setup_lua = function ()
local library = {}
local cwd = vim.fn.getcwd()
local add_to_library = function(lib_path)
for _, p in pairs(vim.fn.expand(lib_path, false, true)) do
p = vim.loop.fs_realpath(p)
library[p] = true
end
end
if string.find(cwd, "neovim") then
add_to_library("$VIMRUNTIME")
elseif string.find(cwd, "dotfiles") then
add_to_library("$VIMRUNTIME")
add_to_library("~/.config/nvim")
add_to_library("~/.local/share/nvim/site/pack/packer/opt/*")
add_to_library("~/.local/share/nvim/site/pack/packer/start/*")
else
add_to_library(cwd .. "/*")
end
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local lua_version = function()
if string.find(cwd, "neovim") or string.find(cwd, "dotfiles") then
return "LuaJIT"
else
return "Lua 5.4"
end
end
return library, runtime_path, lua_version()
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = cmp.update_capabilities(capabilities)
@ -253,33 +213,6 @@ nvim_lsp.clangd.setup {
require('rust-tools').setup(rust_tool_opts)
local library, runtime_path, lua_version = determine_setup_lua()
nvim_lsp.sumneko_lua.setup {
cmd = { "/usr/bin/lua-language-server" };
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
version = lua_version,
path = runtime_path,
},
completion = { callSnippet = "Both" },
diagnostics = {
globals = {'vim'},
},
workspace = {
library = library,
maxPreload = 2000,
preloadFileSize = 50000
},
telemetry = {
enable = false,
},
},
},
}
nvim_lsp.tsserver.setup {
init_options = require("nvim-lsp-ts-utils").init_options,
on_attach = on_attach,