Skip to content

Commit fe50729

Browse files
authored
Merge pull request rust-lang#3116 from kellerkindt/patch-1
Add howto for CLion / IntelliJ IDE integration
2 parents fa3cadf + cb99316 commit fe50729

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ completed without error (whether or not changes were made).
115115
* [Sublime Text 3](https://packagecontrol.io/packages/RustFmt)
116116
* [Atom](atom.md)
117117
* Visual Studio Code using [vscode-rust](https://github.com/editor-rs/vscode-rust), [vsc-rustfmt](https://github.com/Connorcpu/vsc-rustfmt) or [rls_vscode](https://github.com/jonathandturner/rls_vscode) through RLS.
118+
* [IntelliJ or CLion](intellij.md)
118119

119120

120121
## Checking style on a CI server

intellij.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Running Rustfmt from IntelliJ or CLion
2+
3+
## Installation
4+
5+
- Install [CLion](https://www.jetbrains.com/clion/), [IntelliJ Ultimate or CE](https://www.jetbrains.com/idea/) through the direct download link or using the [JetBrains Toolbox](https://www.jetbrains.com/toolbox/).
6+
CLion provides a built-in debugger interface but its not free like IntelliJ CE - which does not provide the debugger interface. (IntelliJ seems to lack the toolchain for that, see this discussion [intellij-rust/issues/535](https://github.com/intellij-rust/intellij-rust/issues/535))
7+
8+
- Install the [Rust Plugin](https://intellij-rust.github.io/) by navigating to File -> Settings -> Plugins and press "Install JetBrains Plugin"
9+
![plugins](https://user-images.githubusercontent.com/1133787/47240861-f40af680-d3e9-11e8-9b82-cdd5c8d5f5b8.png)
10+
11+
- Press "Install" on the rust plugin
12+
![install rust](https://user-images.githubusercontent.com/1133787/47240803-c0c86780-d3e9-11e8-9265-22f735e4d7ed.png)
13+
14+
- Restart CLion/IntelliJ
15+
16+
## Configuration
17+
18+
- Open the settings window (File -> Settings) and search for "reformat"
19+
![keymap](https://user-images.githubusercontent.com/1133787/47240922-2ae10c80-d3ea-11e8-9d8f-c798d9749240.png)
20+
- Right-click on "Reformat File with Rustfmt" and assign a keyboard shortcut
21+
22+
![shortcut_window](https://user-images.githubusercontent.com/1133787/47240981-5b28ab00-d3ea-11e8-882e-8b864164db74.png)
23+
- Press "OK"
24+
![shortcut_after](https://user-images.githubusercontent.com/1133787/47241000-6976c700-d3ea-11e8-9342-50ebc2f9f97b.png)
25+
26+
- Done. You can now use rustfmt in an opened *.rs file with your previously specified shortcut

0 commit comments

Comments
 (0)