fix: various :RustAnalyzer target
regressions
#591
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses three issues that would prevent a user from successfully running
:RustAnalyzer target
. It is pretty much a follow up to #589 and #548.Each commit fixes one issue, and I will explain them in order:
1.
bufnr
argument missing when callingset_target_arch
:RustAnalyzer target
would callset_target_arch
by passing the target triple as thebufnr
argument. Seems to be a regression introduced in #548 AFAICT.2. Access non-existant key in
rust-analyzer
config / mapInside
set_target_arch
, we would try to update a nested map (rust-analyzer
) without first checking if each subkey was present. Specifically,client.settings['rust-analyzer'].cargo
wasnil
, leading to the following statement failing catastrophically:client.settings['rust-analyzer'].cargo.target = target
.Curiously, it seems like
rust-analyzer
is present inclient.config.settings
and notclient.settings
, so I updated that. Works on my machine ¯\(ツ)/¯.3.
vim.notify
was called at an inappropriate timeWhen
set_target_arch
is done updating therust-analyzer
config it will print a status update to the echo area usingvim.notify
. Apparently neovim didn't like this, and I got the following stacktrace after (successfully) calling:RustAnalyzer target aarch64-linux-android
:Scheduling the status update with vim.schedule seems do have done the trick.
Final remarks
Sorry for not creating separate issues for all of the included fixes, but I patched the code as I went along and stumbled upon one error after the next. I love this package, and I hope that my work here will be useful to others. Cheers!