-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to declare which compilation command for targeting android platform in VSCode? #18111
Comments
Searching around and reading the docs I found the "rust-analyzer.cargo.target": "aarch64-linux-android",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"cargo",
"ndk",
"--target=aarch64-linux-android",
"--platform=31",
"check",
"--message-format=json",
"--all-features"
], However, Rust-Analyzer is stuck in: Any idea what could be the issue? Or how to get more verbose outputs? |
Ok, got it working, disabling scanning of some of the folders made it work:
|
If If not, well... you probably need to replicate what |
cargo ndk is emitting JSON correctly. I can the the proc-macros on the output. It still somehow fails to expand them. |
Do you have check on save enabled? Did you change it too to |
Here is all the rust-analyzer the config that I use: "rust-analyzer.cargo.target": "aarch64-linux-android",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"cargo",
"ndk",
"--target=aarch64-linux-android",
"--platform=31",
"check",
"--quiet",
"--workspace",
"--message-format=json",
"--all-features"
],
"rust-analyzer.files.excludeDirs": [
"opacity-ios",
"react-native-opacity",
"opacity-android",
"android",
"scripts",
"generated"
],
"rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"],
"rust-analyzer.files.watcher": "server",
"rust-analyzer.cargo.features": "all", The |
Take a look at #12335 which is I think about the same thing (I haven't read through it yet), maybe there is some info in there as well |
Just went through it and yeah, it basically does the same thing. I'm using |
Are the logs still saying that build scripts are not building correctly? (that would explain the proc-macros not resolving). Also it might be good to set "rust-analyzer.server.extraEnv": {
"RA_LOG": "warn,project_model=info",
}, That should make your logs contain lines like
when the build script step is successful, that might help figure out why you are lacking proc-macros. Either I imagine the ndk command might not be reporting the host build dependencies properly |
Hi! I have a project that targets many platforms. Among them iOS and Android. Among my dependencies I have C++ projects like Ring. When I change the target on my VSCode settings like this:
Everything works and I get inline type hints. However for Android, when I do:
Rust analyzer fails to start (understandably) because it needs android's Clang to compile my projects dependencies:
In order to compile my project I don't use a pure
cargo build
command, but I use the cargo-ndk package which handles a lot of the compiler discovery for me quite nicely.Is there any way I can tell Rust-Analyzer which command it should use to compile my project when targeting Android?
The text was updated successfully, but these errors were encountered: