nvim/lua/configs/lspconfig.lua

22 lines
606 B
Lua
Raw Normal View History

2026-07-26 13:02:30 +01:00
require("nvchad.configs.lspconfig").defaults()
local lsp_dir = vim.fn.stdpath("data") .. "/lazy/nvim-lspconfig/lsp"
local ok, files = pcall(vim.fn.readdir, lsp_dir)
if not ok then
return
end
for _, file in ipairs(files) do
local name = file:match("^(.+)%.lua$")
if name then
local cfg_ok, cfg = pcall(dofile, lsp_dir .. "/" .. file)
if cfg_ok and type(cfg) == "table" and type(cfg.cmd) == "table" then
local cmd = cfg.cmd[1]
if type(cmd) == "string" and vim.fn.executable(cmd) == 1 then
vim.lsp.config(name, cfg)
vim.lsp.enable(name)
end
end
end
end