-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrust.lua
More file actions
84 lines (80 loc) · 2.76 KB
/
rust.lua
File metadata and controls
84 lines (80 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---@type LazySpec
return {
{
"mrcjkb/rustaceanvim",
version = vim.fn.has("nvim-0.12") == 1 and "^9" or "^8",
dependencies = { "mrjones2014/codesettings.nvim" },
opts = function(_, opts)
---@type table | (fun(project_root:string|nil, default_settings: table|nil):table)
opts.server.settings = function(project_root, default_settings)
local astrolsp_opts = vim.lsp.config["rust_analyzer"] or {}
local astrolsp_settings = astrolsp_opts.settings or {}
local merge_table =
require("astrocore").extend_tbl(default_settings or {}, astrolsp_settings)
-- Merge the final settings from `rustaceanvim`, and then `codesettings` if available.
local settings =
require("rustaceanvim.config.server").load_rust_analyzer_settings(project_root, {
settings_file_pattern = "rust-analyzer.json",
default_settings = merge_table,
})
local codesettings_avail, codesettings = pcall(require, "codesettings")
if codesettings_avail then
settings =
codesettings.with_local_settings("rust-analyzer", { settings = settings }).settings
end
return settings
end
end,
},
{
"Olical/conjure",
dependencies = {
{
"AstroNvim/astrocore",
opts = { options = { g = { ["conjure#filetype#rust"] = false } } },
},
},
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
opts = function(_, opts)
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "rust-analyzer" })
end,
},
{
"AstroNvim/astrolsp",
---@type AstroLSPOpts
---@diagnostic disable: missing-fields
opts = {
config = {
rust_analyzer = {
settings = {
-- https://rust-analyzer.github.io/book/configuration.html
["rust-analyzer"] = {
check = { command = "clippy" },
completion = {
postfix = { enable = true },
},
imports = {
granularity = { enforce = true },
prefix = "self",
},
inlayHints = {
closureReturnTypeHints = { enable = "with_block" },
expressionAdjustmentHints = { enable = "reborrow", hideOutsideUnsafe = true },
lifetimeElisionHints = { enable = "skip_trivial", useParameterNames = true },
typeHints = { hideClosureInitialization = true },
},
procMacro = { enable = true },
rustfmt = { extraArgs = { "+nightly" } },
workspace = {
symbol = { search = { kind = "all_symbols", limit = 512 } },
},
},
},
},
},
},
},
}