vim.o.completeopt = "menuone,noselect,noinsert,popup,fuzzy" vim.diagnostic.config({ underline = true, virtual_text = { current_line = true, severity = { max = vim.diagnostic.severity.WARN, }, }, virtual_lines = { current_line = true, severity = { min = vim.diagnostic.severity.ERROR, }, }, signs = { text = { [vim.diagnostic.severity.ERROR] = "", [vim.diagnostic.severity.WARN] = "", [vim.diagnostic.severity.INFO] = "", [vim.diagnostic.severity.HINT] = "", }, }, }) vim.lsp.config("*", { capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true, }, completion = { completionItem = { snippetSupport = true, commitCharactersSupport = true, deprecatedSupport = true, preselectSupport = true, insertReplaceSupport = true, labelDetailsSupport = true, resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits", }, }, }, }, }, }, on_attach = function(client, bufnr) if client:supports_method('textDocument/completion') then vim.lsp.completion.enable(true, client.id, bufnr, { autotrigger = true }) vim.keymap.set("i", "", vim.lsp.completion.get, { buffer = bufnr }) end if client:supports_method('textDocument/definition') then vim.keymap.set("n", "grd", vim.lsp.buf.definition, { desc = "Jumps to definition", buffer = bufnr }) end if client:supports_method('textDocument/declaration') then vim.keymap.set("n", "grD", vim.lsp.buf.declaration, { desc = "Jumps to declaration", buffer = bufnr }) end if client:supports_method("textDocument/inlayHint") then vim.lsp.inlay_hint.enable(true, { bufnr }) end if client:supports_method("textDocument/formatting") then local description = "LSP: Formats the current buffer" local format_buffer = function() vim.lsp.buf.format({ async = true, buffer = bufnr }) end vim.keymap.set("n", "cf", format_buffer, { desc = description }) vim.keymap.set("v", "", format_buffer, { desc = description }) end end, }) vim.lsp.enable({ "asm", "bash", "clangd", "crystal", "css", "go", "html", "javascript", "json", "lua", "markdown", "odin", "ruby", "vala", "yaml", })