make lsp setup more programmatic
This commit is contained in:
parent
8017c3fa3d
commit
d3ff6d853a
|
@ -0,0 +1,51 @@
|
||||||
|
-- enable mason and configure icons
|
||||||
|
require("mason").setup({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason-tool-installer").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"prettier", -- prettier formatter
|
||||||
|
-- "stylua", -- lua formatter
|
||||||
|
"isort", -- python formatter
|
||||||
|
"black", -- python formatter
|
||||||
|
"pylint", -- python linter
|
||||||
|
"eslint_d", -- js linter
|
||||||
|
},
|
||||||
|
})
|
||||||
|
--#################################################################################
|
||||||
|
--##### THESE ARE THE LANGUAGE SERVERS WE WANT
|
||||||
|
--#################################################################################
|
||||||
|
local lsps_for_install = { "eslint", "html", "cssls", "bashls", "grammarly" }
|
||||||
|
--make this table 2d to add configs
|
||||||
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
mason_lspconfig.setup {
|
||||||
|
ensure_installed = lsps_for_install
|
||||||
|
}
|
||||||
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
for _, lsp in pairs(lsps_for_install) do
|
||||||
|
lspconfig[lsp].setup {
|
||||||
|
capabilities = lsp_capabilities,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lspconfig.lua_ls.setup {
|
||||||
|
capabilities = lsp_capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue