| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- vim.lsp.enable({
- "gopls",
- "jsonls",
- "clangd",
- "lua_ls",
- "yamlls",
- "graphql",
- "html",
- "cssls",
- "omnisharp",
- "svelte",
- "templ",
- "tinymist",
- "jdtls",
- "nixd",
- "qmlls",
- "zls",
- "tsgo",
- })
- vim.api.nvim_create_autocmd("LspAttach", {
- group = vim.api.nvim_create_augroup("lsp", { clear = true }),
- callback = function(ev)
- local opts = { buffer = ev.buf, silent = true }
- nmap("K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover Doc" }))
- nmap("<C-h>", vim.lsp.buf.signature_help, vim.tbl_extend("force", opts, { desc = "Signature Help" }))
- nmap("<leader>r", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename" }))
- nmap("<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" }))
- nmap("vd", vim.diagnostic.open_float, vim.tbl_extend("force", opts, { desc = "View Diagnostics" }))
- nmap("<leader>lr", "<cmd>LspRestart<CR>", vim.tbl_extend("force", opts, { desc = "Restart LSP" }))
- end,
- })
- -- Enhance floating preview windows
- local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
- function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
- opts = opts or {}
- opts.border = opts.border or "rounded"
- opts.max_width = opts.max_width or 80
- opts.max_height = opts.max_height or 20
- return orig_util_open_floating_preview(contents, syntax, opts, ...)
- end
|