@@ -32,14 +32,22 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
32
32
" check" ,
33
33
" --json-output"
34
34
],
35
+ "rust-analyzer.cargo.runBuildScriptsCommand" : [
36
+ " ./build/$TARGET_TRIPLE/stage0/bin/cargo" ,
37
+ " check" ,
38
+ " -p" ,
39
+ " rustc_driver" ,
40
+ " --message-format=json"
41
+ ],
35
42
"rust-analyzer.rustfmt.overrideCommand" : [
36
43
" ./build/$TARGET_TRIPLE/stage0/bin/rustfmt" ,
37
44
" --edition=2021"
38
45
],
39
46
"editor.formatOnSave" : true ,
40
- "rust-analyzer.cargo.runBuildScripts" : false ,
47
+ "rust-analyzer.cargo.runBuildScripts" : true ,
41
48
"rust-analyzer.rustcSource" : " ./Cargo.toml" ,
42
- "rust-analyzer.procMacro.enable" : false
49
+ "rust-analyzer.procMacro.enable" : true ,
50
+ "rust-analyzer.cargo.useRustcWrapperForBuildScripts" : true
43
51
}
44
52
```
45
53
@@ -56,6 +64,14 @@ If you're running `coc.nvim`, you can use `:CocLocalConfig` to create a
56
64
` editor.formatOnSave: true, ` with
57
65
` "coc.preferences.formatOnSaveFiletypes": ["rust"], ` .
58
66
67
+ > NOTE: The configuration once suggested disabling build scripts, but after
68
+ > the version ` 2022-04-14 ` this was fixed by introducing an option for customizing
69
+ > the command rust-analyzer uses to run build scripts. Please ensure that ` rust-analyzer `
70
+ > is up to date before enabling these options. If you do not wish to enable
71
+ > ` rust-analyzer.cargo.useRustcWrapperForBuildScripts ` , the
72
+ > ` rust-analyzer.cargo.runBuildScriptsCommand ` option should be set as same as
73
+ > ` rust-analyzer.checkOnSave.overrideCommand ` instead of the suggested value.
74
+
59
75
If running ` ./x.py check ` on save is inconvenient, in VS Code you can use a [ Build
60
76
Task] instead:
61
77
0 commit comments