-- Servers start through native vim.lsp.enable. nvim-lspconfig only supplies -- defaults; overrides live in lsp/.lua. Called from plugins/lsp.lua. local M = {} M.servers = { "nixd", "lua_ls", "bashls", "yamlls", "jsonls", "marksman", "rust_analyzer", "gopls", "vtsls", "eslint", "basedpyright", "ruff", "intelephense", } local function restart() vim.cmd(vim.fn.exists(":lsp") == 2 and "lsp restart" or "LspRestart") end function M.setup() vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("core.lsp", { clear = true }), callback = function(ev) local client = vim.lsp.get_client_by_id(ev.data.client_id) if not client then return end if vim.b[ev.buf].bigfile then vim.schedule(function() vim.lsp.buf_detach_client(ev.buf, client.id) end) return end if client.name == "ruff" then client.server_capabilities.hoverProvider = false -- basedpyright owns hover end local function map(lhs, rhs, desc) vim.keymap.set("n", lhs, rhs, { buffer = ev.buf, desc = desc }) end map("li", "checkhealth vim.lsp", "LSP info") map("lr", restart, "Restart LSP servers") end, }) vim.lsp.enable(M.servers) end return M