diff --git a/.luarc.json b/.luarc.json index 8780040..4eec0b9 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,6 +1,9 @@ { "diagnostics.globals": [ "Snacks" + ], + "diagnostics.disable": [ + "duplicate-set-field" ] } diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index 9bc55db..60d2fe9 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -10,30 +10,6 @@ local M = { }, } -local servers = { - "gopls", - "jsonls", - "lua_ls", - "yamlls", - "graphql", - "html", - "omnisharp", - "svelte", - "vtsls", - "ccls", - "templ", -} - -local tools = { - "prettierd", - "shfmt", - "stylua", - "latexindent", - "clang-format", - "csharpier", - "quick-lint-js", -} - local function setup_keymaps(bufnr) local fzf = require("fzf-lua") local opts = { buffer = bufnr } @@ -59,7 +35,20 @@ local function setup_keymaps(bufnr) nmap("ws", fzf.lsp_workspace_symbols, vim.tbl_extend("force", opts, { desc = "Workspace Symbols" })) -- LSP management - nmap("lr", ":LspRestart", vim.tbl_extend("force", opts, { desc = "Restart LSP" })) + nmap("lr", function() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + if #clients == 0 then + vim.notify("No LSP clients attached to buffer", vim.log.levels.WARN) + return + end + + local client_names = {} + for _, client in ipairs(clients) do + table.insert(client_names, client.name) + vim.cmd("LspRestart " .. client.name) + end + vim.notify("Restarted LSP clients: " .. table.concat(client_names, ", "), vim.log.levels.INFO) + end, vim.tbl_extend("force", opts, { desc = "Restart LSP" })) nmap("li", ":LspInfo", vim.tbl_extend("force", opts, { desc = "LSP Info" })) end @@ -67,6 +56,15 @@ function M.config() require("mason").setup({ max_concurrent_installers = 4 }) require("fidget").setup({}) + 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 + -- Diagnostics vim.diagnostic.config({ virtual_text = { spacing = 2, source = "if_many" }, @@ -82,10 +80,36 @@ function M.config() } or {}, }) - -- Mason setup - local mason_servers = vim.tbl_filter(function(s) - return s ~= "ccls" + local servers = { + "gopls", + "jsonls", + "lua_ls", + "yamlls", + "graphql", + "html", + "omnisharp", + "svelte", + "vtsls", + "ccls", + "templ", + } + + local tools = { + "prettierd", + "shfmt", + "stylua", + "latexindent", + "clang-format", + "csharpier", + "quick-lint-js", + } + + local mason_unsupported = { "ccls" } + + local mason_servers = vim.tbl_filter(function(server) + return not vim.tbl_contains(mason_unsupported, server) end, servers) + require("mason-lspconfig").setup({ ensure_installed = mason_servers, automatic_installation = true, diff --git a/lua/plugins/qol.lua b/lua/plugins/qol.lua index 46c044b..975d5dc 100644 --- a/lua/plugins/qol.lua +++ b/lua/plugins/qol.lua @@ -36,6 +36,10 @@ return { border = "rounded", }, }, + select = { + enabled = true, + win = { border = "rounded" }, + }, debug = { enabled = true }, image = { enabled = true }, indent = { enabled = true, animate = { enabled = false } },