aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/lsp/mason.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/alpha/lsp/mason.lua')
-rw-r--r--lua/alpha/lsp/mason.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/lua/alpha/lsp/mason.lua b/lua/alpha/lsp/mason.lua
index 345301a..5ad4b77 100644
--- a/lua/alpha/lsp/mason.lua
+++ b/lua/alpha/lsp/mason.lua
@@ -1,12 +1,25 @@
local mason = require "mason"
local mason_lspconfig = require "mason-lspconfig"
+local servers = require "alpha.lsp.servers"
+local lspconfig = require "lspconfig"
mason.setup()
+local mason_servers = {}
+
+-- TODO: can be improve checking the setup function to see if sets the cmd
+for server, value in pairs(servers) do
+ local cmd = lspconfig[server].document_config.default_config.cmd[1]
+ if vim.fn.executable(cmd) == 0 then
+ table.insert(mason, server)
+ end
+end
+
mason_lspconfig.setup {
- ensure_installed = require "alpha.lsp.servers",
+ ensure_installed = mason_servers,
}
+-- filter the list for the ones not globally installed
require("mason-tool-installer").setup {
ensure_installed = require "alpha.lsp.tools",
}