modified lsp config.
This commit is contained in:
parent
1796fdbbf9
commit
e90208c701
4 changed files with 76 additions and 100 deletions
|
@ -1,50 +1,6 @@
|
|||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
|
||||
-- Include the servers you want to have installed by default below
|
||||
local install_servers=function()
|
||||
local servers = {
|
||||
'pyright',
|
||||
'bashls',
|
||||
'rust_analyzer',
|
||||
'sumenko_lua',
|
||||
'ltex',
|
||||
'texlab',
|
||||
}
|
||||
|
||||
local flag=false;
|
||||
for _, name in pairs(servers) do
|
||||
local server_is_found, server = lsp_installer.get_server(name)
|
||||
if server_is_found and not server:is_installed() then
|
||||
print("Installing " .. name)
|
||||
server:install()
|
||||
flag=true;
|
||||
end
|
||||
end
|
||||
if flag then
|
||||
print('All Servers Installed')
|
||||
end
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
|
||||
if server.name == "rust_analyzer" then
|
||||
-- Initialize the LSP via rust-tools instead
|
||||
require("rust-tools").setup {
|
||||
-- The "server" property provided in rust-tools setup function are the
|
||||
-- settings rust-tools will provide to lspconfig during init.
|
||||
-- We merge the necessary settings from nvim-lsp-installer (server:get_default_options())
|
||||
-- with the user's own settings (opts).
|
||||
server = vim.tbl_deep_extend("force", server:get_default_options(), opts),
|
||||
}
|
||||
server:attach_buffers()
|
||||
-- Only if standalone support is needed
|
||||
require("rust-tools").start_standalone_if_required()
|
||||
else
|
||||
server:setup(opts)
|
||||
end
|
||||
end)
|
||||
local opts = {}
|
||||
|
||||
local on_attach = function()
|
||||
local function set_keymap(...) vim.api.nvim_set_keymap(...) end
|
||||
|
@ -75,4 +31,3 @@ local on_attach = function()
|
|||
set_keymap('', ';lm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
on_attach()
|
||||
install_servers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue