@@ -195,48 +195,37 @@ installed (`cargo install hyperfine`).
195
195
196
196
## Configuring ` rust-analyzer `
197
197
198
- To configure ` rust-analyzer ` and VS Code for working on Miri, save the following
199
- to ` .vscode/settings.json ` in your local Miri clone:
200
-
201
- ``` json
202
- {
203
- "rust-analyzer.rustc.source" : " discover" ,
204
- "rust-analyzer.linkedProjects" : [
205
- " Cargo.toml" ,
206
- " cargo-miri/Cargo.toml" ,
207
- " miri-script/Cargo.toml" ,
208
- ],
209
- "rust-analyzer.check.invocationLocation" : " root" ,
210
- "rust-analyzer.check.invocationStrategy" : " once" ,
211
- "rust-analyzer.check.overrideCommand" : [
212
- " env" ,
213
- " MIRI_AUTO_OPS=no" ,
214
- " ./miri" ,
215
- " clippy" , // make this `check` when working with a locally built rustc
216
- " --message-format=json" ,
217
- ],
218
- // Contrary to what the name suggests, this also affects proc macros.
219
- "rust-analyzer.cargo.buildScripts.invocationLocation" : " root" ,
220
- "rust-analyzer.cargo.buildScripts.invocationStrategy" : " once" ,
221
- "rust-analyzer.cargo.buildScripts.overrideCommand" : [
222
- " env" ,
223
- " MIRI_AUTO_OPS=no" ,
224
- " ./miri" ,
225
- " check" ,
226
- " --message-format=json" ,
227
- ],
228
- }
229
- ```
198
+ To configure ` rust-analyzer ` and the IDE for working on Miri, copy one of the provided
199
+ configuration files according to the instructions below. You can also set up a symbolic
200
+ link to keep the configuration in sync with our recommendations.
201
+
202
+ ### Visual Studio Code
203
+
204
+ Copy [ ` etc/rust_analyzer_vscode.json ` ] to ` .vscode/settings.json ` in the project root directory.
205
+
206
+ [ `etc/rust_analyzer_vscode.json` ] : https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_vscode.json
207
+
208
+ ### Helix
209
+
210
+ Copy [ ` etc/rust_analyzer_helix.toml ` ] to ` .helix/languages.toml ` in the project root directory.
211
+
212
+ Since working on Miri requires a custom toolchain, and Helix requires the language server
213
+ to be installed with the toolchain, you have to run ` ./miri toolchain -c rust-analyzer `
214
+ when installing the Miri toolchain. Alternatively, set the ` RUSTUP_TOOLCHAIN ` environment variable according to
215
+ [ the documentation] ( https://rust-analyzer.github.io/manual.html#toolchain ) .
216
+
217
+ [ `etc/rust_analyzer_helix.toml` ] : https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_helix.toml
218
+
219
+ ### Advanced configuration
230
220
231
- > #### Note
232
- >
233
- > If you are [ building Miri with a locally built rustc] [ ] , set
234
- > ` rust-analyzer.rustcSource ` to the relative path from your Miri clone to the
235
- > root ` Cargo.toml ` of the locally built rustc. For example, the path might look
236
- > like ` ../rust/Cargo.toml ` .
221
+ If you are building Miri with a locally built rustc, set
222
+ ` rust-analyzer.rustcSource ` to the relative path from your Miri clone to the
223
+ root ` Cargo.toml ` of the locally built rustc. For example, the path might look
224
+ like ` ../rust/Cargo.toml ` . In addition to that, replace ` clippy ` by ` check `
225
+ in the ` rust-analyzer.check.overrideCommand ` setting.
237
226
238
227
See the rustc-dev-guide's docs on [ "Configuring ` rust-analyzer ` for ` rustc ` "] [ rdg-r-a ]
239
- for more information about configuring VS Code and ` rust-analyzer ` .
228
+ for more information about configuring the IDE and ` rust-analyzer ` .
240
229
241
230
[ rdg-r-a ] : https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc
242
231
0 commit comments