@@ -38,8 +38,9 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
38
38
],
39
39
"rust-analyzer.procMacro.enable" : true ,
40
40
"rust-analyzer.cargo.buildScripts.enable" : true ,
41
+ "rust-analyzer.cargo.buildScripts.useRustcWrapper" : true ,
41
42
"rust-analyzer.cargo.buildScripts.overrideCommand" : [
42
- " cargo" ,
43
+ " ./build/$TARGET_TRIPLE/stage0/bin/ cargo" ,
43
44
" check" ,
44
45
" -p" ,
45
46
" rustc_driver" ,
@@ -56,10 +57,10 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
56
57
in your ` .vscode/settings.json ` file. This will ask ` rust-analyzer ` to use
57
58
` ./x.py check ` to check the sources, and the stage 0 rustfmt to format them.
58
59
59
- > NOTE: Make sure to replace ` TARGET_TRIPLE ` in the ` rust-analyzer.rustfmt.overrideCommand `
60
- > setting with the appropriate target triple for your machine. An example of such
61
- > a triple is ` x86_64-unknown-linux-gnu ` . An easy way to check your target triple
62
- > is to run ` rustc -vV ` and checking the ` host ` value of its output.
60
+ > NOTE: Make sure to replace ` TARGET_TRIPLE ` with the appropriate target triple
61
+ > for your machine. An example of such a triple is ` x86_64-unknown-linux-gnu ` .
62
+ > An easy way to check your target triple is to run ` rustc -vV ` and checking the
63
+ > ` host ` value of its output.
63
64
64
65
If you have enough free disk space and you would like to be able to run ` x.py ` commands while
65
66
rust-analyzer runs in the background, you can also add ` --build-dir build-rust-analyzer ` to the
@@ -70,6 +71,17 @@ If you're running `coc.nvim`, you can use `:CocLocalConfig` to create a
70
71
` editor.formatOnSave: true, ` with
71
72
` "coc.preferences.formatOnSaveFiletypes": ["rust"], ` .
72
73
74
+ > NOTE: The configuration once suggested disabling build scripts, but after
75
+ > the version ` 2022-04-14 ` this was fixed by introducing an option for customizing
76
+ > the command rust-analyzer uses to run build scripts. Please ensure that ` rust-analyzer `
77
+ > is up to date before enabling these options. If you do not wish to enable
78
+ > ` rust-analyzer.cargo.useRustcWrapperForBuildScripts ` , the
79
+ > ` rust-analyzer.cargo.buildScripts.overrideCommand ` option should be set as same as
80
+ > ` rust-analyzer.checkOnSave.overrideCommand ` instead of the suggested value.
81
+ >
82
+ > If you are not developing for the compiler, you do not need to configure the build scripts
83
+ > like in the configuration and you can disable proc macros and build scripts.
84
+
73
85
If running ` ./x.py check ` on save is inconvenient, in VS Code you can use a [ Build
74
86
Task] instead:
75
87
0 commit comments