forked from intellij-rust/intellij-rust.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatures.html
More file actions
322 lines (242 loc) · 10.5 KB
/
features.html
File metadata and controls
322 lines (242 loc) · 10.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
---
layout: page
title: Features
permalink: /features/
class: features-page
---
{% include doc-shortcut-tip.html %}
<div class="feature-group">
<h2>Smart editor</h2>
{% include feature-pic.html i="feature-editor" %}
<div class="feature">
<h3>Syntax highlighting</h3>
<p>IntelliJ Rust, apart from basic lexer highlighting, also highlights resolved types, functions, variables (marking
out mutable ones) and macros. All color schemes are customizable and we support both <i>Default</i> and
<i>Darcula</i> themes out of the box.</p>
</div>
<div class="feature">
<h3>Code formatter</h3>
<p><b>Reformat Code</b> <kbd>Ctrl+Alt+L</kbd> reformats current file or selection using our custom, fully functional
formatter based on IntelliJ's formatting engine. There's also a special action
for formatting code with rustfmt.
</div>
<div class="feature">
<h3>Code selection</h3>
<p>To select a block of code place a cursor inside block and press <kbd>Ctrl+W</kbd> to expand it to an expression,
to a line, to a logical block of code, and so on. To shrink selection press <kbd>Ctrl+Shift+W</kbd> as many
times as needed.</p>
</div>
<div class="feature">
<h3>Code commenting</h3>
<p>After selecting a block, you can apply a block comment (<kbd>Ctrl+Shift+/</kbd>) or line comment
(<kbd>Ctrl+/</kbd>) to it. The same shortcuts will remove existing comments from selected lines too.</p>
</div>
<div class="feature">
<h3>Code folding</h3>
<p>Code folding, auto-insertion of braces, brackets & quotes, matching brace/bracket highlighting, etc.</p>
</div>
<div class="feature">
<h3>On-the-fly analysis<abbr class="wip" title="Work In Progress">WIP</abbr></h3>
<p>Errors are shown as you type. Among others, we catch syntax errors, missing fields/methods and unnecessary
parens. We also support IntelliJ's built-in spell-checker.</p>
</div>
</div>
<div class="feature-group">
<h2>Code Completion<abbr class="wip" title="Work In Progress">WIP</abbr></h2>
{% include feature-pic.html i="feature-completion" %}
<div class="feature feature-major">
<p>
IntelliJ Rust features built from scratch code completion, leveraging IntelliJ Platform capabilities.
<kbd>Ctrl+Space</kbd> invokes completion. We <a href="/docs/faq.html#racer">do not</a> plan
to use <code>racer</code>. Most of the code completion is implemented, but support
for macros is a work in progress.
<p>Remember, if the smart completion does not work for your particular case, you can always invoke "dumb completion"
via <kbd>Alt+/</kbd>. It merely suggests identifiers already present in the file, but works surprisingly well.</p>
</div>
</div>
<div class="feature-group">
<h2>Source code navigation</h2>
{% include feature-pic.html i="feature-navigation" %}
<p>There are a number of actions for efficient navigation across your project and dependencies.</p>
<div class="feature">
<h3>Find Usages<abbr class="wip" title="Work In Progress">WIP</abbr></h3>
<p><kbd>Alt+F7</kbd> finds usages of element at caret.</p>
</div>
<div class="feature">
<h3>Goto Declaration</h3>
<p><kbd>Ctrl+B</kbd> goes to the definition of the symbol at caret.</p>
</div>
<div class="feature">
<h3>Goto Class</h3>
<p><kbd>Ctrl+N</kbd> search for a struct or enum by name.</p>
</div>
<div class="feature">
<h3>Goto Symbol</h3>
<p><kbd>Ctrl+Shift+Alt+N</kbd> searches for any symbol (types, methods, functions, fields) by name. Together with
<kbd>Ctrl+N</kbd> it is the main method to explore large projects.</p>
</div>
<div class="feature">
<h3>Goto Super</h3>
<p><kbd>Ctrl+U</kbd> navigates to the parent module.</p>
</div>
<div class="feature">
<h3>File Structure</h3>
<p><kbd>Ctrl+F12</kbd>, <kbd>Alt+7</kbd> brings up an overview of the current file.</p>
</div>
<div class="feature side-pic">
{% include feature-pic.html i="feature-nav-to-impl"%}
</div>
<div class="feature">
<h3>Implementations</h3>
<p>
Gutter icon or <kbd>Ctrl+Alt+B</kbd> shortcut can be used to navigate between traits or types and impls.
</p>
</div>
</div>
<div class="feature-group">
<h2>Code generation and refactorings</h2>
<div class="feature feature-major">
<h3>'Surround With' and Live Templates</h3>
<p>There is a number of built in live templates and you can define your own. Different live templates are available
in different contexts. Use <kbd>Ctrl+J</kbd> to list templates available in context.</p>
<ul class="with-side-pic">
<li>
{% include feature-gfy.html n="UnrulyMajorElephantseal" %}
<p><kbd>p</kbd>, <kbd>pd</kbd>, <kbd>ppd</kbd> - <code>println!</code> value with <code>{}</code>, debug
<code>{:?}</code> and pretty debug <code>{:#?}</code> formats.</p>
</li>
<li>
{% include feature-gfy.html n="PlushOddballBoilweevil" %}
<p><kbd>a</kbd>, <kbd>ae</kbd> - <code>assert!</code> / <code>assert_eq!</code></p>
</li>
<li>
{% include feature-gfy.html n="ShyThatAmericanquarterhorse" %}
<div class="p">
<p><kbd>tfn</kbd> - test function boilerplate</p>
<p><kbd>tmod</kbd> - test module boilerplate</p>
</div>
</li>
<li>
{% include feature-gfy.html n="GlamorousUnacceptableHowlermonkey" %}
<p><kbd>f</kbd>, <kbd>pf</kbd> - (<code>pub</code>) field name and type, applicable inside struct
definitions.</p>
</li>
<li>
{% include feature-gfy.html n="WelldocumentedUnsteadyCougar" %}
<p><kbd>loop</kbd>, <kbd>while</kbd>, <kbd>for</kbd> templates. You can select a fragment of code and press
<kbd>Ctrl+Alt+J</kbd> to invoke <b>Surround With Live Template</b> action.</p>
</li>
</ul>
</div>
<div class="feature feature-major">
<h3>Refactorings<abbr class="wip" title="Work In Progress">WIP</abbr></h3>
<div class="feature-group grid">
<div class="feature">
<p><b>Expand module</b>: invoke this refactoring inside <code>foo.rs</code> file to get
<code>foo/mod.rs</code>. Also available as a quick fix for unresolved module declaration.</p>
</div>
<div class="feature">
<p><b>Introduce variable</b>: use <kbd>Ctrl+Alt+V</kbd> or <code>.let</code> postfix template to extract a variable from an expression.</p>
</div>
</div>
</div>
<div class="feature feature-major">
<h3>Intentions</h3>
<p>Intentions and quick fixes are micro refactorings automatically available depending on the context. If some
intentions are available, a light bulb icon appears in the editor. You can use <kbd>Alt+Enter</kbd> to invoke a
quick fix.</p>
<div class="feature-group grid">
<div class="feature">
{% include feature-gfy.html n="PessimisticFlashyAustraliancurlew" %}
<p><b>Contract module</b>: the opposite of <i>Expand Module</i> refactoring. Available only if there are no
child modules.</p>
</div>
<div class="feature">
{% include feature-gfy.html n="HauntingAgonizingDuck" %}
<p><b>Create module file</b>: if you have <code>mod foo;</code>, but no <code>foo.rs</code>
this quick fix will create the missing file.</p>
</div>
<div class="feature">
{% include feature-gfy.html n="BleakWholeGalapagospenguin" %}
<p><b>Extract inline module</b>: move <code>mod foo { ... }</code> to a separate file.</p>
</div>
<div class="feature" id="add-derive">
{% include feature-gfy.html n="ChubbyAcrobaticBrahmanbull" %}
<p><b>Add derive clause</b>: adds <code>#[derive(..)]</code> attribute to structs and enums.</p>
</div>
<div class="feature">
{% include feature-gfy.html n="CluelessGiddyBullfrog" %}
<p><b>Remove/Add curly braces</b>: toggles between <code>use foo::{bar}</code> and
<code>use foo::bar</code>.</p>
</div>
<div class="feature">
{% include feature-gfy.html n="ImperfectFreeGecko" %}
<p><b>Add missing fields</b>: a handy way to fill out the struct literal template.</p>
</div>
<div class="feature">
{% include feature-gfy.html n="GlisteningCostlyAntarcticfurseal" %}
<p><b>Implement methods</b>: quickly scafold an impl.</p>
</div>
</div>
</div>
</div>
<div class="feature-group">
<h2>Documentation</h2>
{% include feature-pic.html i="feature-doc" %}
<div class="feature half">
<h3>Highlighting</h3>
<p>IntelliJ Rust highlights important parts of documentation comments, so they never look so bland.</p>
</div>
<div class="feature half">
<h3>Quick documentation</h3>
<p><kbd>Ctrl+Q</kbd> shows docs for the symbol at caret.</p>
</div>
</div>
<div class="feature-group">
<h2>Reading code</h2>
{% include feature-pic.html i="feature-reading" %}
<div class="feature half">
<h3>Quick documentation</h3>
<p><kbd>Ctrl+Q</kbd> shows docs for the symbol at caret.</p>
</div>
<div class="feature half">
<h3>Documentation highlighting</h3>
<p>IntelliJ Rust highlights important parts of documentation comments, so they never look so bland.</p>
</div>
<div class="feature half">
<h3>Parameter hints</h3>
<p>In the editor, you can see hints with names of parameters and types of local variables</p>
</div>
<div class="feature half">
<h3>Type information</h3>
<p>Use <kbd>Ctrl+Shift+P</kbd> to view the type of selected expression.</p>
</div>
</div>
<div class="feature-group side-pic-showcase">
<h2>Running</h2>
<div class="feature side-pic">
{% include feature-pic.html i="feature-runconfig" %}
</div>
<div class="feature">
<h3>Configurations</h3>
<p>Built-in <code>Cargo Command</code> run configuration allows to build,
test and run Rust code.
</p>
</div>
<div class="feature side-pic">
{% include feature-gfy.html n="FinePopularGreathornedowl" %}
</div>
<div class="feature">
<h3>Context aware</h3>
You can use <kbd>Ctrl+Shift+F10</kbd> shortcut to run a <code>main</code> or a <code>test</code> function.
Alternatively, you can use the icon in the gutter area.
</div>
<div class="feature side-pic">
{% include feature-gfy.html n="VelvetySerpentineCowbird" %}
</div>
<div class="feature">
<h3>Synergy</h3>
You can combine <kbd>Ctrl+Alt+Shift+N</kbd> with <kbd>Ctrl+Shift+F10</kbd> to
find and execute a test without switching between code and tests.
</div>
</div>