Skip to content

Commit 2a98cc3

Browse files
authored
Merge pull request #98 from rust-analyzer/changelog-71
Changelog #71
2 parents 44758c8 + 6887f43 commit 2a98cc3

File tree

4 files changed

+180
-19
lines changed

4 files changed

+180
-19
lines changed

generated_assists.adoc

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn main() {
188188

189189
[discrete]
190190
=== `auto_import`
191-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L65[auto_import.rs]
191+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L67[auto_import.rs]
192192

193193
If the name is unresolved, provides all possible imports for it.
194194

@@ -243,6 +243,37 @@ const _: i32 = 0b1010;
243243
```
244244

245245

246+
[discrete]
247+
=== `convert_into_to_from`
248+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_into_to_from.rs#L9[convert_into_to_from.rs]
249+
250+
Converts an Into impl to an equivalent From impl.
251+
252+
.Before
253+
```rust
254+
impl ┃Into<Thing> for usize {
255+
fn into(self) -> Thing {
256+
Thing {
257+
b: self.to_string(),
258+
a: self
259+
}
260+
}
261+
}
262+
```
263+
264+
.After
265+
```rust
266+
impl From<usize> for Thing {
267+
fn from(val: usize) -> Self {
268+
Thing {
269+
b: val.to_string(),
270+
a: val
271+
}
272+
}
273+
}
274+
```
275+
276+
246277
[discrete]
247278
=== `convert_iter_for_each_to_for`
248279
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs#L9[convert_iter_for_each_to_for.rs]
@@ -379,6 +410,29 @@ enum A { One(One) }
379410
```
380411

381412

413+
[discrete]
414+
=== `extract_type_alias`
415+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_type_alias.rs#L5[extract_type_alias.rs]
416+
417+
Extracts the selected type as a type alias.
418+
419+
.Before
420+
```rust
421+
struct S {
422+
field: ┃(u8, u8, u8)┃,
423+
}
424+
```
425+
426+
.After
427+
```rust
428+
type ┃Type = (u8, u8, u8);
429+
430+
struct S {
431+
field: Type,
432+
}
433+
```
434+
435+
382436
[discrete]
383437
=== `extract_variable`
384438
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_variable.rs#L12[extract_variable.rs]

generated_features.adoc

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Provides user with annotations above items for looking up references or impl blocks
66
and running/debugging binaries.
77

8+
image::https://user-images.githubusercontent.com/48062697/113020672-b7c34f00-917a-11eb-8f6e-858735660a0e.png[]
9+
810

911
=== Auto Import
1012
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/auto_import.rs#L10[auto_import.rs]
@@ -62,6 +64,8 @@ It has the following configurations:
6264

6365
In `VS Code` the configuration for this is `rust-analyzer.assist.importPrefix`.
6466

67+
image::https://user-images.githubusercontent.com/48062697/113020673-b85be580-917a-11eb-9022-59585f35d4f8.gif[]
68+
6569

6670
=== Expand Macro Recursively
6771
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/expand_macro.rs#L17[expand_macro.rs]
@@ -74,6 +78,8 @@ Shows the full macro expansion of the macro at current cursor.
7478
| VS Code | **Rust Analyzer: Expand macro recursively**
7579
|===
7680

81+
image::https://user-images.githubusercontent.com/48062697/113020648-b3973180-917a-11eb-84a9-ecb921293dc5.gif[]
82+
7783

7884
=== Expand and Shrink Selection
7985
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/extend_selection.rs#L15[extend_selection.rs]
@@ -89,6 +95,8 @@ This is a standard LSP feature and not a protocol extension.
8995
| VS Code | kbd:[Alt+Shift+→], kbd:[Alt+Shift+←]
9096
|===
9197

98+
image::https://user-images.githubusercontent.com/48062697/113020651-b42fc800-917a-11eb-8a4f-cf1a07859fac.gif[]
99+
92100

93101
=== File Structure
94102
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/file_structure.rs#L25[file_structure.rs]
@@ -105,6 +113,8 @@ Provides a tree of the symbols defined in the file. Can be used to
105113
| VS Code | kbd:[Ctrl+Shift+O]
106114
|===
107115

116+
image::https://user-images.githubusercontent.com/48062697/113020654-b42fc800-917a-11eb-8388-e7dc4d92b02e.gif[]
117+
108118

109119
=== Find All References
110120
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/references.rs#L42[references.rs]
@@ -117,6 +127,8 @@ Shows all references of the item at the cursor location
117127
| VS Code | kbd:[Shift+Alt+F12]
118128
|===
119129

130+
image::https://user-images.githubusercontent.com/48062697/113020670-b7c34f00-917a-11eb-8003-370ac5f2b3cb.gif[]
131+
120132

121133
=== Format String Completion.
122134
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_completion/src/completions/postfix/format_like.rs#L0[format_like.rs]
@@ -135,6 +147,8 @@ The following postfix snippets are available:
135147
+ `logw` -> `log::warn!(...)`
136148
+ `loge` -> `log::error!(...)`
137149

150+
image::https://user-images.githubusercontent.com/48062697/113020656-b560f500-917a-11eb-87de-02991f61beb8.gif[]
151+
138152

139153
=== Go to Definition
140154
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs#L15[goto_definition.rs]
@@ -147,6 +161,8 @@ Navigates to the definition of an identifier.
147161
| VS Code | kbd:[F12]
148162
|===
149163

164+
image::https://user-images.githubusercontent.com/48062697/113065563-025fbe00-91b1-11eb-83e4-a5a703610b23.gif[]
165+
150166

151167
=== Go to Implementation
152168
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_implementation.rs#L10[goto_implementation.rs]
@@ -159,6 +175,8 @@ Navigates to the impl block of structs, enums or traits. Also implemented as a c
159175
| VS Code | kbd:[Ctrl+F12]
160176
|===
161177

178+
image::https://user-images.githubusercontent.com/48062697/113065566-02f85480-91b1-11eb-9288-aaad8abd8841.gif[]
179+
162180

163181
=== Go to Type Definition
164182
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_type_definition.rs#L6[goto_type_definition.rs]
@@ -171,13 +189,17 @@ Navigates to the type of an identifier.
171189
| VS Code | **Go to Type Definition*
172190
|===
173191

192+
image::https://user-images.githubusercontent.com/48062697/113020657-b560f500-917a-11eb-9007-0f809733a338.gif[]
193+
174194

175195
=== Hover
176196
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs#L81[hover.rs]
177197

178198
Shows additional information, like type of an expression or documentation for definition when "focusing" code.
179199
Focusing is usually hovering with a mouse, but can also be triggered with a shortcut.
180200

201+
image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917a-11eb-9f88-3dbc27320c95.gif[]
202+
181203

182204
=== Inlay Hints
183205
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L35[inlay_hints.rs]
@@ -201,6 +223,8 @@ https://github.com/rust-analyzer/rust-analyzer/issues/1623[1], https://github.co
201223
| VS Code | **Rust Analyzer: Toggle inlay hints*
202224
|===
203225

226+
image::https://user-images.githubusercontent.com/48062697/113020660-b5f98b80-917a-11eb-8d70-3be3fd558cdd.png[]
227+
204228

205229
=== Join Lines
206230
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/join_lines.rs#L13[join_lines.rs]
@@ -213,6 +237,8 @@ Join selected lines into one, smartly fixing up whitespace, trailing commas, and
213237
| VS Code | **Rust Analyzer: Join lines**
214238
|===
215239

240+
image::https://user-images.githubusercontent.com/48062697/113020661-b6922200-917a-11eb-87c4-b75acc028f11.gif[]
241+
216242

217243
=== Magic Completions
218244
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_completion/src/lib.rs#L34[lib.rs]
@@ -266,6 +292,8 @@ And the auto import completions, enabled with the `rust-analyzer.completion.auto
266292
Those are the additional completion options with automatic `use` import and options from all project importable items,
267293
fuzzy matched agains the completion imput.
268294

295+
image::https://user-images.githubusercontent.com/48062697/113020667-b72ab880-917a-11eb-8778-716cf26a0eb3.gif[]
296+
269297

270298
=== Matching Brace
271299
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/matching_brace.rs#L6[matching_brace.rs]
@@ -280,6 +308,8 @@ braces, so it won't confuse generics with comparisons.
280308
| VS Code | **Rust Analyzer: Find matching brace**
281309
|===
282310

311+
image::https://user-images.githubusercontent.com/48062697/113065573-04298180-91b1-11eb-8dec-d4e2a202f304.gif[]
312+
283313

284314
=== Memory Usage
285315
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/apply_change.rs#L95[apply_change.rs]
@@ -291,10 +321,11 @@ Clears rust-analyzer's internal database and prints memory usage statistics.
291321

292322
| VS Code | **Rust Analyzer: Memory Usage (Clears Database)**
293323
|===
324+
image::https://user-images.githubusercontent.com/48062697/113065592-08559f00-91b1-11eb-8c96-64b88068ec02.gif[]
294325

295326

296327
=== Move Item
297-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/move_item.rs#L16[move_item.rs]
328+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/move_item.rs#L18[move_item.rs]
298329

299330
Move item under cursor or selection up and down.
300331

@@ -305,6 +336,8 @@ Move item under cursor or selection up and down.
305336
| VS Code | **Rust Analyzer: Move item down**
306337
|===
307338

339+
image::https://user-images.githubusercontent.com/48062697/113065576-04298180-91b1-11eb-91ce-4505e99ed598.gif[]
340+
308341

309342
=== On Enter
310343
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L15[on_enter.rs]
@@ -328,6 +361,8 @@ Add the following to `keybindings.json`:
328361
}
329362
----
330363

364+
image::https://user-images.githubusercontent.com/48062697/113065578-04c21800-91b1-11eb-82b8-22b8c481e645.gif[]
365+
331366

332367
=== On Typing Assists
333368
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing.rs#L38[typing.rs]
@@ -345,6 +380,9 @@ Add the following to `settings.json`:
345380
"editor.formatOnType": true,
346381
----
347382

383+
image::https://user-images.githubusercontent.com/48062697/113166163-69758500-923a-11eb-81ee-eb33ec380399.gif[]
384+
image::https://user-images.githubusercontent.com/48062697/113171066-105c2000-923f-11eb-87ab-f4a263346567.gif[]
385+
348386

349387
=== Parent Module
350388
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/parent_module.rs#L12[parent_module.rs]
@@ -357,9 +395,11 @@ Navigates to the parent module of the current module.
357395
| VS Code | **Rust Analyzer: Locate parent module**
358396
|===
359397

398+
image::https://user-images.githubusercontent.com/48062697/113065580-04c21800-91b1-11eb-9a32-00086161c0bd.gif[]
399+
360400

361401
=== Related Tests
362-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L127[runnables.rs]
402+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L128[runnables.rs]
363403

364404
Provides a sneak peek of all tests where the current item is used.
365405

@@ -385,6 +425,8 @@ Renames the item below the cursor and all of its references
385425
| VS Code | kbd:[F2]
386426
|===
387427

428+
image::https://user-images.githubusercontent.com/48062697/113065582-055aae80-91b1-11eb-8ade-2b58e6d81883.gif[]
429+
388430

389431
=== Run
390432
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L90[runnables.rs]
@@ -398,6 +440,7 @@ to a shortcut!
398440

399441
| VS Code | **Rust Analyzer: Run**
400442
|===
443+
image::https://user-images.githubusercontent.com/48062697/113065583-055aae80-91b1-11eb-958f-d67efcaf6a2f.gif[]
401444

402445

403446
=== Semantic Syntax Highlighting
@@ -411,6 +454,9 @@ It's up to the client to map those to specific colors.
411454
The general rule is that a reference to an entity gets colored the same way as the entity itself.
412455
We also give special modifier for `mut` and `&mut` local variables.
413456

457+
image::https://user-images.githubusercontent.com/48062697/113164457-06cfb980-9239-11eb-819b-0f93e646acf8.png[]
458+
image::https://user-images.githubusercontent.com/48062697/113187625-f7f50100-9250-11eb-825e-91c58f236071.png[]
459+
414460

415461
=== Show Syntax Tree
416462
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_tree.rs#L7[syntax_tree.rs]
@@ -423,6 +469,7 @@ rust-analyzer itself.
423469

424470
| VS Code | **Rust Analyzer: Show Syntax Tree**
425471
|===
472+
image::https://user-images.githubusercontent.com/48062697/113065586-068bdb80-91b1-11eb-9507-fee67f9f45a0.gif[]
426473

427474

428475
=== Status
@@ -435,6 +482,7 @@ Shows internal statistic about memory usage of rust-analyzer.
435482

436483
| VS Code | **Rust Analyzer: Status**
437484
|===
485+
image::https://user-images.githubusercontent.com/48062697/113065584-05f34500-91b1-11eb-98cc-5c196f76be7f.gif[]
438486

439487

440488
=== Structural Search and Replace
@@ -511,6 +559,7 @@ be parsed as a valid structural search and replace rule.
511559

512560
| VS Code | **Rust Analyzer: View Hir**
513561
|===
562+
image::https://user-images.githubusercontent.com/48062697/113065588-068bdb80-91b1-11eb-9a78-0b4ef1e972fb.gif[]
514563

515564

516565
=== Workspace Symbol

manual.adoc

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,23 +254,10 @@ let g:LanguageClient_serverCommands = {
254254

255255
==== YouCompleteMe
256256

257-
1. Install YouCompleteMe by following the instructions
258-
https://github.com/ycm-core/lsp-examples#rust-rust-analyzer[here]
257+
Install YouCompleteMe by following the instructions
258+
https://github.com/ycm-core/YouCompleteMe#installation[here].
259259

260-
2. Configure by adding this to your vim/neovim config file (replacing the existing Rust-specific line if it exists):
261-
+
262-
[source,vim]
263-
----
264-
let g:ycm_language_server =
265-
\ [
266-
\ {
267-
\ 'name': 'rust',
268-
\ 'cmdline': ['rust-analyzer'],
269-
\ 'filetypes': ['rust'],
270-
\ 'project_root_files': ['Cargo.toml']
271-
\ }
272-
\ ]
273-
----
260+
rust-analyzer is the default in ycm, it should work out of the box.
274261

275262
==== ALE
276263

0 commit comments

Comments
 (0)