local Config = require('config') local now_if_args = Config.now_if_args if not Config.isNixCats then local m_add = MiniDeps.add now_if_args(function() m_add("neovim/nvim-lspconfig") end) end now_if_args(function() -- R.nvim owns the R `r_ls` client and starts its bundled rnvimserver from -- its own plugin directory. Keep R out of this generic server registry. local servers = { basedpyright = {}, ruff = {}, marksman = { filetypes = { "markdown", "markdown_inline", "codecompanion" }, }, harper_ls = { cmd = { "harper-ls", "--stdio" }, filetypes = { "markdown", "quarto", "text", "tex", "typst" }, root_markers = { ".git", ".harper" }, settings = { ["harper-ls"] = { linters = { SpellCheck = true, SpelledNumbers = false, AnA = true, SentenceCapitalization = true, UnclosedQuotes = true, WrongApostrophe = false, LongSentences = true, RepeatedWords = true, Spaces = true, CorrectNumberSuffix = true, }, codeActions = { ForceStable = false, }, markdown = { IgnoreLinkTitle = false, }, diagnosticSeverity = "hint", isolateEnglish = false, dialect = "American", maxFileLength = 120000, }, }, }, nil_ls = { settings = { ["nil"] = { formatting = { command = { "alejandra" }, }, }, }, }, nixd = { settings = { nixd = { formatting = { command = { "alejandra" }, }, options = { -- Downstream flakes can override these via lib.mkMerge on the lsp config. nixos = { expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.\"default\".options" }, home_manager = { expr = "(builtins.getFlake \"/etc/nixos\").homeConfigurations.\"default\".options" }, }, }, }, }, yamlls = { settings = { yaml = { schemas = { ["https://raw.githubusercontent.com/quarto-dev/quarto-cli/main/src/resources/schema/project.json"] = "**/_quarto.yml", ["https://raw.githubusercontent.com/quarto-dev/quarto-cli/main/src/resources/schema/document-quarto.json"] = "**/*.qmd", }, }, }, }, texlab = { single_file_support = true, }, julials = { settings = { julia = { format = { indent = 2, }, lsp = { autoStart = true, provideFormatter = true, }, }, }, }, lua_ls = { settings = { Lua = { completion = { callSnippet = "Replace", }, runtime = { version = "LuaJIT", }, diagnostics = { disable = { "trailing-space" }, globals = { "vim" }, }, workspace = { checkThirdParty = false, }, doc = { privateName = { "^_" }, }, telemetry = { enable = false, }, }, }, }, } local lsp_flags = { allow_incremental_sync = true, } if vim.fn.has("nvim-0.11") == 1 then -- Neovim 0.11+ Native LSP Configuration for name, config in pairs(servers) do vim.lsp.config(name, config) end vim.lsp.config('*', { flags = lsp_flags }) -- Enable all defined servers vim.lsp.enable(vim.tbl_keys(servers)) else -- Fallback for Neovim < 0.11 (using nvim-lspconfig) local lspconfig = require('lspconfig') for name, config in pairs(servers) do local final_config = vim.tbl_extend("force", { flags = lsp_flags }, config) lspconfig[name].setup(final_config) end end end)