Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions config/nvim-work/lua/lsp/bundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,34 @@ return {
"nvimtools/none-ls.nvim",
},
config = function()
local auto_servers = require("lsp.auto_servers")
local ensure_installed = auto_servers.get and auto_servers.get() or {}
local lsp_auto_servers = require("lsp.lsp-auto-servers")
local ensure_installed = lsp_auto_servers.get and lsp_auto_servers.get() or {}

-- Call your core setup function with the dynamic server list
require("lsp.core").setup(ensure_installed)

-- Load and apply enhanced server configurations
local server_configs = lsp_auto_servers.load_server_configs()

-- Apply enhanced configurations for specific servers using modern vim.lsp.config API
for server_name, config in pairs(server_configs) do
if config.settings then
-- Find the actual LSP server names for this configuration
if config.servers then
for _, server in ipairs(config.servers) do
if vim.tbl_contains(ensure_installed, server) then
vim.lsp.config[server] = {
settings = config.settings[server] or config.settings,
filetypes = config.filetypes,
root_dir = vim.fs.root,
single_file_support = true,
}
end
end
end
end
end

-- Setup signature if present
local signature = require("lsp.plugins.signature")
if signature.config then
Expand Down
41 changes: 29 additions & 12 deletions config/nvim-work/lua/lsp/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,28 @@ function M.setup(ensure_installed)
require("mason-lspconfig").setup({
ensure_installed = ensure_installed,
handlers = {
-- default handler
-- default handler using modern vim.lsp.config API
function(server_name)
require("lspconfig")[server_name].setup {
vim.lsp.config[server_name] = {
capabilities = M.capabilities,
on_attach = M.on_attach,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
["sqls"] = function()
require("lspconfig").sqls.setup {
vim.lsp.config.sqls = {
on_attach = function(client, bufnr)
require('sqls').on_attach(client, bufnr)
M.on_attach(client, bufnr)
end,
capabilities = M.capabilities,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
["lua_ls"] = function()
require("lspconfig").lua_ls.setup {
vim.lsp.config.lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
Expand All @@ -80,18 +84,25 @@ function M.setup(ensure_installed)
},
capabilities = M.capabilities,
on_attach = M.on_attach,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
["powershell_es"] = function()
local powershell_config = require("lsp.servers.powershell").powershell_es()
if powershell_config then
powershell_config.capabilities = M.capabilities
powershell_config.on_attach = M.on_attach
require("lspconfig").powershell_es.setup(powershell_config)
local powershell_servers = require("lsp.servers.powershell")
if powershell_servers and powershell_servers.settings then
vim.lsp.config.powershell_es = {
settings = powershell_servers.settings.powershell,
capabilities = M.capabilities,
on_attach = M.on_attach,
filetypes = powershell_servers.filetypes,
root_dir = vim.fs.root,
single_file_support = true,
}
end
end,
["pyright"] = function()
require("lspconfig").pyright.setup {
vim.lsp.config.pyright = {
settings = {
python = {
analysis = {
Expand All @@ -101,10 +112,12 @@ function M.setup(ensure_installed)
},
capabilities = M.capabilities,
on_attach = M.on_attach,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
["gopls"] = function()
require("lspconfig").gopls.setup {
vim.lsp.config.gopls = {
settings = {
gopls = {
analyses = {
Expand All @@ -116,10 +129,12 @@ function M.setup(ensure_installed)
},
capabilities = M.capabilities,
on_attach = M.on_attach,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
["yamlls"] = function()
require("lspconfig").yamlls.setup {
vim.lsp.config.yamlls = {
settings = {
yaml = {
schemas = require('schemastore').yaml.schemas(),
Expand All @@ -128,6 +143,8 @@ function M.setup(ensure_installed)
},
capabilities = M.capabilities,
on_attach = M.on_attach,
root_dir = vim.fs.root,
single_file_support = true,
}
end,
},
Expand Down
Loading