mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
38fa47fd79
Support multiple targets for checkOnSave (in conjunction with cargo 1.64.0+) This PR adds support for the ability to pass multiple `--target` flags when using `cargo` 1.64.0+. ## Questions I needed to change the type of two configurations options, but I did not plurialize the names to avoid too much churn, should I ? ## Zulip thread https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.2013282.20.28supporting.20multiple.20targets.20with.201.2E64.2B.29 ## Example To see it working, on a macOS machine: ```sh $ cd /tmp $ cargo new cargo-multiple-targets-support-ra-test $ cd !$ $ mkdir .cargo $ echo ' [build] target = [ "aarch64-apple-darwin", "x86_64-apple-darwin", ] ' > .cargo/config.toml $ echo ' fn main() { #[cfg(all(target_arch = "aarch64", target_os = "macos"))] { let a = std::fs::read_to_string("/tmp/test-read"); } #[cfg(all(target_arch = "x86_64", target_os = "macos"))] { let a = std::fs::read_to_string("/tmp/test-read"); } #[cfg(all(target_arch = "x86_64", target_os = "windows"))] { let a = std::fs::read_to_string("/tmp/test-read"); } } ' > src/main.rs # launch your favorite editor with the version of RA from this PR # # You should see warnings under the first two `let a = ...` but not the third ``` ## Screen ![Two panes of a terminal emulator, on the left pane is the main.rs file described above, with warnings for the first two let a = declaration, on the right pane is a display of the .cargo/config.toml, an ls of the current files in the directory and a call to cargo build to show the same warnings as in the editor on the left pane](https://user-images.githubusercontent.com/7951708/192122707-7a00606a-e581-4534-b9d5-b81c92694e8e.png) Helps with #13282 |
||
---|---|---|
.. | ||
src | ||
tests | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.prettierignore | ||
.prettierrc.js | ||
.vscodeignore | ||
icon.png | ||
language-configuration.json | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
ra_syntax_tree.tmGrammar.json | ||
README.md | ||
tsconfig.eslint.json | ||
tsconfig.json |
rust-analyzer
This extension provides support for the Rust programming language.
It is recommended over and replaces rust-lang.rust
.
Features
- code completion with imports insertion
- go to definition, implementation, type definition
- find all references, workspace symbol search, symbol renaming
- types and documentation on hover
- inlay hints for types and parameter names
- semantic syntax highlighting
- a lot of assists (code actions)
- apply suggestions from errors
- ... and many more, check out the manual to see them all
Quick start
- Install rustup.
- Install the rust-analyzer extension.
Configuration
This extension provides configurations through VSCode's configuration settings. All configurations are under rust-analyzer.*
.
See the manual for more information on VSCode specific configurations.
Communication
For usage and troubleshooting requests, please use the "IDEs and Editors" category of the Rust forum.
Documentation
See rust-analyzer.github.io for more information.