Nvim: switch from nvim-lsp-installer to masonry.nvim
This commit is contained in:
parent
d2821f9ba8
commit
9ef1115fa2
2 changed files with 32 additions and 36 deletions
|
@ -1,6 +1,5 @@
|
||||||
local lsp_installer = require('nvim-lsp-installer')
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
local lspconfig = require('lspconfig');
|
||||||
|
|
||||||
M.lsp_map_keys = function(server, bufnr)
|
M.lsp_map_keys = function(server, bufnr)
|
||||||
local function map_key(...)
|
local function map_key(...)
|
||||||
|
@ -50,41 +49,38 @@ capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||||
-- Setup LSP signature plugin
|
-- Setup LSP signature plugin
|
||||||
require('lsp_signature').setup()
|
require('lsp_signature').setup()
|
||||||
|
|
||||||
-- Register a handler that will be called for all installed servers.
|
-- Setup mason
|
||||||
lsp_installer.on_server_ready(function(server)
|
require("mason").setup()
|
||||||
-- Don't setup jdtls here since it is done by nvim-jdtls
|
require("mason-lspconfig").setup({automatic_installation = true})
|
||||||
if server.name == 'jdtls' then return end
|
|
||||||
|
|
||||||
local opts = {}
|
-- LSP servers setup
|
||||||
|
lspconfig.tsserver.setup {{}, on_attach = M.lsp_map_keys}
|
||||||
|
lspconfig.yamlls.setup {{}, on_attach = M.lsp_map_keys}
|
||||||
|
lspconfig.jsonls.setup {{}, on_attach = M.lsp_map_keys}
|
||||||
|
|
||||||
-- Lua specific settings
|
lspconfig.sumneko_lua.setup {
|
||||||
if server.name == 'sumneko_lua' then
|
settings = {
|
||||||
local runtime_path = vim.split(package.path, ';')
|
Lua = {
|
||||||
opts.settings = {
|
runtime = {
|
||||||
Lua = {
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
runtime = {
|
version = 'LuaJIT',
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Setup your lua path
|
||||||
version = 'LuaJIT',
|
path = vim.split(package.path, ';')
|
||||||
-- Setup your lua path
|
},
|
||||||
path = runtime_path
|
diagnostics = {
|
||||||
},
|
-- Get the language server to recognize the `vim` global
|
||||||
diagnostics = {
|
globals = {'vim'}
|
||||||
-- Get the language server to recognize the `vim` global
|
},
|
||||||
globals = {'vim'}
|
workspace = {
|
||||||
},
|
-- Make the server aware of Neovim runtime files
|
||||||
workspace = {
|
library = vim.api.nvim_get_runtime_file('', true)
|
||||||
-- 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}
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
|
||||||
telemetry = {enable = false}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
end
|
},
|
||||||
|
on_attach = M.lsp_map_keys,
|
||||||
opts.on_attach = M.lsp_map_keys
|
capabilities = capabilities
|
||||||
opts.capabilities = capabilities
|
}
|
||||||
server:setup(opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -65,7 +65,7 @@ require('packer').startup(function()
|
||||||
use 'neovim/nvim-lspconfig'
|
use 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
-- Install LSP server executables
|
-- Install LSP server executables
|
||||||
use 'williamboman/nvim-lsp-installer'
|
use {"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim"}
|
||||||
|
|
||||||
-- Additional LSP features for Java
|
-- Additional LSP features for Java
|
||||||
use 'mfussenegger/nvim-jdtls'
|
use 'mfussenegger/nvim-jdtls'
|
||||||
|
|
Loading…
Reference in a new issue