@@ -195,48 +195,42 @@ 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, use one of the provided
199
+ configuration files according to the instructions below.
200
+
201
+
202
+ ### Visual Studio Code
230
203
231
- > #### Note
204
+ Copy [ ` etc/rust_analyzer_vscode.json ` ] to ` .vscode/settings.json ` in the project root directory.
205
+
206
+ > #### Hint
232
207
>
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 ` .
208
+ > To keep the ` rust-analyzer ` configuration up-to-date, make a symbolic link to one
209
+ > of the provided files depending on the IDE you use.
210
+
211
+ [ `etc/rust_analyzer_vscode.json` ] : https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_vscode.json
212
+
213
+ ### Helix
214
+
215
+ Copy [ ` etc/rust_analyzer_helix.toml ` ] to ` .helix/languages.toml ` in the project root directory.
216
+
217
+ Since working on Miri requires a custom toolchain, and Helix requires the language server
218
+ to be installed with the toolchain, you have to run ` ./miri toolchain -c rust-analyzer `
219
+ when installing the Miri toolchain. Alternatively, set the ` RUSTUP_TOOLCHAIN ` environment variable according to
220
+ [ the documentation] ( https://rust-analyzer.github.io/manual.html#toolchain ) .
221
+
222
+ [ `etc/rust_analyzer_helix.toml` ] : https://github.com/rust-lang/miri/blob/master/etc/rust_analyzer_helix.toml
223
+
224
+ ### Advanced configuration
225
+
226
+ If you are building Miri with a locally built rustc, set
227
+ ` rust-analyzer.rustcSource ` to the relative path from your Miri clone to the
228
+ root ` Cargo.toml ` of the locally built rustc. For example, the path might look
229
+ like ` ../rust/Cargo.toml ` . In addition to that, replace ` clippy ` by ` check `
230
+ in the ` rust-analyzer.check.overrideCommand ` setting.
237
231
238
232
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 ` .
233
+ for more information about configuring the IDE and ` rust-analyzer ` .
240
234
241
235
[ rdg-r-a ] : https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc
242
236
0 commit comments