@@ -311,12 +311,18 @@ M.set_target_arch = function(bufnr, target)
311311 restart (bufnr , { exclude_rustc_target = target }, function (client )
312312 rustc .with_rustc_target_architectures (function (rustc_targets )
313313 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
315317 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 )
317321 return
318322 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 )
320326 return
321327 end
322328 end )
@@ -353,7 +359,7 @@ local function rust_analyzer_cmd(opts)
353359 M .reload_settings ()
354360 elseif cmd == RustAnalyzerCmd .target then
355361 local target_arch = fargs [2 ]
356- M .set_target_arch (target_arch )
362+ M .set_target_arch (nil , target_arch )
357363 end
358364end
359365
0 commit comments