vim: manage LSP servers with plugin 'williamboman/mason.nvim'
This commit is contained in:
parent
1954162b2b
commit
3daa827823
1 changed files with 19 additions and 16 deletions
|
@ -1,9 +1,3 @@
|
||||||
local servers = {
|
|
||||||
omnisharp = {
|
|
||||||
cmd = { vim.fn.expand '~/omnisharp/OmniSharp' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local filetypes = {
|
local filetypes = {
|
||||||
cs = function(client, bufnr)
|
cs = function(client, bufnr)
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
client.server_capabilities.semanticTokensProvider = nil
|
||||||
|
@ -36,18 +30,27 @@ local config = function()
|
||||||
vim.tbl_deep_extend('force', capabilities, cmp.default_capabilities())
|
vim.tbl_deep_extend('force', capabilities, cmp.default_capabilities())
|
||||||
end
|
end
|
||||||
|
|
||||||
lsp = require('lspconfig')
|
require('mason').setup()
|
||||||
for server, opts in pairs(servers) do
|
require('mason-lspconfig').setup {
|
||||||
opts = vim.tbl_deep_extend('keep', opts, {
|
handlers = {
|
||||||
on_attach = on_attach,
|
-- default handler
|
||||||
capabilities = capabilities,
|
function(server)
|
||||||
})
|
require('lspconfig')[server].setup {
|
||||||
lsp[server].setup(opts)
|
on_attach = on_attach,
|
||||||
end
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- server-specific handlers
|
||||||
|
-- ['server'] = function() --[[ server-specific stuff... ]] end
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
{ 'neovim/nvim-lspconfig', config = config },
|
||||||
config = config,
|
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue