Replies: 1 comment
-
Hey 👋 I can't reproduce this with the steps you've provided.
Note: If the target you are trying to set isn't supported by your toolchain, rustaceanvim will give you a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
:h rustaceanvim
.Description
Hi, thanks for the amazing plugin! I was drawn in in-particular as I noticed that this plugin allows you to dynamically change the Rust Analyzer target platform at runtime. I'm currently working on a project which has a lot of platform-specific compilation, so this feature seems perfect for me.
However, I've been having some trouble trying to get this to work. In particular, in a file where I have functions annotated with
#[cfg(target_os = "windows")]
and#[cfg(target_os = "macos")]
, if, when on my macOS system, I try and runRustAnalyzer target aarch64-pc-windows-msvc
, Rust Analyzer will reload (since I use Fidget on my personal config to provide LSP notifications, I can see this), but unfortuantely, the highlighted/disabled regions do not change for my functions – in fact, they remain fully highlighted, almost as if semantic highlighting temporarily stops working. If I then close and reopen the same file, the highlighted regions remain the same as if the Cargotarget
was stillmacos
.I also noticed that when running
checkhealth vim.lsp
, that when inspecting the settings that Vim seesrust-analyzer
as having, it does not appear that the target changes on here:which seems to maybe indicate why the highlighting for enabled/disabled
cfg
regions remains the same (though I don't know if the settingscheckhealth vim.lsp
recognises should be 100% accurate forrustaceanvim
).I can also reproduce the same behaviour when using a minimal config (as described below). Since the minimal config does not use Tree Sitter, the way I check whether it is correctly detecting disabled regions is by using the LSP hover functionality (shift-K) to see if hover docs appear for
#[cfg(target_os = "windows")]
vs.#[cfg(target_os = "macos")]
regions of code, and by usingcheckhealth vim.lsp
(which outputs the above).I wanted to check with a discussion first – is there maybe something that I'm doing wrong or potentially misusing about the
RustAnalyzer target
command that might cause it to not work as I expect? Perhaps I could be misunderstanding what the command is supposed to be doing when I run it?Please do let me know, any help would be much appreciated! :)
Example Code
Neovim version (nvim -v)
v0.11.1
Operating system/version
macOS 15.5 (24F74)
Output of :checkhealth rustaceanvim
Beta Was this translation helpful? Give feedback.
All reactions