Skip to content

Commit ada632f

Browse files
committed
Changelog #164
1 parent 664b883 commit ada632f

File tree

5 files changed

+242
-54
lines changed

5 files changed

+242
-54
lines changed

generated_assists.adoc

Lines changed: 158 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,41 @@ fn qux(bar: Bar, baz: Baz) {}
726726
```
727727

728728

729+
[discrete]
730+
=== `extract_expressions_from_format_string`
731+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs#L13[extract_expressions_from_format_string.rs]
732+
733+
Move an expression out of a format string.
734+
735+
.Before
736+
```rust
737+
macro_rules! format_args {
738+
($lit:literal $(tt:tt)*) => { 0 },
739+
}
740+
macro_rules! print {
741+
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
742+
}
743+
744+
fn main() {
745+
print!("{var} {x + 1}┃");
746+
}
747+
```
748+
749+
.After
750+
```rust
751+
macro_rules! format_args {
752+
($lit:literal $(tt:tt)*) => { 0 },
753+
}
754+
macro_rules! print {
755+
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
756+
}
757+
758+
fn main() {
759+
print!("{var} {}"┃, x + 1);
760+
}
761+
```
762+
763+
729764
[discrete]
730765
=== `extract_function`
731766
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_function.rs#L38[extract_function.rs]
@@ -812,7 +847,7 @@ enum A { One(One) }
812847

813848
[discrete]
814849
=== `extract_type_alias`
815-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_type_alias.rs#L10[extract_type_alias.rs]
850+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_type_alias.rs#L7[extract_type_alias.rs]
816851

817852
Extracts the selected type as a type alias.
818853

@@ -1325,7 +1360,7 @@ fn main() {
13251360

13261361
[discrete]
13271362
=== `generate_from_impl_for_enum`
1328-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L6[generate_from_impl_for_enum.rs]
1363+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L8[generate_from_impl_for_enum.rs]
13291364

13301365
Adds a From impl for this enum variant with one tuple field.
13311366

@@ -1661,6 +1696,43 @@ fn main() {
16611696
```
16621697

16631698

1699+
[discrete]
1700+
=== `inline_macro`
1701+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_macro.rs#L5[inline_macro.rs]
1702+
1703+
Takes a macro and inlines it one step.
1704+
1705+
.Before
1706+
```rust
1707+
macro_rules! num {
1708+
(+$($t:tt)+) => (1 + num!($($t )+));
1709+
(-$($t:tt)+) => (-1 + num!($($t )+));
1710+
(+) => (1);
1711+
(-) => (-1);
1712+
}
1713+
1714+
fn main() {
1715+
let number = num┃!(+ + + - + +);
1716+
println!("{number}");
1717+
}
1718+
```
1719+
1720+
.After
1721+
```rust
1722+
macro_rules! num {
1723+
(+$($t:tt)+) => (1 + num!($($t )+));
1724+
(-$($t:tt)+) => (-1 + num!($($t )+));
1725+
(+) => (1);
1726+
(-) => (-1);
1727+
}
1728+
1729+
fn main() {
1730+
let number = 1+num!(+ + - + +);
1731+
println!("{number}");
1732+
}
1733+
```
1734+
1735+
16641736
[discrete]
16651737
=== `inline_type_alias`
16661738
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_type_alias.rs#L105[inline_type_alias.rs]
@@ -1980,41 +2052,6 @@ impl S {
19802052
```
19812053

19822054

1983-
[discrete]
1984-
=== `move_format_string_arg`
1985-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/move_format_string_arg.rs#L13[move_format_string_arg.rs]
1986-
1987-
Move an expression out of a format string.
1988-
1989-
.Before
1990-
```rust
1991-
macro_rules! format_args {
1992-
($lit:literal $(tt:tt)*) => { 0 },
1993-
}
1994-
macro_rules! print {
1995-
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
1996-
}
1997-
1998-
fn main() {
1999-
print!("{x + 1}┃");
2000-
}
2001-
```
2002-
2003-
.After
2004-
```rust
2005-
macro_rules! format_args {
2006-
($lit:literal $(tt:tt)*) => { 0 },
2007-
}
2008-
macro_rules! print {
2009-
($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
2010-
}
2011-
2012-
fn main() {
2013-
print!("{}"┃, x + 1);
2014-
}
2015-
```
2016-
2017-
20182055
[discrete]
20192056
=== `move_from_mod_rs`
20202057
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/move_from_mod_rs.rs#L12[move_from_mod_rs.rs]
@@ -2412,6 +2449,69 @@ impl Foo for Bar {
24122449
```
24132450

24142451

2452+
[discrete]
2453+
=== `replace_arith_with_checked`
2454+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L9[replace_arith_op.rs]
2455+
2456+
Replaces arithmetic on integers with the `checked_*` equivalent.
2457+
2458+
.Before
2459+
```rust
2460+
fn main() {
2461+
let x = 1 ┃+ 2;
2462+
}
2463+
```
2464+
2465+
.After
2466+
```rust
2467+
fn main() {
2468+
let x = 1.checked_add(2);
2469+
}
2470+
```
2471+
2472+
2473+
[discrete]
2474+
=== `replace_arith_with_saturating`
2475+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L28[replace_arith_op.rs]
2476+
2477+
Replaces arithmetic on integers with the `saturating_*` equivalent.
2478+
2479+
.Before
2480+
```rust
2481+
fn main() {
2482+
let x = 1 ┃+ 2;
2483+
}
2484+
```
2485+
2486+
.After
2487+
```rust
2488+
fn main() {
2489+
let x = 1.saturating_add(2);
2490+
}
2491+
```
2492+
2493+
2494+
[discrete]
2495+
=== `replace_arith_with_wrapping`
2496+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L50[replace_arith_op.rs]
2497+
2498+
Replaces arithmetic on integers with the `wrapping_*` equivalent.
2499+
2500+
.Before
2501+
```rust
2502+
fn main() {
2503+
let x = 1 ┃+ 2;
2504+
}
2505+
```
2506+
2507+
.After
2508+
```rust
2509+
fn main() {
2510+
let x = 1.wrapping_add(2);
2511+
}
2512+
```
2513+
2514+
24152515
[discrete]
24162516
=== `replace_char_with_string`
24172517
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_string_with_char.rs#L51[replace_string_with_char.rs]
@@ -2884,6 +2984,27 @@ pub async fn bar() { foo() }
28842984
```
28852985

28862986

2987+
[discrete]
2988+
=== `unqualify_method_call`
2989+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unqualify_method_call.rs#L8[unqualify_method_call.rs]
2990+
2991+
Transforms universal function call syntax into a method call.
2992+
2993+
.Before
2994+
```rust
2995+
fn main() {
2996+
std::ops::Add::add┃(1, 2);
2997+
}
2998+
```
2999+
3000+
.After
3001+
```rust
3002+
fn main() {
3003+
1.add(2);
3004+
}
3005+
```
3006+
3007+
28873008
[discrete]
28883009
=== `unwrap_block`
28893010
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unwrap_block.rs#L11[unwrap_block.rs]

generated_config.adoc

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,41 +109,41 @@ Compilation target override (target triple).
109109
--
110110
Unsets `#[cfg(test)]` for the specified crates.
111111
--
112-
[[rust-analyzer.checkOnSave.allTargets]]rust-analyzer.checkOnSave.allTargets (default: `true`)::
112+
[[rust-analyzer.checkOnSave]]rust-analyzer.checkOnSave (default: `true`)::
113113
+
114114
--
115-
Check all targets and tests (`--all-targets`).
115+
Run the check command for diagnostics on save.
116116
--
117-
[[rust-analyzer.checkOnSave.command]]rust-analyzer.checkOnSave.command (default: `"check"`)::
117+
[[rust-analyzer.check.allTargets]]rust-analyzer.check.allTargets (default: `true`)::
118118
+
119119
--
120-
Cargo command to use for `cargo check`.
120+
Check all targets and tests (`--all-targets`).
121121
--
122-
[[rust-analyzer.checkOnSave.enable]]rust-analyzer.checkOnSave.enable (default: `true`)::
122+
[[rust-analyzer.check.command]]rust-analyzer.check.command (default: `"check"`)::
123123
+
124124
--
125-
Run specified `cargo check` command for diagnostics on save.
125+
Cargo command to use for `cargo check`.
126126
--
127-
[[rust-analyzer.checkOnSave.extraArgs]]rust-analyzer.checkOnSave.extraArgs (default: `[]`)::
127+
[[rust-analyzer.check.extraArgs]]rust-analyzer.check.extraArgs (default: `[]`)::
128128
+
129129
--
130130
Extra arguments for `cargo check`.
131131
--
132-
[[rust-analyzer.checkOnSave.extraEnv]]rust-analyzer.checkOnSave.extraEnv (default: `{}`)::
132+
[[rust-analyzer.check.extraEnv]]rust-analyzer.check.extraEnv (default: `{}`)::
133133
+
134134
--
135135
Extra environment variables that will be set when running `cargo check`.
136136
Extends `#rust-analyzer.cargo.extraEnv#`.
137137
--
138-
[[rust-analyzer.checkOnSave.features]]rust-analyzer.checkOnSave.features (default: `null`)::
138+
[[rust-analyzer.check.features]]rust-analyzer.check.features (default: `null`)::
139139
+
140140
--
141141
List of features to activate. Defaults to
142142
`#rust-analyzer.cargo.features#`.
143143

144144
Set to `"all"` to pass `--all-features` to Cargo.
145145
--
146-
[[rust-analyzer.checkOnSave.invocationLocation]]rust-analyzer.checkOnSave.invocationLocation (default: `"workspace"`)::
146+
[[rust-analyzer.check.invocationLocation]]rust-analyzer.check.invocationLocation (default: `"workspace"`)::
147147
+
148148
--
149149
Specifies the working directory for running checks.
@@ -153,7 +153,7 @@ Specifies the working directory for running checks.
153153
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
154154
is set.
155155
--
156-
[[rust-analyzer.checkOnSave.invocationStrategy]]rust-analyzer.checkOnSave.invocationStrategy (default: `"per_workspace"`)::
156+
[[rust-analyzer.check.invocationStrategy]]rust-analyzer.check.invocationStrategy (default: `"per_workspace"`)::
157157
+
158158
--
159159
Specifies the invocation strategy to use when running the checkOnSave command.
@@ -162,18 +162,20 @@ If `once` is set, the command will be executed once.
162162
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
163163
is set.
164164
--
165-
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
165+
[[rust-analyzer.check.noDefaultFeatures]]rust-analyzer.check.noDefaultFeatures (default: `null`)::
166166
+
167167
--
168168
Whether to pass `--no-default-features` to Cargo. Defaults to
169169
`#rust-analyzer.cargo.noDefaultFeatures#`.
170170
--
171-
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
171+
[[rust-analyzer.check.overrideCommand]]rust-analyzer.check.overrideCommand (default: `null`)::
172172
+
173173
--
174174
Override the command rust-analyzer uses instead of `cargo check` for
175175
diagnostics on save. The command is required to output json and
176-
should therefore include `--message-format=json` or a similar option.
176+
should therefore include `--message-format=json` or a similar option
177+
(if your client supports the `colorDiagnosticOutput` experimental
178+
capability, you can use `--message-format=json-diagnostic-rendered-ansi`).
177179

178180
If you're changing this because you're using some tool wrapping
179181
Cargo, you might also want to change
@@ -190,7 +192,7 @@ cargo check --workspace --message-format=json --all-targets
190192
```
191193
.
192194
--
193-
[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`)::
195+
[[rust-analyzer.check.targets]]rust-analyzer.check.targets (default: `null`)::
194196
+
195197
--
196198
Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
@@ -469,6 +471,11 @@ Whether to show inlay hints for type adjustments.
469471
--
470472
Whether to hide inlay hints for type adjustments outside of `unsafe` blocks.
471473
--
474+
[[rust-analyzer.inlayHints.expressionAdjustmentHints.mode]]rust-analyzer.inlayHints.expressionAdjustmentHints.mode (default: `"prefix"`)::
475+
+
476+
--
477+
Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc).
478+
--
472479
[[rust-analyzer.inlayHints.lifetimeElisionHints.enable]]rust-analyzer.inlayHints.lifetimeElisionHints.enable (default: `"never"`)::
473480
+
474481
--
@@ -619,6 +626,11 @@ Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
619626
--
620627
Whether to show `can't find Cargo.toml` error message.
621628
--
629+
[[rust-analyzer.numThreads]]rust-analyzer.numThreads (default: `null`)::
630+
+
631+
--
632+
How many worker threads in the main loop. The default `null` means to pick automatically.
633+
--
622634
[[rust-analyzer.procMacro.attributes.enable]]rust-analyzer.procMacro.attributes.enable (default: `true`)::
623635
+
624636
--

generated_diagnostic.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ This diagnostic is shown for builtin macros which are not yet implemented by rus
108108

109109

110110
=== unlinked-file
111-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/unlinked_file.rs#L17[unlinked_file.rs]
111+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-diagnostics/src/handlers/unlinked_file.rs#L19[unlinked_file.rs]
112112

113113
This diagnostic is shown for files that are not included in any crate, or files that are part of
114114
crates rust-analyzer failed to discover. The file will not have IDE features available.

generated_features.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ Navigates to the declaration of an identifier.
271271
This is the same as `Go to Definition` with the following exceptions:
272272
- outline modules will navigate to the `mod name;` item declaration
273273
- trait assoc items will navigate to the assoc item of the trait declaration opposed to the trait impl
274+
- fields in patterns will navigate to the field declaration of the struct, union or variant
274275

275276

276277
=== Go to Definition
@@ -340,7 +341,7 @@ image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917
340341

341342

342343
=== Inlay Hints
343-
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L287[inlay_hints.rs]
344+
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L345[inlay_hints.rs]
344345

345346
rust-analyzer shows additional information inline with the source code.
346347
Editors usually render this using read-only virtual text snippets interspersed with code.

0 commit comments

Comments
 (0)