You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm finding that rust-analyzer doesn't run in and provide diagnostics/completes/etc for non-default integration test targets (see code snippet below for what exactly I mean by that). I would expect it do do so when the allTargets setting in the title is enabled, but even beyond that, I can't seem to find any way to instruct it to explicitly inspect such targets (which would be a good option to have too). I have these targets use test = false because I don't want them to run with my normal unit tests as part of cargo test. Instead, I have a small wrapper binary that I call via an alias that passes the right --features and --test flags to cargo test in order to explicitly run it (it also spawns a server process my integration tests depend on).
So:
Should allTargets include these? If so, currently that seems to be bugged, if no, why not?
Is there some existing setting to tell rust-analyzer to include this target? If not, can one be added?
I can confirm that if I remove test = false from the [[test]] section in my Cargo.toml for this test that rust-analyzer starts working as expected.
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
Zed
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
the all targets option just means passing --all-targets to cargo, so this is standard cargo behavior that you are observing here. Your setup sounds non-standard so you might wanna make use of rust-analyzer.check.overrideCommand.
@Veykril Thanks! That does get me a way to make it work, by passing --test some_integ_test as additional arguments to the override command.
I think it's probably not ideal still, though. I'm forced to add one of those for any test I have which is non-default like this (which is yes "non-standard" in some sense, but I don't think tremendously uncommon for integration tests), and from a UX perspective I'd imagine the analyzer ought to default to working pretty much everywhere, with options to stop it if needed, rather than the inverse.
I'm finding that
rust-analyzer
doesn't run in and provide diagnostics/completes/etc for non-default integration test targets (see code snippet below for what exactly I mean by that). I would expect it do do so when theallTargets
setting in the title is enabled, but even beyond that, I can't seem to find any way to instruct it to explicitly inspect such targets (which would be a good option to have too). I have these targets usetest = false
because I don't want them to run with my normal unit tests as part ofcargo test
. Instead, I have a small wrapper binary that I call via an alias that passes the right--features
and--test
flags tocargo test
in order to explicitly run it (it also spawns a server process my integration tests depend on).So:
allTargets
include these? If so, currently that seems to be bugged, if no, why not?rust-analyzer
to include this target? If not, can one be added?I can confirm that if I remove
test = false
from the[[test]]
section in myCargo.toml
for this test thatrust-analyzer
starts working as expected.rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer 1.85.0 (4d91de4 2025-02-17)
rustc version: (eg. output of
rustc -V
)rustc 1.85.0 (4d91de4e4 2025-02-17)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
Zed
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): (eg. rust-analyzer)
https://github.com/temporalio/sdk-core -- specifically here
code snippet to reproduce:
The text was updated successfully, but these errors were encountered: