Skip to content

Commit 9b419df

Browse files
committed
Changelog #130
1 parent b27408f commit 9b419df

4 files changed

Lines changed: 154 additions & 21 deletions

File tree

generated_assists.adoc

Lines changed: 99 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,30 @@ fn main() {
426426
```
427427

428428

429+
[discrete]
430+
=== `convert_let_else_to_match`
431+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_let_else_to_match.rs#L100[convert_let_else_to_match.rs]
432+
433+
Converts let-else statement to let statement and match expression.
434+
435+
.Before
436+
```rust
437+
fn main() {
438+
let Ok(mut x) = f() else┃ { return };
439+
}
440+
```
441+
442+
.After
443+
```rust
444+
fn main() {
445+
let mut x = match f() {
446+
Ok(x) => x,
447+
_ => return,
448+
};
449+
}
450+
```
451+
452+
429453
[discrete]
430454
=== `convert_to_guarded_return`
431455
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_to_guarded_return.rs#L21[convert_to_guarded_return.rs]
@@ -985,35 +1009,64 @@ struct Point {
9851009

9861010

9871011
[discrete]
988-
=== `generate_documentation_template`
989-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L12[generate_documentation_template.rs]
1012+
=== `generate_doc_example`
1013+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L76[generate_documentation_template.rs]
9901014

991-
Adds a documentation template above a function definition / declaration.
1015+
Generates a rustdoc example when editing an item's documentation.
9921016

9931017
.Before
9941018
```rust
995-
pub fn my_┃func(a: i32, b: i32) -> Result<(), std::io::Error> {
996-
unimplemented!()
997-
}
1019+
/// Adds two numbers.┃
1020+
pub fn add(a: i32, b: i32) -> i32 { a + b }
9981021
```
9991022

10001023
.After
10011024
```rust
1002-
/// .
1025+
/// Adds two numbers.
10031026
///
10041027
/// # Examples
10051028
///
10061029
/// ```
1007-
/// use test::my_func;
1030+
/// use test::add;
10081031
///
1009-
/// assert_eq!(my_func(a, b), );
1032+
/// assert_eq!(add(a, b), );
10101033
/// ```
1011-
///
1012-
/// # Errors
1013-
///
1014-
/// This function will return an error if .
1015-
pub fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
1016-
unimplemented!()
1034+
pub fn add(a: i32, b: i32) -> i32 { a + b }
1035+
```
1036+
1037+
1038+
[discrete]
1039+
=== `generate_documentation_template`
1040+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_documentation_template.rs#L13[generate_documentation_template.rs]
1041+
1042+
Adds a documentation template above a function definition / declaration.
1043+
1044+
.Before
1045+
```rust
1046+
pub struct S;
1047+
impl S {
1048+
pub unsafe fn set_len┃(&mut self, len: usize) -> Result<(), std::io::Error> {
1049+
/* ... */
1050+
}
1051+
}
1052+
```
1053+
1054+
.After
1055+
```rust
1056+
pub struct S;
1057+
impl S {
1058+
/// Sets the length of this [`S`].
1059+
///
1060+
/// # Errors
1061+
///
1062+
/// This function will return an error if .
1063+
///
1064+
/// # Safety
1065+
///
1066+
/// .
1067+
pub unsafe fn set_len(&mut self, len: usize) -> Result<(), std::io::Error> {
1068+
/* ... */
1069+
}
10171070
}
10181071
```
10191072

@@ -1119,6 +1172,36 @@ impl Value {
11191172
```
11201173

11211174

1175+
[discrete]
1176+
=== `generate_enum_variant`
1177+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_enum_variant.rs#L10[generate_enum_variant.rs]
1178+
1179+
Adds a variant to an enum.
1180+
1181+
.Before
1182+
```rust
1183+
enum Countries {
1184+
Ghana,
1185+
}
1186+
1187+
fn main() {
1188+
let country = Countries::Lesotho┃;
1189+
}
1190+
```
1191+
1192+
.After
1193+
```rust
1194+
enum Countries {
1195+
Ghana,
1196+
Lesotho,
1197+
}
1198+
1199+
fn main() {
1200+
let country = Countries::Lesotho;
1201+
}
1202+
```
1203+
1204+
11221205
[discrete]
11231206
=== `generate_from_impl_for_enum`
11241207
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L6[generate_from_impl_for_enum.rs]
@@ -1193,7 +1276,6 @@ struct Person {
11931276
}
11941277

11951278
impl Person {
1196-
#[must_use]
11971279
fn ┃name(&self) -> &str {
11981280
self.name.as_ref()
11991281
}
@@ -1203,7 +1285,7 @@ impl Person {
12031285

12041286
[discrete]
12051287
=== `generate_getter_mut`
1206-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_getter.rs#L51[generate_getter.rs]
1288+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_getter.rs#L50[generate_getter.rs]
12071289

12081290
Generate a mut getter method.
12091291

@@ -1221,7 +1303,6 @@ struct Person {
12211303
}
12221304

12231305
impl Person {
1224-
#[must_use]
12251306
fn ┃name_mut(&mut self) -> &mut String {
12261307
&mut self.name
12271308
}

generated_config.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Warm up caches on project load.
1111
[[rust-analyzer.cachePriming.numThreads]]rust-analyzer.cachePriming.numThreads (default: `0`)::
1212
+
1313
--
14-
How many worker threads to to handle priming caches. The default `0` means to pick automatically.
14+
How many worker threads to handle priming caches. The default `0` means to pick automatically.
1515
--
1616
[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
1717
+
@@ -407,6 +407,12 @@ Whether to render leading colons for type hints, and trailing colons for paramet
407407
--
408408
Whether to show inlay type hints for variables.
409409
--
410+
[[rust-analyzer.inlayHints.typeHints.hideClosureInitialization]]rust-analyzer.inlayHints.typeHints.hideClosureInitialization (default: `false`)::
411+
+
412+
--
413+
Whether to hide inlay type hints for `let` statements that initialize to a closure.
414+
Only applies to closures with blocks, same as `#rust-analyzer.inlayHints.closureReturnTypeHints.enable#`.
415+
--
410416
[[rust-analyzer.inlayHints.typeHints.hideNamedConstructor]]rust-analyzer.inlayHints.typeHints.hideNamedConstructor (default: `false`)::
411417
+
412418
--

generated_features.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917
333333

334334

335335
=== Inlay Hints
336-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L75[inlay_hints.rs]
336+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L76[inlay_hints.rs]
337337

338338
rust-analyzer shows additional information inline with the source code.
339339
Editors usually render this using read-only virtual text snippets interspersed with code.
@@ -518,7 +518,7 @@ image::https://user-images.githubusercontent.com/48062697/113065578-04c21800-91b
518518

519519

520520
=== On Typing Assists
521-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing.rs#L37[typing.rs]
521+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing.rs#L42[typing.rs]
522522

523523
Some features trigger on typing certain characters:
524524

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
= Changelog #130
2+
:sectanchors:
3+
:page-layout: post
4+
5+
Commit: commit:84be2eaf99c1c057b401f755f92d22d5896900f2[] +
6+
Release: release:2022-05-23[]
7+
8+
== New Features
9+
10+
* pr:12334[] (first contribution) add `Generate enum variant` assist:
11+
+
12+
video::https://user-images.githubusercontent.com/308347/169745420-959a2079-4123-4a52-8ccd-bd1386783706.mp4[options=loop]
13+
* pr:12345[] (first contribution) add `escapeSequence` semantic token type.
14+
* pr:12263[] hide type inlay hints for `let` statements that initialize a closure (enable using `rust-analyzer.inlayHints.typeHints.hideClosureInitialization`):
15+
+
16+
image::https://user-images.githubusercontent.com/12008103/168470158-6cb77b18-068e-4431-a8b5-e2b22d50d263.gif[]
17+
* pr:12130[] add assist to turn let-else statements into let and match:
18+
+
19+
video::https://user-images.githubusercontent.com/308347/169746069-9820ae1a-1dd5-4546-b73d-f4096da0e4e3.mp4[options=loop]
20+
* pr:12316[] show parameter inlay hints for closure invocations:
21+
+
22+
image::https://user-images.githubusercontent.com/308347/169746543-bf3e7de1-896f-4af7-bf5c-766bc6f8e4be.png[]
23+
* pr:11830[] add "on typing" handler for angle brackets (`<`, `>`).
24+
* pr:12303[] improve docs generation assist.
25+
* pr:12326[] add `cargo clippy` task preset.
26+
* pr:12329[] don't swallow build script errors.
27+
28+
== Fixes
29+
30+
* pr:12320[] (first contribution) hide closure return hints if type is specified.
31+
* pr:12277[] fix `Show implementations` link display error.
32+
* pr:12309[] fix incorrect expected type in completions for trailing match arms.
33+
* pr:12301[] adjust `rustc` diagnostic ranges for DOS line endings.
34+
* pr:12325[] clear `cargo check` diagnostics when turning off flycheck.
35+
* pr:12342[] avoid async callback to make `Join lines` work again.
36+
* pr:12346[] special-case base URLs of ``BuiltinType``s to `core`.
37+
* pr:12281[] increase default `chalk` overflow depth to fix some crashes.
38+
39+
== Internal Improvements
40+
41+
* pr:12311[] improve inlay hint tooltips.
42+
* pr:12349[] publish universal VSIX to make Code happy.
43+
* pr:12294[] switch to Prettier for TypeScript formatting.
44+
* pr:12327[] rename `Expr::Lambda` to `Expr::Closure`.
45+
* pr:12337[] document overall approach to reload.
46+
* pr:12313[] remove duplicate word in `cachePriming.numThreads` description.

0 commit comments

Comments
 (0)