• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Running Rustfmt from Atom
2
3## rust-analyzer
4
5Rustfmt can be utilized from [rust-analyzer](https://rust-analyzer.github.io/) which is provided by [ide-rust](https://atom.io/packages/ide-rust).
6
7`apm install ide-rust`
8
9Once installed a file is formatted with `ctrl-shift-c` or `cmd-shift-c`, also available in context menu.
10
11## atom-beautify
12
13Another way is to install [Beautify](https://atom.io/packages/atom-beautify), you
14can do this by running `apm install atom-beautify`.
15
16There are 2 settings that need to be configured in the atom beautifier configuration.
17
18-  Install rustfmt as per the [readme](README.md).
19-  Open the atom beautifier settings
20
21   Go to Edit->Preferences. Click the packages on the left side and click on setting for atom-beautifier
22
23-  Set rustfmt as the beautifier
24
25   Find the setting labeled *Language Config - Rust - Default Beautifier* and make sure it is set to rustfmt as shown below. You can also set the beautifier to auto format on save here.
26![image](https://cloud.githubusercontent.com/assets/6623285/11147685/c8ade16c-8a3d-11e5-9da5-bd3d998d97f9.png)
27
28-  Set the path to your rustfmt location
29
30   Find the setting labeled *Rust - Rustfmt Path*. This setting is towards the bottom and you will need to scroll a bit. Set it to the path for your rustfmt executable.
31![image](https://cloud.githubusercontent.com/assets/6623285/11147718/f4d10224-8a3d-11e5-9f69-9e900cbe0278.png)
32