@@ -311,12 +311,18 @@ M.set_target_arch = function(bufnr, target)
311
311
restart (bufnr , { exclude_rustc_target = target }, function (client )
312
312
rustc .with_rustc_target_architectures (function (rustc_targets )
313
313
if rustc_targets [target ] then
314
- client .settings [' rust-analyzer' ].cargo .target = target
314
+ local ra = client .config .settings [' rust-analyzer' ]
315
+ ra .cargo = ra .cargo or {}
316
+ ra .cargo .target = target
315
317
client .notify (' workspace/didChangeConfiguration' , { settings = client .config .settings })
316
- vim .notify (' Target architecture updated successfully to: ' .. target , vim .log .levels .INFO )
318
+ vim .schedule (function ()
319
+ vim .notify (' Target architecture updated successfully to: ' .. target , vim .log .levels .INFO )
320
+ end )
317
321
return
318
322
else
319
- vim .notify (' Invalid target architecture provided: ' .. tostring (target ), vim .log .levels .ERROR )
323
+ vim .schedule (function ()
324
+ vim .notify (' Invalid target architecture provided: ' .. tostring (target ), vim .log .levels .ERROR )
325
+ end )
320
326
return
321
327
end
322
328
end )
@@ -353,7 +359,7 @@ local function rust_analyzer_cmd(opts)
353
359
M .reload_settings ()
354
360
elseif cmd == RustAnalyzerCmd .target then
355
361
local target_arch = fargs [2 ]
356
- M .set_target_arch (target_arch )
362
+ M .set_target_arch (nil , target_arch )
357
363
end
358
364
end
359
365
0 commit comments