@@ -39,30 +39,42 @@ you can write: <!-- date: 2022-04 --><!-- the date comment is for the edition be
39
39
"editor.formatOnSave" : true ,
40
40
"rust-analyzer.cargo.buildScripts.enable" : true ,
41
41
"rust-analyzer.cargo.buildScripts.overrideCommand" : [
42
- " cargo" ,
42
+ " ./build/$TARGET_TRIPLE/stage0/bin/ cargo" ,
43
43
" check" ,
44
44
" -p" ,
45
45
" rustc_driver" ,
46
46
" --message-format=json"
47
47
],
48
48
"rust-analyzer.rustc.source" : " ./Cargo.toml" ,
49
49
"rust-analyzer.procMacro.enable" : true ,
50
+ "rust-analyzer.cargo.useRustcWrapperForBuildScripts" : true
50
51
}
51
52
```
52
53
53
54
in your ` .vscode/settings.json ` file. This will ask ` rust-analyzer ` to use
54
55
` ./x.py check ` to check the sources, and the stage 0 rustfmt to format them.
55
56
56
- > NOTE: Make sure to replace ` TARGET_TRIPLE ` in the ` rust-analyzer.rustfmt.overrideCommand `
57
- > setting with the appropriate target triple for your machine. An example of such
58
- > a triple is ` x86_64-unknown-linux-gnu ` . An easy way to check your target triple
59
- > is to run ` rustc -vV ` and checking the ` host ` value of its output.
57
+ > NOTE: Make sure to replace ` TARGET_TRIPLE ` with the appropriate target triple
58
+ > for your machine. An example of such a triple is ` x86_64-unknown-linux-gnu ` .
59
+ > An easy way to check your target triple is to run ` rustc -vV ` and checking the
60
+ > ` host ` value of its output.
60
61
61
62
If you're running ` coc.nvim ` , you can use ` :CocLocalConfig ` to create a
62
63
` .vim/coc-settings.json ` and enter the same settings as above, but replacing
63
64
` editor.formatOnSave: true, ` with
64
65
` "coc.preferences.formatOnSaveFiletypes": ["rust"], ` .
65
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.buildScripts.overrideCommand ` option should be set as same as
73
+ > ` rust-analyzer.checkOnSave.overrideCommand ` instead of the suggested value.
74
+ >
75
+ > If you are not developing for the compiler, you do not need to configure the build scripts
76
+ > like in the configuration and you can disable proc macros and build scripts.
77
+
66
78
If running ` ./x.py check ` on save is inconvenient, in VS Code you can use a [ Build
67
79
Task] instead:
68
80
0 commit comments