|
| 1 | +return { |
| 2 | + diagnostics = { |
| 3 | + virtual_text = true, |
| 4 | + signs = { |
| 5 | + active = { |
| 6 | + { name = "DiagnosticSignError", text = "", texthl = "DiagnosticSignError" }, |
| 7 | + { name = "DiagnosticSignHint", text = "", texthl = "DiagnosticSignHint" }, |
| 8 | + { name = "DiagnosticSignInfo", text = "", texthl = "DiagnosticSignInfo" }, |
| 9 | + { name = "DiagnosticSignWarn", text = "", texthl = "DiagnosticSignWarn" }, |
| 10 | + { name = "DapBreakpoint", text = "", texthl = "DiagnosticInfo" }, |
| 11 | + { name = "DapBreakpointCondition", text = "", texthl = "DiagnosticInfo" }, |
| 12 | + { name = "DapBreakpointRejected", text = "", texthl = "DiagnosticError" }, |
| 13 | + { name = "DapLogPoint", text = ".>", texthl = "DiagnosticInfo" }, |
| 14 | + { name = "DapStopped", text = "", texthl = "DiagnosticWarn" }, |
| 15 | + }, |
| 16 | + }, |
| 17 | + update_in_insert = true, |
| 18 | + underline = true, |
| 19 | + severity_sort = true, |
| 20 | + float = { |
| 21 | + focused = false, |
| 22 | + style = "minimal", |
| 23 | + border = "rounded", |
| 24 | + source = "always", |
| 25 | + header = "", |
| 26 | + prefix = "", |
| 27 | + }, |
| 28 | + }, |
| 29 | + |
| 30 | + capabilities = vim.tbl_deep_extend("force", vim.lsp.protocol.make_client_capabilities(), { |
| 31 | + textDocument = { |
| 32 | + completion = { |
| 33 | + completionItem = { |
| 34 | + documentationFormat = { "markdown", "plaintext" }, |
| 35 | + snippetSupport = true, |
| 36 | + preselectSupport = true, |
| 37 | + insertReplaceSupport = true, |
| 38 | + labelDetailsSupport = true, |
| 39 | + deprecatedSupport = true, |
| 40 | + commitCharactersSupport = true, |
| 41 | + tagSupport = { valueSet = { 1 } }, |
| 42 | + resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits" } }, |
| 43 | + }, |
| 44 | + }, |
| 45 | + foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }, |
| 46 | + }, |
| 47 | + }), |
| 48 | + |
| 49 | + flags = {}, |
| 50 | + |
| 51 | + config = {}, |
| 52 | + |
| 53 | + -- on_attach = function(client, bufnr) ... end, -- user can pass in an extension of the on_attach |
| 54 | + |
| 55 | + setup_handlers = { |
| 56 | + function(server, opts) require("lspconfig")[server].setup(opts) end, |
| 57 | + }, |
| 58 | + |
| 59 | + formatting = { format_on_save = { enabled = true }, disable = {} }, |
| 60 | + |
| 61 | + mappings = { |
| 62 | + n = { |
| 63 | + -- no cond will always be set |
| 64 | + ["<leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, |
| 65 | + ["[d"] = { function() vim.diagnostic.goto_prev() end, desc = "Previous diagnostic" }, |
| 66 | + ["]d"] = { function() vim.diagnostic.goto_next() end, desc = "Next diagnostic" }, |
| 67 | + ["gl"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, |
| 68 | + |
| 69 | + ["<leader>lD"] = { |
| 70 | + function() require("telescope.builtin").diagnostics() end, |
| 71 | + desc = "Search diagnostics", |
| 72 | + cond = function(_, _) return true end, -- client, bufnr parameters |
| 73 | + }, |
| 74 | + |
| 75 | + ["<leader>la"] = { |
| 76 | + function() vim.lsp.buf.code_action() end, |
| 77 | + desc = "LSP code action", |
| 78 | + cond = "testDocument/codeAction", -- LSP client capability string |
| 79 | + }, |
| 80 | + }, |
| 81 | + }, |
| 82 | +} |
0 commit comments