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 = {
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",
}
}