Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various :RustAnalyzer target regressions #591

Merged
merged 4 commits into from
Nov 25, 2024
Merged
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
14 changes: 10 additions & 4 deletions lua/rustaceanvim/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,18 @@ M.set_target_arch = function(bufnr, target)
restart(bufnr, { exclude_rustc_target = target }, function(client)
rustc.with_rustc_target_architectures(function(rustc_targets)
if rustc_targets[target] then
client.settings['rust-analyzer'].cargo.target = target
local ra = client.config.settings['rust-analyzer']
ra.cargo = ra.cargo or {}
ra.cargo.target = target
client.notify('workspace/didChangeConfiguration', { settings = client.config.settings })
vim.notify('Target architecture updated successfully to: ' .. target, vim.log.levels.INFO)
vim.schedule(function()
vim.notify('Target architecture updated successfully to: ' .. target, vim.log.levels.INFO)
end)
return
else
vim.notify('Invalid target architecture provided: ' .. tostring(target), vim.log.levels.ERROR)
vim.schedule(function()
vim.notify('Invalid target architecture provided: ' .. tostring(target), vim.log.levels.ERROR)
end)
return
end
end)
Expand Down Expand Up @@ -353,7 +359,7 @@ local function rust_analyzer_cmd(opts)
M.reload_settings()
elseif cmd == RustAnalyzerCmd.target then
local target_arch = fargs[2]
M.set_target_arch(target_arch)
M.set_target_arch(nil, target_arch)
end
end

Expand Down