Merge branch 'dev' into gentoo
[nvim] feat: use nvim-lsp-installer install lsp servers through plugins !!! BREAKING: remove sumneko_lua submodule config adapted in consequence
This commit is contained in:
commit
c3741dbac7
@ -6,8 +6,10 @@
|
||||
local system_name = "Linux"
|
||||
|
||||
-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
|
||||
local sumneko_root_path = globals.lsp_path .. "/sumneko_lua"
|
||||
local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server"
|
||||
local sumneko_root_path = vim.fn.stdpath("data") ..
|
||||
"/lsp_servers/sumneko_lua/extension/server"
|
||||
local sumneko_binary = sumneko_root_path .. "/bin/" .. system_name ..
|
||||
"/lua-language-server"
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
|
||||
|
47
.config/nvim/lua/plugin/lsp_installer.lua
Normal file
47
.config/nvim/lua/plugin/lsp_installer.lua
Normal file
@ -0,0 +1,47 @@
|
||||
-- Author : swytch
|
||||
-- Created : Saturday Sept. 11, 2021 22:12:33 CET
|
||||
-- License : GPLv3
|
||||
-- Description : nvim-lsp-installer plugin config file
|
||||
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
lsp_installer.settings {
|
||||
ui = {
|
||||
icons = {
|
||||
server_installed = "✓",
|
||||
server_pending = "➜",
|
||||
server_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local servers = {
|
||||
"bashls",
|
||||
"jedi_language_server",
|
||||
"texlab",
|
||||
"sumneko_lua",
|
||||
}
|
||||
|
||||
for _, name in pairs(servers) do
|
||||
local ok, server = lsp_installer.get_server(name)
|
||||
-- Check that the server is supported in nvim-lsp-installer
|
||||
if ok then
|
||||
if not server:is_installed() then
|
||||
print("Installing " .. name)
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
|
||||
-- (optional) Customize the options passed to the server
|
||||
-- if server.name == "tsserver" then
|
||||
-- opts.root_dir = function() ... end
|
||||
-- end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
||||
server:setup(opts)
|
||||
vim.cmd [[ do User LspAttachBuffers ]]
|
||||
end)
|
@ -48,6 +48,15 @@ return require("packer").startup(function()
|
||||
}
|
||||
|
||||
-- LSP
|
||||
use {
|
||||
"williamboman/nvim-lsp-installer",
|
||||
cmd = {
|
||||
"LspInstall",
|
||||
"LspInstallInfo"
|
||||
},
|
||||
config = function() require("plugin.lsp_installer").setup() end
|
||||
}
|
||||
|
||||
use {
|
||||
"neovim/nvim-lspconfig",
|
||||
ft = { "c", "cpp", "lua", "python", "tex"},
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit c876e0da1c0c2d01db9cb0c6f2914659318e0460
|
Reference in New Issue
Block a user