@@ -22,48 +22,17 @@ You can also install the hook as a step of running `./x.py setup`!
22
22
` rust-analyzer ` can help you check and format your code whenever you save
23
23
a file. By default, ` rust-analyzer ` runs the ` cargo check ` and ` rustfmt `
24
24
commands, but you can override these commands to use more adapted versions
25
- of these tools when hacking on ` rustc ` . For example, for Visual Studio Code,
26
- you can write: <!-- date-check: nov 2022 --> <!-- the date comment is for the edition below -->
27
-
28
- ``` JSON
29
- {
30
- "rust-analyzer.checkOnSave.overrideCommand" : [
31
- " python3" ,
32
- " x.py" ,
33
- " check" ,
34
- " --json-output"
35
- ],
36
- "rust-analyzer.rustfmt.overrideCommand" : [
37
- " ./build/host/rustfmt/bin/rustfmt" ,
38
- " --edition=2021"
39
- ],
40
- "rust-analyzer.procMacro.server" : " ./build/host/stage0/libexec/rust-analyzer-proc-macro-srv" ,
41
- "rust-analyzer.procMacro.enable" : true ,
42
- "rust-analyzer.cargo.buildScripts.enable" : true ,
43
- "rust-analyzer.cargo.buildScripts.invocationLocation" : " root" ,
44
- "rust-analyzer.cargo.buildScripts.invocationStrategy" : " once" ,
45
- "rust-analyzer.cargo.buildScripts.overrideCommand" : [
46
- " python3" ,
47
- " x.py" ,
48
- " check" ,
49
- " --json-output"
50
- ],
51
- "rust-analyzer.cargo.sysroot" : " ./build/host/stage0-sysroot" ,
52
- "rust-analyzer.rustc.source" : " ./Cargo.toml" ,
53
- }
54
- ```
55
-
56
- in your ` .vscode/settings.json ` file. This will ask ` rust-analyzer ` to use
57
- ` ./x.py check ` to check the sources, and the stage 0 rustfmt to format them.
25
+ of these tools when hacking on ` rustc ` . For example, ` x.py setup ` will prompt
26
+ you to create a ` .vscode/settings.json ` file which will configure Visual Studio code.
27
+ This will ask ` rust-analyzer ` to use ` ./x.py check ` to check the sources, and the
28
+ stage 0 rustfmt to format them.
58
29
59
30
If you have enough free disk space and you would like to be able to run ` x.py ` commands while
60
31
rust-analyzer runs in the background, you can also add ` --build-dir build-rust-analyzer ` to the
61
32
` overrideCommand ` to avoid x.py locking.
62
33
63
34
If you're running ` coc.nvim ` , you can use ` :CocLocalConfig ` to create a
64
- ` .vim/coc-settings.json ` and enter the same settings as above, but replacing
65
- ` editor.formatOnSave: true, ` with
66
- ` "coc.preferences.formatOnSaveFiletypes": ["rust"], ` .
35
+ ` .vim/coc-settings.json ` and copy the settings from [ this file] ( https://github.com/rust-lang/rust/blob/master/src/etc/vscode_settings.json ) .
67
36
68
37
If running ` ./x.py check ` on save is inconvenient, in VS Code you can use a [ Build
69
38
Task] instead:
0 commit comments