Skip to content

Commit 375603a

Browse files
committed
Changelog #118
1 parent 61cb76b commit 375603a

File tree

5 files changed

+136
-26
lines changed

5 files changed

+136
-26
lines changed

generated_assists.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub(crate) fn frobnicate() {}
276276

277277
[discrete]
278278
=== `convert_bool_then_to_if`
279-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L134[convert_bool_then.rs]
279+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_bool_then.rs#L133[convert_bool_then.rs]
280280

281281
Converts a `bool::then` method call to an equivalent if expression.
282282

@@ -428,7 +428,7 @@ fn main() {
428428

429429
[discrete]
430430
=== `convert_to_guarded_return`
431-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_to_guarded_return.rs#L20[convert_to_guarded_return.rs]
431+
**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]
432432

433433
Replace a large conditional with a guarded return.
434434

@@ -501,7 +501,7 @@ impl Point {
501501

502502
[discrete]
503503
=== `convert_while_to_loop`
504-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_while_to_loop.rs#L18[convert_while_to_loop.rs]
504+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/convert_while_to_loop.rs#L19[convert_while_to_loop.rs]
505505

506506
Replace a while with a loop.
507507

@@ -648,7 +648,7 @@ fn bar(name: i32) -> i32 {
648648

649649
[discrete]
650650
=== `extract_struct_from_enum_variant`
651-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs#L29[extract_struct_from_enum_variant.rs]
651+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs#L28[extract_struct_from_enum_variant.rs]
652652

653653
Extracts a struct from enum variant.
654654

@@ -1479,7 +1479,7 @@ impl<'a> Cursor<'a> {
14791479

14801480
[discrete]
14811481
=== `invert_if`
1482-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/invert_if.rs#L12[invert_if.rs]
1482+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/invert_if.rs#L13[invert_if.rs]
14831483

14841484
This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}`
14851485
This also works with `!=`. This assist can only be applied with the cursor on `if`.
@@ -1612,7 +1612,7 @@ fn handle(action: Action) {
16121612

16131613
[discrete]
16141614
=== `move_arm_cond_to_match_guard`
1615-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L79[move_guard.rs]
1615+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L69[move_guard.rs]
16161616

16171617
Moves if expression from match arm body into a guard.
16181618

@@ -1684,7 +1684,7 @@ fn t() {}
16841684

16851685
[discrete]
16861686
=== `move_guard_to_arm_body`
1687-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L11[move_guard.rs]
1687+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/move_guard.rs#L8[move_guard.rs]
16881688

16891689
Moves match guard into match arm body.
16901690

@@ -2086,7 +2086,7 @@ impl Debug for S {
20862086

20872087
[discrete]
20882088
=== `replace_if_let_with_match`
2089-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L19[replace_if_let_with_match.rs]
2089+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L24[replace_if_let_with_match.rs]
20902090

20912091
Replaces a `if let` expression with a `match` expression.
20922092

@@ -2146,7 +2146,7 @@ fn compute() -> Option<i32> { None }
21462146

21472147
[discrete]
21482148
=== `replace_match_with_if_let`
2149-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L160[replace_if_let_with_match.rs]
2149+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L174[replace_if_let_with_match.rs]
21502150

21512151
Replaces a binary `match` with a wildcard pattern and no guards with an `if let` expression.
21522152

generated_config.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ Note that your client must specify the `additionalTextEdits` LSP client capabili
213213
Toggles the additional completions that automatically show method calls and field accesses
214214
with `self` prefixed to them when inside a method.
215215
--
216+
[[rust-analyzer.completion.privateEditable.enable]]rust-analyzer.completion.privateEditable.enable (default: `false`)::
217+
+
218+
--
219+
Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position.
220+
--
216221
[[rust-analyzer.diagnostics.enable]]rust-analyzer.diagnostics.enable (default: `true`)::
217222
+
218223
--

generated_features.adoc

Lines changed: 2 additions & 2 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#L16[expand_macro.rs]
177+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/expand_macro.rs#L15[expand_macro.rs]
178178

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

@@ -312,7 +312,7 @@ image::https://user-images.githubusercontent.com/48062697/113020657-b560f500-917
312312

313313

314314
=== Highlight Related
315-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/highlight_related.rs#L36[highlight_related.rs]
315+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/highlight_related.rs#L38[highlight_related.rs]
316316

317317
Highlights constructs related to the thing under the cursor:
318318
- if on an identifier, highlights all references to that identifier in the current file

manual.adoc

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ To add the sources manually, run the following command:
4040
$ rustup component add rust-src
4141
```
4242

43+
=== Toolchain
44+
45+
Only the latest stable standard library source is officially supported for use with rust-analyzer.
46+
If you are using an older toolchain or have an override set, rust-analyzer may fail to understand the Rust source.
47+
You will either need to update your toolchain or use an older version of rust-analyzer that is compatible with your toolchain.
48+
49+
If you are using an override in your project, you can still force rust-analyzer to use the stable toolchain via the environment variable `RUSTUP_TOOLCHAIN`.
50+
For example, with VS Code or coc-rust-analyzer:
51+
52+
[source,json]
53+
----
54+
{ "rust-analyzer.server.extraEnv": { "RUSTUP_TOOLCHAIN": "stable" } }
55+
----
56+
4357
=== VS Code
4458

4559
This is the best supported editor at the moment.
@@ -86,8 +100,7 @@ It will ask your permission to download the matching language server version bin
86100
===== Nightly
87101

88102
We ship nightly releases for VS Code.
89-
You can opt in to these by switching to the pre-release version in the Code extension page or settings.
90-
To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config:
103+
To help us out by testing the newest code, you can enable pre-release versions in the Code extension page.
91104

92105
==== Manual installation
93106

@@ -240,7 +253,6 @@ The are several LSP client implementations for vim or neovim:
240253
* same configurations as VSCode extension, `rust-analyzer.server.path`, `rust-analyzer.cargo.features` etc.
241254
* same commands too, `rust-analyzer.analyzerStatus`, `rust-analyzer.ssr` etc.
242255
* inlay hints for variables and method chaining, _Neovim Only_
243-
* semantic highlighting is not implemented yet
244256

245257
Note: for code actions, use `coc-codeaction-cursor` and `coc-codeaction-selected`; `coc-codeaction` and `coc-codeaction-line` are unlikely to be useful.
246258

@@ -362,22 +374,19 @@ if executable('rust-analyzer')
362374
endif
363375
----
364376

365-
=== Sublime Text 3
366-
367-
Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
377+
=== Sublime Text
368378

369-
You also need the `LSP` package.
370-
To install it:
379+
==== Sublime Text 4:
380+
* Follow the instructions in link:https://github.com/sublimelsp/LSP-rust-analyzer[LSP-rust-analyzer].
371381

372-
1. If you've never installed a Sublime Text package, install Package Control:
373-
* Open the command palette (Win/Linux: `ctrl+shift+p`, Mac: `cmd+shift+p`)
374-
* Type `Install Package Control`, press enter
375-
2. In the command palette, run `Package control: Install package`, and in the list that pops up, type `LSP` and press enter.
382+
NOTE: Install link:https://packagecontrol.io/packages/LSP-file-watcher-chokidar[LSP-file-watcher-chokidar] to enable file watching (`workspace/didChangeWatchedFiles`).
376383

377-
Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up to enable the rust-analyzer LSP.
378-
The latter means that rust-analyzer is enabled by default in Rust projects.
384+
==== Sublime Text 3:
385+
* Install the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
386+
* Install the link:https://packagecontrol.io/packages/LSP[LSP package].
387+
* From the command palette, run `LSP: Enable Language Server Globally` and select `rust-analyzer`.
379388

380-
If it worked, you should see "rust-analyzer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available.
389+
If it worked, you should see "rust-analyzer, Line X, Column Y" on the left side of the status bar, and after waiting a bit, functionalities like tooltips on hovering over variables should become available.
381390

382391
If you get an error saying `No such file or directory: 'rust-analyzer'`, see the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>> section on installing the language server binary.
383392

@@ -427,6 +436,40 @@ Then click on apply, and restart the LSP server for your rust project.
427436

428437
https://gitlab.com/cppit/jucipp[juCi++] has built-in support for the language server protocol, and since version 1.7.0 offers installation of both Rust and rust-analyzer when opening a Rust file.
429438

439+
=== Kakoune
440+
441+
https://kakoune.org/[Kakoune] supports LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`].
442+
Follow the https://github.com/kak-lsp/kak-lsp#installation[instructions] to install `kak-lsp`.
443+
To configure `kak-lsp`, refer to the https://github.com/kak-lsp/kak-lsp#configuring-kak-lsp[configuration section] which is basically about copying the https://github.com/kak-lsp/kak-lsp/blob/master/kak-lsp.toml[configuration file] in the right place (latest versions should use `rust-analyzer` by default).
444+
445+
Finally, you need to configure Kakoune to talk to `kak-lsp` (see https://github.com/kak-lsp/kak-lsp#usage[Usage section]).
446+
A basic configuration will only get you LSP but you can also activate inlay diagnostics and auto-formatting on save.
447+
The following might help you get all of this.
448+
449+
[source,txt]
450+
----
451+
eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak.
452+
hook global WinSetOption filetype=rust %{
453+
# Enable LSP
454+
lsp-enable-window
455+
456+
# Auto-formatting on save
457+
hook window BufWritePre .* lsp-formatting-sync
458+
459+
# Configure inlay hints (only on save)
460+
hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints
461+
hook -once -always window WinSetOption filetype=.* %{
462+
remove-hooks window rust-inlay-hints
463+
}
464+
}
465+
----
466+
467+
=== Helix
468+
469+
https://docs.helix-editor.com/[Helix] supports LSP by default.
470+
However, it won't install `rust-analyzer` automatically.
471+
You can follow instructions for installing <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
472+
430473
== Troubleshooting
431474

432475
Start with looking at the rust-analyzer version.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
= Changelog #118
2+
:sectanchors:
3+
:page-layout: post
4+
5+
Commit: commit:4e72700e38421a12993fe5fa5c33d712652bc6c8[] +
6+
Release: release:2022-02-28[]
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:11549[] (first contribution) add support for `concat_bytes!`.
16+
* pr:11481[] display parameter names when hovering over a function pointer alias:
17+
+
18+
image::https://user-images.githubusercontent.com/308347/155932516-2459a4e5-dae8-40bc-a094-adc64d48025e.png[]
19+
* pr:11513[] expand `derive` attribute into a pseudo expansion:
20+
+
21+
image::https://user-images.githubusercontent.com/3757771/155107902-abca028d-f985-408a-b2ec-97aa34e8ae83.png[]
22+
+
23+
image::https://user-images.githubusercontent.com/3757771/155108170-b0e81d69-3533-4ad3-8f81-c34ce87dc46b.gif[]
24+
* pr:11462[] highlight continue points:
25+
+
26+
image::https://user-images.githubusercontent.com/308347/155933288-3e1a1e43-6dcc-4ced-9385-f469d9a39a99.png[]
27+
* pr:11375[] add support for `if`- and `while`- `let` chains.
28+
* pr:11538[] disable private-editable completions by default (controlled by `rust-analyzer.completion.privateEditable.enable`).
29+
30+
== Fixes
31+
32+
* pr:11461[] (first-contribution) filter generics in `Extract struct from enum variant`.
33+
* pr:11531[] (first contribution) make `fill_match_arms` assist handle `+#[doc(hidden)]+` and `#[non_exhaustive]`.
34+
* pr:11535[] (first contribution) add install instructions for Kakoune and Helix.
35+
* pr:11524[] (first contribution) state that only the latest stable toolchain is officially supported.
36+
* pr:11424[] pass required features to `cargo` when using the `Run` action.
37+
* pr:11540[] resolve private fields in type inference.
38+
* pr:11490[] fix doc test formatting with generics.
39+
* pr:11525[] drop generic args in path in `replace_qualified_name_with_use`.
40+
* pr:11562[] don't emit `unresolvedReference` highlight tags in unlinked files.
41+
* pr:11516[] don't count commas when looking for the derive attribute in diagnostics.
42+
* pr:11517[] fix qualified record literal completion triggering too eagerly.
43+
* pr:11522[] make code lenses work on attributed items.
44+
* pr:11530[] fix `expand_macro` always expanding the first listed derive.
45+
* pr:11472[] fix visibility in `impl` items and change `pub(crate)` to `pub` in `extract_module`.
46+
* pr:11552[] properly display `$crate` in hovers.
47+
* pr:11554[] fix type mismatches with `unreachable!` in Rust 1.59.
48+
* pr:11565[] fix body selection in `while` loops with block conditions.
49+
* pr:11567[] fix `if` with block conditions.
50+
* pr:11514[] update manual for `coc-rust-analyzer`.
51+
52+
== Internal Improvements
53+
54+
* pr:11573[] reuse buffer in `TextEdit::apply` and add tests.
55+
* pr:11550[] refactor autoderef/method resolution.
56+
* pr:11455[] handle proc-macro functions as the proc-macro they resolve to.
57+
* pr:11527[] split unresolved proc-macro error out of `mbe`.
58+
* pr:11536[] resolve functions as proc-macros via `FileAstId`.
59+
* pr:11537[] reduce visibility of proc-macros to `pub(crate)` in nameres.
60+
* pr:11548[] add CSV output to `analysis-stats`.
61+
* pr:11564[] clean up highlighting tests.
62+
* pr:11560[] update `url` to make `webrender` build when computing metrics.

0 commit comments

Comments
 (0)