From ce5ddb9b89efa9cb9c00b56c991db35687b16169 Mon Sep 17 00:00:00 2001 From: doryan Date: Mon, 23 Dec 2024 01:01:10 +0400 Subject: [PATCH] feat(rust): add hints and navic for rustaceanvim --- lua/config/plugins/rustaceanvim.lua | 35 ++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/lua/config/plugins/rustaceanvim.lua b/lua/config/plugins/rustaceanvim.lua index 369f407..39a07a4 100644 --- a/lua/config/plugins/rustaceanvim.lua +++ b/lua/config/plugins/rustaceanvim.lua @@ -1,18 +1,37 @@ local navic = require("nvim-navic") vim.g.rustaceanvim = { + tools = { + autoSetHints = true, + inlay_hints = { + show_parameter_hints = true, + parameter_hints_prefix = "in: ", -- "<- " + other_hints_prefix = "out: " -- "=> " + } + }, server = { on_attach = function(client, bufnr) - navic.attach(client, bufnr) + navic.attach(client, bufnr) end, - filetypes = {"rust"}, settings = { - -- rust-analyzer language server configuration ['rust-analyzer'] = { - cargo = { - allFeatures = true, + assist = { + importEnforceGranularity = true, + importPrefix = "create" }, - }, - }, - }, + cargo = { allFeatures = true }, + checkOnSave = { + -- default: `cargo check` + command = "clippy", + allFeatures = true + }, + inlayHints = { + lifetimeElisionHints = { + enable = true, + useParameterNames = true + } + } + } + } + } }