Skip to content

Commit

Permalink
fix: various :RustAnalyzer target regressions (#591)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
  • Loading branch information
MarkusPettersson98 and mrcjkb authored Nov 25, 2024
1 parent 761a2b6 commit 4f62c30
Showing 1 changed file with 10 additions and 4 deletions.
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

0 comments on commit 4f62c30

Please sign in to comment.