Skip to content

Commit 8496aca

Browse files
committed
feat(rust): bump rustaceanvim to v8+
1 parent 36463ca commit 8496aca

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lua/astrocommunity/pack/rust/init.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ return {
7979
},
8080
{
8181
"mrcjkb/rustaceanvim",
82-
version = "^6",
82+
version = vim.fn.has "nvim-0.12" == 1 and "^9" or "^8",
8383
ft = "rust",
8484
specs = {
8585
{
@@ -124,12 +124,22 @@ return {
124124
local astrolsp_settings = astrolsp_opts.settings or {}
125125

126126
local merge_table = require("astrocore").extend_tbl(default_settings or {}, astrolsp_settings)
127+
128+
-- Merge the settings from `rustaceanvim` first.
127129
local ra = require "rustaceanvim.config.server"
128-
-- load_rust_analyzer_settings merges any found settings with the passed in default settings table and then returns that table
129-
return ra.load_rust_analyzer_settings(project_root, {
130+
local settings = ra.load_rust_analyzer_settings(project_root, {
130131
settings_file_pattern = "rust-analyzer.json",
131132
default_settings = merge_table,
132133
})
134+
135+
-- Merge the settings again from `codesettings` if available. This is
136+
-- the recommended way of sharing project-local settings with VSCode
137+
-- in newer versions of `rustaceanvim`.
138+
local codesettings_avail, codesettings = pcall(require, "codesettings")
139+
if codesettings_avail then
140+
settings = codesettings.with_local_settings("rust-analyzer", { settings = settings }).settings
141+
end
142+
return settings
133143
end,
134144
}
135145
local final_server = require("astrocore").extend_tbl(astrolsp_opts, server)

0 commit comments

Comments
 (0)