return { { "neovim/nvim-lspconfig", dependencies = { "saghen/blink.cmp", }, opts = { servers = { clangd = { cmd = { "clangd", "--header-insertion=iwyu", "--background-index", "--clang-tidy", "--log=verbose", }, filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, single_file_support = true, }, cssls = {}, html = {}, jsonls = {}, lua_ls = { settings = { Lua = { runtime = { version = "LuaJIT", }, diagnostics = { globals = { "vim", "require", }, }, workspace = { library = vim.api.nvim_get_runtime_file("", true), }, telemetry = { enable = false, }, }, }, }, marksman = {}, solargraph = { cmd = { vim.fn.expand('~/.local/share/nvim/mason/bin/solargraph'), 'stdio', }, }, ts_ls = {}, }, }, config = function(_, opts) local lspconfig = require("lspconfig") local blink = require("blink.cmp") for server, config in pairs(opts.servers) do config.capabilities = blink.get_lsp_capabilities() lspconfig[server].setup(config) end vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if not client then return end vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Jumps to definition", buffer = args.buf }) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Jumps to declaration", buffer = args.buf }) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Lists all implementations", buffer = args.buf }) vim.keymap.set("n", "cf", function() vim.lsp.buf.format({ async = true, buffer = args.buf }) end, { desc = "Formats a buffer", buffer = args.buf }) vim.keymap.set("v", "", function() vim.lsp.buf.format({ async = true, buffer = args.buf }) end, { desc = "Formats a buffer", buffer = args.buf }) -- Disabled, kept temporarily here just for reference if false and vim.bo.filetype == "lua" then if client.supports_method("textDocument/formatting") then vim.api.nvim_create_autocmd("BufWritePre", { buffer = args.buf, callback = function() vim.lsp.buf.format({ bufnr = args.buf, id = client.id }) end, }) end end end }) vim.diagnostic.config({ underline = true, virtual_text = { prefix = " ●", }, signs = { text = { [vim.diagnostic.severity.ERROR] = "", [vim.diagnostic.severity.WARN] = "", [vim.diagnostic.severity.INFO] = "", [vim.diagnostic.severity.HINT] = "", }, }, }) end, }, }