Skip to content

Commit 5916173

Browse files
committed
Changelog #108
1 parent 4e03ff4 commit 5916173

File tree

5 files changed

+161
-9
lines changed

5 files changed

+161
-9
lines changed

generated_assists.adoc

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ fn handle(action: Action) {
16101610

16111611
[discrete]
16121612
=== `move_arm_cond_to_match_guard`
1613-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L76[move_guard.rs]
1613+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L77[move_guard.rs]
16141614

16151615
Moves if expression from match arm body into a guard.
16161616

@@ -1682,7 +1682,7 @@ fn t() {}
16821682

16831683
[discrete]
16841684
=== `move_guard_to_arm_body`
1685-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L8[move_guard.rs]
1685+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L9[move_guard.rs]
16861686

16871687
Moves match guard into match arm body.
16881688

@@ -1871,6 +1871,23 @@ fn main() {
18711871
```
18721872

18731873

1874+
[discrete]
1875+
=== `reformat_number_literal`
1876+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/number_representation.rs#L7[number_representation.rs]
1877+
1878+
Adds or removes seprators from integer literal.
1879+
1880+
.Before
1881+
```rust
1882+
const _: i32 = 1012345┃;
1883+
```
1884+
1885+
.After
1886+
```rust
1887+
const _: i32 = 1_012_345;
1888+
```
1889+
1890+
18741891
[discrete]
18751892
=== `remove_dbg`
18761893
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/remove_dbg.rs#L9[remove_dbg.rs]
@@ -2042,7 +2059,7 @@ fn main() {
20422059

20432060
[discrete]
20442061
=== `replace_derive_with_manual_impl`
2045-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs#L22[replace_derive_with_manual_impl.rs]
2062+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs#L23[replace_derive_with_manual_impl.rs]
20462063

20472064
Converts a `derive` impl into a manual one.
20482065

generated_config.adoc

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,47 @@ Only applies when `#rust-analyzer.completion.addCallParenthesis#` is set.
141141
--
142142
Whether to add parenthesis when completing functions.
143143
--
144-
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets (default: `{}`)::
144+
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets (default: `{
145+
"Arc::new": {
146+
"postfix": "arc",
147+
"body": "Arc::new(${receiver})",
148+
"requires": "std::sync::Arc",
149+
"description": "Put the expression into an `Arc`",
150+
"scope": "expr"
151+
},
152+
"Rc::new": {
153+
"postfix": "rc",
154+
"body": "Rc::new(${receiver})",
155+
"requires": "std::rc::Rc",
156+
"description": "Put the expression into an `Rc`",
157+
"scope": "expr"
158+
},
159+
"Box::pin": {
160+
"postfix": "pinbox",
161+
"body": "Box::pin(${receiver})",
162+
"requires": "std::boxed::Box",
163+
"description": "Put the expression into a pinned `Box`",
164+
"scope": "expr"
165+
},
166+
"Ok": {
167+
"postfix": "ok",
168+
"body": "Ok(${receiver})",
169+
"description": "Wrap the expression in a `Result::Ok`",
170+
"scope": "expr"
171+
},
172+
"Err": {
173+
"postfix": "err",
174+
"body": "Err(${receiver})",
175+
"description": "Wrap the expression in a `Result::Err`",
176+
"scope": "expr"
177+
},
178+
"Some": {
179+
"postfix": "some",
180+
"body": "Some(${receiver})",
181+
"description": "Wrap the expression in an `Option::Some`",
182+
"scope": "expr"
183+
}
184+
}`)::
145185
+
146186
--
147187
Custom completion snippets.

generated_features.adoc

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Displays the ItemTree of the currently open file, for debugging.
174174

175175

176176
=== Expand Macro Recursively
177-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/expand_macro.rs#L15[expand_macro.rs]
177+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/expand_macro.rs#L16[expand_macro.rs]
178178

179179
Shows the full macro expansion of the macro at current cursor.
180180

@@ -862,8 +862,55 @@ The `body` field also has access to placeholders as visible in the example as `$
862862
These placeholders take the form of `$number` or `${number:placeholder_text}` which can be traversed as tabstop in ascending order starting from 1,
863863
with `$0` being a special case that always comes last.
864864

865-
There is also a special placeholder, `${receiver}`, which will be replaced by the receiver expression for postfix snippets, or nothing in case of normal snippets.
866-
It does not act as a tabstop.
865+
There is also a special placeholder, `${receiver}`, which will be replaced by the receiver expression for postfix snippets, or a `$0` tabstop in case of normal snippets.
866+
This replacement for normal snippets allows you to reuse a snippet for both post- and prefix in a single definition.
867+
868+
For the VSCode editor, rust-analyzer also ships with a small set of defaults which can be removed
869+
by overwriting the settings object mentioned above, the defaults are:
870+
[source,json]
871+
----
872+
{
873+
"Arc::new": {
874+
"postfix": "arc",
875+
"body": "Arc::new(${receiver})",
876+
"requires": "std::sync::Arc",
877+
"description": "Put the expression into an `Arc`",
878+
"scope": "expr"
879+
},
880+
"Rc::new": {
881+
"postfix": "rc",
882+
"body": "Rc::new(${receiver})",
883+
"requires": "std::rc::Rc",
884+
"description": "Put the expression into an `Rc`",
885+
"scope": "expr"
886+
},
887+
"Box::pin": {
888+
"postfix": "pinbox",
889+
"body": "Box::pin(${receiver})",
890+
"requires": "std::boxed::Box",
891+
"description": "Put the expression into a pinned `Box`",
892+
"scope": "expr"
893+
},
894+
"Ok": {
895+
"postfix": "ok",
896+
"body": "Ok(${receiver})",
897+
"description": "Wrap the expression in a `Result::Ok`",
898+
"scope": "expr"
899+
},
900+
"Err": {
901+
"postfix": "err",
902+
"body": "Err(${receiver})",
903+
"description": "Wrap the expression in a `Result::Err`",
904+
"scope": "expr"
905+
},
906+
"Some": {
907+
"postfix": "some",
908+
"body": "Some(${receiver})",
909+
"description": "Wrap the expression in an `Option::Some`",
910+
"scope": "expr"
911+
}
912+
}
913+
----
867914

868915

869916
=== View Crate Graph

manual.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ The server binary is stored in:
7474
* macOS: `~/Library/Application\ Support/Code/User/globalStorage/matklad.rust-analyzer`
7575
* Windows: `%APPDATA%\Code\User\globalStorage\matklad.rust-analyzer`
7676

77+
However, if you are using a version of the extension with a bundled server binary and you are not running NixOS, the server binary might be instead running from: `~/.vscode/extensions/matklad.rust-analyzer-VERSION`.
78+
7779
Note that we only support two most recent versions of VS Code.
7880

7981
==== Updates
@@ -445,7 +447,7 @@ If the date is more than a week ago, it's better to update rust-analyzer version
445447

446448
The next thing to check would be panic messages in rust-analyzer's log.
447449
Log messages are printed to stderr, in VS Code you can see then in the `Output > Rust Analyzer Language Server` tab of the panel.
448-
To see more logs, set `RA_LOG=info` environmental variable.
450+
To see more logs, set the `RA_LOG=info` environment variable, this can be done either by setting the environment variable manually or by using `rust-analyzer.server.extraEnv`, note that both of these approaches require the server to be restarted.
449451

450452
To fully capture LSP messages between the editor and the server, set `"rust-analyzer.trace.server": "verbose"` config and check
451453
`Output > Rust Analyzer Language Server Trace`.
@@ -624,7 +626,7 @@ Relative paths are interpreted relative to `rust-project.json` file location or
624626

625627
See https://github.com/rust-analyzer/rust-project.json-example for a small example.
626628

627-
You can set `RA_LOG` environmental variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.
629+
You can set the `RA_LOG` environment variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.
628630

629631
Note that calls to `cargo check` are disabled when using `rust-project.json` by default, so compilation errors and warnings will no longer be sent to your LSP client. To enable these compilation errors you will need to specify explicitly what command rust-analyzer should run to perform the checks using the `checkOnSave.overrideCommand` configuration. As an example, the following configuration explicitly sets `cargo check` as the `checkOnSave` command.
630632

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
= Changelog #108
2+
:sectanchors:
3+
:page-layout: post
4+
5+
Commit: commit:0add6e95e58633fde2fff0bccaf6c7d71ebc130f[] +
6+
Release: release:2021-12-20[]
7+
8+
== Sponsors
9+
10+
**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or
11+
https://github.com/sponsors/rust-analyzer[GitHub Sponsors].
12+
13+
== New Features
14+
15+
* pr:11035[] include clippy lint groups in autocomplete:
16+
+
17+
video::https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov[]
18+
* pr:10998[] add number representation assists:
19+
+
20+
image::https://user-images.githubusercontent.com/462486/145726792-47700215-26f2-4fdc-9520-63d1487901e5.png[]
21+
+
22+
image::https://user-images.githubusercontent.com/462486/145726802-f528a2f7-9159-41d3-b459-fc3fae033e60.png[]
23+
* pr:11053[] (possibly breaking) publish platform-specific Code extensions.
24+
25+
26+
== Fixes
27+
28+
* pr:11054[] (first contribution) don't trim twice in `Unwrap block`.
29+
* pr:11017[] (first contribution) support `Move condition to guard` with an `else` branch.
30+
* pr:11030[] add missing comma in `Move condition to guard`.
31+
* pr:11043[] fix incorrect `mismatched argument count` diagnostic with `std::arch` functions.
32+
* pr:11050[] show primitive docs when hovering `fn` keyword inside function pointer type.
33+
* pr:11004[] infer associated methods in local scope.
34+
* pr:11040[] don't duplicate attribute completions.
35+
* pr:11000[] insert whitespace into associated items for `Implement missing members` for macro-generated structs.
36+
* pr:11002[] add support for v6 macro metadata format for recent nightly support.
37+
38+
39+
== Internal Improvements
40+
41+
* pr:10527[] remove a few snippet completions, replace them with user snippets definitions in VSCode.
42+
* pr:11046[] move all lexing to the parser crate.
43+
* pr:11009[] extract doc-links tests into a separate module.
44+
* pr:11021[] use default XCode version on MacOS 11 builders.
45+
* pr:11029[] refactor release workflow to reduce duplication, upgrade to MacOS 11 builders, set target version to 10.15.
46+
* pr:11047[] prepare Code extension for server bundling.

0 commit comments

Comments
 (0)