-- [[ 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 } -- import mason-null-ls plugin safely local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls") if not mason_null_ls_status then return end mason_null_ls.setup({ -- List of formatters and linters for Mason to install ensure_installed = { "prettier", -- ts/js formatter "stylua", -- lua formatter "eslint_d", -- ts/js linter }, -- auto-install configured formatters & linters (with null-ls) automatic_installation = true, })