From 12af7eea217282e53371ad2f27fcbc327aea2439 Mon Sep 17 00:00:00 2001 From: krolyxon Date: Tue, 4 Apr 2023 12:43:08 +0530 Subject: [PATCH] rust-tools: codelenses --- lua/plugins/configs/rust-tools.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lua/plugins/configs/rust-tools.lua b/lua/plugins/configs/rust-tools.lua index 97d568a..8c1ec4f 100644 --- a/lua/plugins/configs/rust-tools.lua +++ b/lua/plugins/configs/rust-tools.lua @@ -9,6 +9,9 @@ capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) local options = { tools = { + executor = require("rust-tools/executors").termopen, + -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. + reload_workspace_from_cargo_toml = true, inlay_hints = { auto = true, only_current_line = false, @@ -16,9 +19,25 @@ local options = { }, hover_actions = { auto_focus = true, + border = "rounded", }, on_initialized = function() -- ih.set_all() + vim.api.nvim_create_autocmd({ + "BufEnter", + "BufReadPre", + "BufReadPost", + "BufWritePost", + "CursorHold", + "InsertLeave", + "InsertEnter", + "BufAdd", + }, { + pattern = { "*.rs" }, + callback = function() + local _, _ = pcall(vim.lsp.codelens.refresh) + end, + }) end, }, server = { @@ -30,6 +49,10 @@ local options = { ["rust-analyzer"] = { checkOnSave = { -- command = "check", + lens = { + enable = true, + }, + command = "clippy", } }