Skip to content

Commit

Permalink
feat(nvim): more flexible lsp settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Diaoul committed Dec 5, 2023
1 parent 574fec4 commit 33af5e3
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions .config/nvim/lua/diaoul/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ return {
dockerls = {},
jsonls = {},
lua_ls = {
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
},
},
telemetry = { enable = false },
},
telemetry = { enable = false },
},
pkgbuild_language_server = {},
pyright = {},
Expand Down Expand Up @@ -116,11 +118,20 @@ return {

mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
settings = opts.servers[server_name],
filetypes = (opts.servers[server_name] or {}).filetypes,
})
-- only setup lsps defined above
if not opts.servers[server_name] then
vim.notify(
("Server %s installed but not configured"):format(server_name),
vim.log.levels.WARN,
{ title = "LSP" }
)
return
end
local server_opts = { capabilities = capabilities }
for k, v in pairs(opts.servers[server_name]) do
server_opts[k] = v
end
require("lspconfig")[server_name].setup(server_opts)
end,
})

Expand Down

0 comments on commit 33af5e3

Please sign in to comment.