rustacean.lua (1942B)
1 ---@diagnostic disable: undefined-global 2 return { 3 "mrcjkb/rustaceanvim", 4 version = "^9", -- or remove to track latest 5 ft = { "rust" }, 6 config = function() 7 vim.g.rustaceanvim = { 8 tools = { 9 float_win_config = { 10 border = "rounded", 11 }, 12 }, 13 server = { 14 on_attach = function(_, bufnr) 15 local map = function(lhs, rhs, desc) 16 vim.keymap.set("n", lhs, rhs, { buffer = bufnr, silent = true, desc = desc }) 17 end 18 19 map("<leader>a", function() 20 vim.cmd.RustLsp("codeAction") 21 end, "Rust code action") 22 23 map("K", function() 24 vim.cmd.RustLsp({ "hover", "actions" }) 25 end, "Rust hover/actions") 26 end, 27 28 settings = { 29 ["rust-analyzer"] = { 30 diagnostics = { enable = true }, 31 cargo = { 32 loadOutDirsFromCheck = true, 33 allFeatures = true, 34 }, 35 inlayHints = { 36 maxLength = 50, 37 renderColons = true, 38 bindingModeHints = { enable = false }, 39 chainingHints = { enable = true }, 40 closingBraceHints = { enable = true, minLines = 50 }, 41 closureCaptureTypeHints = { enable = true }, 42 closureReturnTypeHints = { enable = true }, 43 lifetimeElisionHints = { enable = true, useParameterNames = false }, 44 genericParameterHints = { 45 const = { enable = true }, 46 lifetime = { enable = true }, 47 type = { enable = true }, 48 }, 49 parameterHints = { enable = true }, 50 reborrowHints = { enable = "never" }, 51 typeHints = { 52 enable = true, 53 hideClosureInitialization = false, 54 hideNamedConstructor = false, 55 }, 56 }, 57 }, 58 }, 59 }, 60 } 61 end, 62 }