diff options
| author | bors <bors@rust-lang.org> | 2022-11-19 13:09:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-19 13:09:37 +0000 |
| commit | 38fa47fd79b38d3ca7665943a93c577d3a9166a8 (patch) | |
| tree | 8a8ce8e1c419dc1b1463a41955111ce81ce2c579 /editors/code/package.json | |
| parent | 2d9ed4fd483e0caddab03dc78f805a37232463df (diff) | |
| parent | 0d4737adb68704a9db802614f6ac9ba933d81f65 (diff) | |
| download | rust-38fa47fd79b38d3ca7665943a93c577d3a9166a8.tar.gz rust-38fa47fd79b38d3ca7665943a93c577d3a9166a8.zip | |
Auto merge of #13290 - poliorcetics:multiple-targets, r=Veykril
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

Helps with #13282
Diffstat (limited to 'editors/code/package.json')
| -rw-r--r-- | editors/code/package.json | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index b1c3473b825..c4d4e428ea0 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -639,11 +639,18 @@ } }, "rust-analyzer.checkOnSave.target": { - "markdownDescription": "Check for a specific target. Defaults to\n`#rust-analyzer.cargo.target#`.", - "default": null, - "type": [ - "null", - "string" + "markdownDescription": "Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.\n\nCan be a single target, e.g. `\"x86_64-unknown-linux-gnu\"` or a list of targets, e.g.\n`[\"aarch64-apple-darwin\", \"x86_64-apple-darwin\"]`.\n\nAliased as `\"checkOnSave.targets\"`.", + "default": [], + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } ] }, "rust-analyzer.completion.autoimport.enable": { |
