refactor(lsp)!: move servers to lspconfig plugin spec

This commit is contained in:
Folke Lemaitre 2023-01-07 10:44:17 +01:00
parent 8f782709d8
commit ef78153afa
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 17 additions and 29 deletions

View file

@ -11,7 +11,21 @@ return {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
---@type lspconfig.options ---@type lspconfig.options
servers = nil, servers = {
jsonls = {},
sumneko_lua = {
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
},
config = function(plugin) config = function(plugin)
-- setup formatting and keymaps -- setup formatting and keymaps
require("lazyvim.util").on_attach(function(client, buffer) require("lazyvim.util").on_attach(function(client, buffer)
@ -31,8 +45,8 @@ return {
severity_sort = true, severity_sort = true,
}) })
-- lspconfig ---@type lspconfig.options
local servers = plugin.servers or require("lazyvim.plugins.lsp.servers") local servers = plugin.servers or {}
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
require("mason-lspconfig").setup({ ensure_installed = vim.tbl_keys(servers) }) require("mason-lspconfig").setup({ ensure_installed = vim.tbl_keys(servers) })

View file

@ -1,26 +0,0 @@
-- Add any servers here together with their settings
---@type lspconfig.options
local servers = {
bashls = {},
clangd = {},
cssls = {},
tsserver = {},
html = {},
jsonls = {},
pyright = {},
yamlls = {},
sumneko_lua = {
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
}
return servers