@@ -15,10 +15,8 @@ par. If the hook fails then run `./x test tidy --bless` and commit the changes.
15
15
If you decide later that the pre-push behavior is undesirable, you can delete
16
16
the ` pre-push ` file in ` .git/hooks ` .
17
17
18
- A prebuilt git hook lives at
19
- [ ` src/etc/pre-push.sh ` ] ( https://github.com/rust-lang/rust/blob/master/src/etc/pre-push.sh )
20
- which can be copied into your ` .git/hooks ` folder as ` pre-push ` (without the
21
- ` .sh ` extension!).
18
+ A prebuilt git hook lives at [ ` src/etc/pre-push.sh ` ] . It can be copied into
19
+ your ` .git/hooks ` folder as ` pre-push ` (without the ` .sh ` extension!).
22
20
23
21
You can also install the hook as a step of running ` ./x setup ` !
24
22
@@ -43,11 +41,16 @@ If you have enough free disk space and you would like to be able to run `x`
43
41
commands while rust-analyzer runs in the background, you can also add
44
42
` --build-dir build-rust-analyzer ` to the ` overrideCommand ` to avoid x locking.
45
43
44
+ Running ` ./x setup editor ` will prompt you to create a project-local LSP config
45
+ file for one of the supported editors. You can also create the config file as a
46
+ step of running ` ./x setup ` .
47
+
46
48
### Visual Studio Code
47
49
48
- Running ` ./x setup vscode ` will prompt you to create a ` .vscode/settings.json `
49
- file which will configure Visual Studio code. The recommended ` rust-analyzer `
50
- settings live at [ ` src/etc/rust_analyzer_settings.json ` ] .
50
+ Selecting ` vscode ` in ` ./x setup editor ` will prompt you to create a
51
+ ` .vscode/settings.json ` file which will configure Visual Studio code. The
52
+ recommended ` rust-analyzer ` settings live at
53
+ [ ` src/etc/rust_analyzer_settings.json ` ] .
51
54
52
55
If running ` ./x check ` on save is inconvenient, in VS Code you can use a [ Build
53
56
Task] instead:
@@ -83,13 +86,14 @@ here](https://rust-analyzer.github.io/manual.html#nvim-lsp).
83
86
84
87
1 . First install the plugin. This can be done by following the steps in the
85
88
README.
86
- 2 . Run ` x setup ` , which will have a prompt for it to create a
89
+ 2 . Run ` ./ x setup editor ` , and select ` vscode ` to create a
87
90
` .vscode/settings.json ` file. ` neoconf ` is able to read and update
88
91
rust-analyzer settings automatically when the project is opened when this
89
92
file is detected.
90
93
91
- If you're running ` coc.nvim ` , you can use ` :CocLocalConfig ` to create a
92
- ` .vim/coc-settings.json ` , and copy the settings from
94
+ If you're using ` coc.nvim ` , you can run ` ./x setup editor ` and select ` vim ` to
95
+ create a ` .vim/coc-settings.json ` . The settings can be edited with
96
+ ` :CocLocalConfig ` . The recommended settings live at
93
97
[ ` src/etc/rust_analyzer_settings.json ` ] .
94
98
95
99
Another way is without a plugin, and creating your own logic in your
@@ -111,10 +115,10 @@ Emacs provides support for rust-analyzer with project-local configuration
111
115
through [ Eglot] ( https://www.gnu.org/software/emacs/manual/html_node/eglot/ ) .
112
116
Steps for setting up Eglot with rust-analyzer can be [ found
113
117
here] ( https://rust-analyzer.github.io/manual.html#eglot ) .
114
- Having set up Emacs & Eglot for Rust development in general, you can use the
115
- configuration for rustc provided in [ ` src/etc/rust_analyzer_eglot.el ` ] (
116
- https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_eglot .el).
117
- Simply copy the provided file to ` .dir-locals. el` in the project root directory .
118
+ Having set up Emacs & Eglot for Rust development in general, you can run
119
+ ` ./x setup editor ` and select ` emacs ` , which will prompt you to create
120
+ ` .dir-locals .el` with the recommended configuration for Eglot.
121
+ The recommended settings live at [ ` src/etc/rust_analyzer_eglot. el` ] .
118
122
For more information on project-specific Eglot configuration, consult [ the
119
123
manual] ( https://www.gnu.org/software/emacs/manual/html_node/eglot/Project_002dspecific-configuration.html ) .
120
124
@@ -123,14 +127,13 @@ manual](https://www.gnu.org/software/emacs/manual/html_node/eglot/Project_002dsp
123
127
Helix comes with built-in LSP and rust-analyzer support.
124
128
It can be configured through ` languages.toml ` , as described
125
129
[ here] ( https://docs.helix-editor.com/languages.html ) .
126
- You can use the configuration for rustc provided in
127
- [ ` src/etc/rust_analyzer_helix.toml ` ] ( https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_helix.toml ) .
128
- Simply copy the provided file to ` .helix/languages.toml ` in the project root
129
- directory.
130
+ You can run ` ./x setup editor ` and select ` helix ` , which will prompt you to
131
+ create ` languages.toml ` with the recommended configuration for Helix. The
132
+ recommended settings live at [ ` src/etc/rust_analyzer_helix.toml ` ] .
130
133
131
134
## Check, check, and check again
132
135
133
- When doing simple refactorings , it can be useful to run ` ./x check `
136
+ When doing simple refactoring , it can be useful to run ` ./x check `
134
137
continuously. If you set up ` rust-analyzer ` as described above, this will be
135
138
done for you every time you save a file. Here you are just checking that the
136
139
compiler can ** build** , but often that is all you need (e.g., when renaming a
@@ -356,3 +359,6 @@ Adding this to your shell's startup script (e.g. `.bashrc`) will automatically
356
359
load this completion.
357
360
358
361
[ `src/etc/rust_analyzer_settings.json` ] : https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_settings.json
362
+ [ `src/etc/rust_analyzer_eglot.el` ] : https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_eglot.el
363
+ [ `src/etc/rust_analyzer_helix.toml` ] : https://github.com/rust-lang/rust/blob/master/src/etc/rust_analyzer_helix.toml
364
+ [ `src/etc/pre-push.sh` ] : https://github.com/rust-lang/rust/blob/master/src/etc/pre-push.sh
0 commit comments