rust-tools: codelenses

This commit is contained in:
krolyxon 2023-04-04 12:43:08 +05:30
parent cb88a78114
commit 12af7eea21
1 changed files with 23 additions and 0 deletions

View File

@ -9,6 +9,9 @@ capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
local options = { local options = {
tools = { 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 = { inlay_hints = {
auto = true, auto = true,
only_current_line = false, only_current_line = false,
@ -16,9 +19,25 @@ local options = {
}, },
hover_actions = { hover_actions = {
auto_focus = true, auto_focus = true,
border = "rounded",
}, },
on_initialized = function() on_initialized = function()
-- ih.set_all() -- 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, end,
}, },
server = { server = {
@ -30,6 +49,10 @@ local options = {
["rust-analyzer"] = { ["rust-analyzer"] = {
checkOnSave = { checkOnSave = {
-- command = "check", -- command = "check",
lens = {
enable = true,
},
command = "clippy", command = "clippy",
} }
} }