Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lua/astrocommunity/pack/rust/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ return {
},
{
"mrcjkb/rustaceanvim",
version = "^6",
version = vim.fn.has "nvim-0.12" == 1 and "^9" or "^8",
ft = "rust",
specs = {
{
Expand Down Expand Up @@ -124,12 +124,22 @@ return {
local astrolsp_settings = astrolsp_opts.settings or {}

local merge_table = require("astrocore").extend_tbl(default_settings or {}, astrolsp_settings)

-- Merge the settings from `rustaceanvim` first.
local ra = require "rustaceanvim.config.server"
-- load_rust_analyzer_settings merges any found settings with the passed in default settings table and then returns that table
return ra.load_rust_analyzer_settings(project_root, {
local settings = ra.load_rust_analyzer_settings(project_root, {
settings_file_pattern = "rust-analyzer.json",
default_settings = merge_table,
})

-- Merge the settings again from `codesettings` if available. This is
-- the recommended way of sharing project-local settings with VSCode
-- in newer versions of `rustaceanvim`.
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,
}
local final_server = require("astrocore").extend_tbl(astrolsp_opts, server)
Expand Down
Loading