diff --git a/common/.config/nvim/after/ftplugin/rust.lua b/common/.config/nvim/after/ftplugin/rust.lua index b250ec4..c772946 100644 --- a/common/.config/nvim/after/ftplugin/rust.lua +++ b/common/.config/nvim/after/ftplugin/rust.lua @@ -7,8 +7,26 @@ if pcall(require, "rustaceanvim") then vim.keymap.set("n", "rh", "RustLsp openDocs", { desc = "Open docs.rs Documentation" }) vim.keymap.set("n", "rM", "RustLsp view mir", { desc = "View Mid-Level IR", buffer = bufnr }) vim.keymap.set("n", "rH", "RustLsp view hir", { desc = "View High-Level IR", buffer = bufnr }) + vim.keymap.set("n", "rL", vim.lsp.codelens.refresh, { desc = "Run CodeLens" }) end +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(event) + local client = vim.lsp.get_client_by_id(event.data.client_id) + if not client or client.name ~= "rust-analyzer" then + return + end + + pcall(vim.lsp.codelens.refresh) + + -- Setup ongoing refresh triggers + vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost", "BufEnter" }, { + buffer = event.buf, + callback = vim.lsp.codelens.refresh, + }) + end, +}) + local function run_tests_with_coverage() -- Run tests through neotest require("neotest").run.run(vim.fn.expand("%")) diff --git a/common/.config/nvim/lua/plugins/code-generic.lua b/common/.config/nvim/lua/plugins/code-generic.lua index 79e89b9..92e9ba6 100644 --- a/common/.config/nvim/lua/plugins/code-generic.lua +++ b/common/.config/nvim/lua/plugins/code-generic.lua @@ -156,12 +156,16 @@ return { ui = { -- kind = require("config.util").icons.kind_lspsaga, kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(), + devicon = true, + title = true, }, - implement = { enabled = true }, - symbol_in_winbar = { + implement = { enable = true, - hide_keyword = true, + virtual_text = true, + sign = true, + priority = 100, }, + symbol_in_winbar = { enable = true, hide_keyword = true }, lightbulb = { virtual_text = false }, outline = { auto_preview = false }, }) diff --git a/common/.config/nvim/lua/plugins/code-lsp.lua b/common/.config/nvim/lua/plugins/code-lsp.lua index feb435f..e81974b 100644 --- a/common/.config/nvim/lua/plugins/code-lsp.lua +++ b/common/.config/nvim/lua/plugins/code-lsp.lua @@ -94,33 +94,38 @@ return { postfix = { enable = true }, autoimport = { enable = true }, }, - }, - inlayHints = { - bindingModeHints = { enable = false }, - chainingHints = { enable = true }, - closingBraceHints = { enable = true, minLines = 25 }, - closureReturnTypeHints = { enable = "never" }, - lifetimeElisionHints = { enable = "never", useParameterNames = false }, - maxLength = 25, - parameterHints = { enable = true }, - reborrowHints = { enable = "never" }, - renderColons = true, - typeHints = { + lens = { enable = true, - hideClosureInitialization = false, - hideNamedConstructor = false, + implementations = { enable = true }, + run = { enable = false }, }, - }, - procMacro = { - enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, + inlayHints = { + bindingModeHints = { enable = false }, + chainingHints = { enable = true }, + closingBraceHints = { enable = true, minLines = 25 }, + closureReturnTypeHints = { enable = "never" }, + lifetimeElisionHints = { enable = "never", useParameterNames = false }, + maxLength = 25, + parameterHints = { enable = true }, + reborrowHints = { enable = "never" }, + renderColons = true, + typeHints = { + enable = true, + hideClosureInitialization = false, + hideNamedConstructor = false, + }, + }, + procMacro = { + enable = true, + ignored = { + ["async-trait"] = { "async_trait" }, + ["napi-derive"] = { "napi" }, + ["async-recursion"] = { "async_recursion" }, + }, + }, + files = { + excludeDirs = { ".direnv", ".git", ".github", ".gitlab", "bin", "node_modules", "target", "venv", ".venv" }, }, - }, - files = { - excludeDirs = { ".direnv", ".git", ".github", ".gitlab", "bin", "node_modules", "target", "venv", ".venv" }, }, }, },