kickstart.nvim/lua/custom/lsp/mason.lua

51 lines
1.5 KiB
Lua

-- [[ Configure LSP ]]
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
--
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
local servers = {
-- clangd = {},
gopls = {},
-- pyright = {},
-- rust_analyzer = {},
tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
diagnostics = {
globals = { 'vim' },
},
},
},
}
-- Setup neovim lua configuration
require('neodev').setup()
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = require("custom.lsp.handlers").capabilities,
on_attach = require("custom.lsp.handlers").on_attach,
settings = servers[server_name],
-- commented below as currently not overriding file types
-- filetypes = servers[server_name].filetypes,
}
end
}