Skip to content

Commit 817024d

Browse files
committed
Changelog #79
1 parent 0693ee8 commit 817024d

File tree

6 files changed

+214
-41
lines changed

6 files changed

+214
-41
lines changed

generated_assists.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ enum Action { Move { distance: u32 }, Stop }
522522

523523
fn handle(action: Action) {
524524
match action {
525-
┃Action::Move { distance } => {}
526-
Action::Stop => {}
525+
┃Action::Move { distance } => todo!(),
526+
Action::Stop => todo!(),
527527
}
528528
}
529529
```

generated_config.adoc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ This should be the reverse mapping of what is passed to `rustc` as `--remap-path
161161
[[rust-analyzer.diagnostics.warningsAsHint]]rust-analyzer.diagnostics.warningsAsHint (default: `[]`)::
162162
+
163163
--
164-
List of warnings that should be displayed with info severity.
164+
List of warnings that should be displayed with hint severity.
165165

166-
The warnings will be indicated by a blue squiggly underline in code
167-
and a blue icon in the `Problems Panel`.
166+
The warnings will be indicated by faded text or three dots in code
167+
and will not show up in the `Problems Panel`.
168168
--
169169
[[rust-analyzer.diagnostics.warningsAsInfo]]rust-analyzer.diagnostics.warningsAsInfo (default: `[]`)::
170170
+
171171
--
172-
List of warnings that should be displayed with hint severity.
172+
List of warnings that should be displayed with info severity.
173173

174-
The warnings will be indicated by faded text or three dots in code
175-
and will not show up in the `Problems Panel`.
174+
The warnings will be indicated by a blue squiggly underline in code
175+
and a blue icon in the `Problems Panel`.
176176
--
177177
[[rust-analyzer.files.watcher]]rust-analyzer.files.watcher (default: `"client"`)::
178178
+
@@ -346,6 +346,13 @@ Additional arguments to `rustfmt`.
346346
Advanced option, fully override the command rust-analyzer uses for
347347
formatting.
348348
--
349+
[[rust-analyzer.rustfmt.enableRangeFormatting]]rust-analyzer.rustfmt.enableRangeFormatting (default: `false`)::
350+
+
351+
--
352+
Enables the use of rustfmt's unstable range formatting command for the
353+
`textDocument/rangeFormatting` request. The rustfmt option is unstable and only
354+
available on a nightly build.
355+
--
349356
[[rust-analyzer.workspace.symbol.search.scope]]rust-analyzer.workspace.symbol.search.scope (default: `"workspace"`)::
350357
+
351358
--

generated_diagnostic.adoc

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
//Generated file, do not edit by hand, see `xtask/src/codegen`
22
=== break-outside-of-loop
3-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L248[diagnostics.rs]
3+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L250[diagnostics.rs]
44

55
This diagnostic is triggered if the `break` keyword is used outside of a loop.
66

77

88
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
99

1010
== inactive-code
11-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L127[diagnostics.rs]
11+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L129[diagnostics.rs]
1212

1313
This diagnostic is shown for code with inactive `#[cfg]` attributes.
1414

1515

1616
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
1717

1818
== incorrect-ident-case
19-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L379[diagnostics.rs]
19+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L381[diagnostics.rs]
2020

2121
This diagnostic is triggered if an item name doesn't follow https://doc.rust-lang.org/1.0.0/style/style/naming/README.html[Rust naming convention].
2222

2323

2424
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
2525

2626
== macro-error
27-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L200[diagnostics.rs]
27+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L202[diagnostics.rs]
2828

2929
This diagnostic is shown for macro expansion errors.
3030

3131

3232
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
3333

3434
== mismatched-arg-count
35-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L296[diagnostics.rs]
35+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L298[diagnostics.rs]
3636

3737
This diagnostic is triggered if a function is invoked with an incorrect amount of arguments.
3838

3939

4040
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
4141

4242
== missing-match-arm
43-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L164[diagnostics.rs]
43+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L166[diagnostics.rs]
4444

4545
This diagnostic is triggered if `match` block is missing one or more match arms.
4646

4747

4848
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
4949

5050
== missing-ok-or-some-in-tail-expr
51-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L189[diagnostics.rs]
51+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L191[diagnostics.rs]
5252

5353
This diagnostic is triggered if a block that should return `Result` returns a value not wrapped in `Ok`,
5454
or if a block that should return `Option` returns a value not wrapped in `Some`.
@@ -65,7 +65,7 @@ fn foo() -> Result<u8, ()> {
6565
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
6666

6767
== missing-pat-fields
68-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L115[diagnostics.rs]
68+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L117[diagnostics.rs]
6969

7070
This diagnostic is triggered if pattern lacks some fields that exist in the corresponding structure.
7171

@@ -85,7 +85,7 @@ if let A { a } = a {
8585
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
8686

8787
== missing-structure-fields
88-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L68[diagnostics.rs]
88+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L70[diagnostics.rs]
8989

9090
This diagnostic is triggered if record lacks some fields that exist in the corresponding structure.
9191

@@ -101,23 +101,23 @@ let a = A { a: 10 };
101101
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
102102

103103
== missing-unsafe
104-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L272[diagnostics.rs]
104+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L274[diagnostics.rs]
105105

106106
This diagnostic is triggered if an operation marked as `unsafe` is used outside of an `unsafe` function or block.
107107

108108

109109
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
110110

111111
== no-such-field
112-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L41[diagnostics.rs]
112+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L43[diagnostics.rs]
113113

114114
This diagnostic is triggered if created structure does not have field provided in record.
115115

116116

117117
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
118118

119119
== replace-filter-map-next-with-find-map
120-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L420[diagnostics.rs]
120+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/diagnostics.rs#L422[diagnostics.rs]
121121

122122
This diagnostic is triggered when `.filter_map(..).next()` is used, rather than the more concise `.find_map(..)`.
123123

@@ -134,23 +134,15 @@ crates rust-analyzer failed to discover. The file will not have IDE features ava
134134
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
135135

136136
== unresolved-extern-crate
137-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L43[diagnostics.rs]
137+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L48[diagnostics.rs]
138138

139139
This diagnostic is triggered if rust-analyzer is unable to discover referred extern crate.
140140

141141

142-
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
143-
144-
== unresolved-import
145-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L67[diagnostics.rs]
146-
147-
This diagnostic is triggered if rust-analyzer is unable to discover imported module.
148-
149-
150142
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
151143

152144
== unresolved-macro-call
153-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L98[diagnostics.rs]
145+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L100[diagnostics.rs]
154146

155147
This diagnostic is triggered if rust-analyzer is unable to resolve the path to a
156148
macro in a macro invocation.
@@ -159,15 +151,15 @@ macro in a macro invocation.
159151
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
160152

161153
== unresolved-module
162-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L18[diagnostics.rs]
154+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L23[diagnostics.rs]
163155

164156
This diagnostic is triggered if rust-analyzer is unable to discover referred module.
165157

166158

167159
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
168160

169161
== unresolved-proc-macro
170-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L160[diagnostics.rs]
162+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir/src/diagnostics.rs#L162[diagnostics.rs]
171163

172164
This diagnostic is shown when a procedural macro can not be found. This usually means that
173165
procedural macro support is simply disabled (and hence is only a weak hint instead of an error),

generated_features.adoc

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ image::https://user-images.githubusercontent.com/48062697/113020670-b7c34f00-917
156156
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
157157

158158
== Folding
159-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/folding_ranges.rs#L30[folding_ranges.rs]
159+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/folding_ranges.rs#L31[folding_ranges.rs]
160160

161161
Defines folding regions for curly braced blocks, runs of consecutive import
162162
statements, and `region` / `endregion` comment markers.
@@ -219,7 +219,7 @@ image::https://user-images.githubusercontent.com/48062697/113065566-02f85480-91b
219219
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
220220

221221
== Go to Type Definition
222-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_type_definition.rs#L6[goto_type_definition.rs]
222+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_type_definition.rs#L7[goto_type_definition.rs]
223223

224224
Navigates to the type of an identifier.
225225

@@ -518,13 +518,107 @@ image::https://user-images.githubusercontent.com/48062697/113065583-055aae80-91b
518518
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting.rs#L42[syntax_highlighting.rs]
519519

520520
rust-analyzer highlights the code semantically.
521-
For example, `bar` in `foo::Bar` might be colored differently depending on whether `Bar` is an enum or a trait.
522-
rust-analyzer does not specify colors directly, instead it assigns tag (like `struct`) and a set of modifiers (like `declaration`) to each token.
521+
For example, `Bar` in `foo::Bar` might be colored differently depending on whether `Bar` is an enum or a trait.
522+
rust-analyzer does not specify colors directly, instead it assigns a tag (like `struct`) and a set of modifiers (like `declaration`) to each token.
523523
It's up to the client to map those to specific colors.
524524

525525
The general rule is that a reference to an entity gets colored the same way as the entity itself.
526526
We also give special modifier for `mut` and `&mut` local variables.
527527

528+
529+
.Token Tags
530+
531+
Rust-analyzer currently emits the following token tags:
532+
533+
- For items:
534+
+
535+
[horizontal]
536+
enum:: Emitted for enums.
537+
function:: Emitted for free-standing functions.
538+
macro:: Emitted for macros.
539+
method:: Emitted for associated functions, also knowns as methods.
540+
namespace:: Emitted for modules.
541+
struct:: Emitted for structs.
542+
trait:: Emitted for traits.
543+
typeAlias:: Emitted for type aliases and `Self` in `impl`s.
544+
union:: Emitted for unions.
545+
546+
- For literals:
547+
+
548+
[horizontal]
549+
boolean:: Emitted for the boolean literals `true` and `false`.
550+
character:: Emitted for character literals.
551+
number:: Emitted for numeric literals.
552+
string:: Emitted for string literals.
553+
escapeSequence:: Emitted for escaped sequences inside strings like `\n`.
554+
formatSpecifier:: Emitted for format specifiers `{:?}` in `format!`-like macros.
555+
556+
- For operators:
557+
+
558+
[horizontal]
559+
operator:: Emitted for general operators.
560+
arithmetic:: Emitted for the arithmetic operators `+`, `-`, `*`, `/`, `+=`, `-=`, `*=`, `/=`.
561+
bitwise:: Emitted for the bitwise operators `|`, `&`, `!`, `^`, `|=`, `&=`, `^=`.
562+
comparison:: Emitted for the comparison operators `>`, `<`, `==`, `>=`, `<=`, `!=`.
563+
logical:: Emitted for the logical operators `||`, `&&`, `!`.
564+
565+
- For punctuation:
566+
+
567+
[horizontal]
568+
punctuation:: Emitted for general punctuation.
569+
angle:: Emitted for `<>` angle brackets.
570+
brace:: Emitted for `{}` braces.
571+
bracket:: Emitted for `[]` brackets.
572+
parenthesis:: Emitted for `()` parentheses.
573+
colon:: Emitted for the `:` token.
574+
comma:: Emitted for the `,` token.
575+
dot:: Emitted for the `.` token.
576+
Semi:: Emitted for the `;` token.
577+
578+
//-
579+
580+
[horizontal]
581+
attribute:: Emitted for attributes.
582+
builtinType:: Emitted for builtin types like `u32`, `str` and `f32`.
583+
comment:: Emitted for comments.
584+
constParameter:: Emitted for const parameters.
585+
enumMember:: Emitted for enum variants.
586+
generic:: Emitted for generic tokens that have no mapping.
587+
keyword:: Emitted for keywords.
588+
label:: Emitted for labels.
589+
lifetime:: Emitted for lifetimes.
590+
parameter:: Emitted for non-self function parameters.
591+
property:: Emitted for struct and union fields.
592+
selfKeyword:: Emitted for the self function parameter and self path-specifier.
593+
typeParameter:: Emitted for type parameters.
594+
unresolvedReference:: Emitted for unresolved references, names that rust-analyzer can't find the definition of.
595+
variable:: Emitted for locals, constants and statics.
596+
597+
598+
.Token Modifiers
599+
600+
Token modifiers allow to style some elements in the source code more precisely.
601+
602+
Rust-analyzer currently emits the following token modifiers:
603+
604+
[horizontal]
605+
async:: Emitted for async functions and the `async` and `await` keywords.
606+
attribute:: Emitted for tokens inside attributes.
607+
callable:: Emitted for locals whose types implements one of the `Fn*` traits.
608+
constant:: Emitted for consts.
609+
consuming:: Emitted for locals that are being consumed when use in a function call.
610+
controlFlow:: Emitted for control-flow related tokens, this includes the `?` operator.
611+
declaration:: Emitted for names of definitions, like `foo` in `fn foo() {}`.
612+
documentation:: Emitted for documentation comments.
613+
injected:: Emitted for doc-string injected highlighting like rust source blocks in documentation.
614+
intraDocLink:: Emitted for intra doc links in doc-strings.
615+
library:: Emitted for items that are defined outside of the current crate.
616+
mutable:: Emitted for mutable locals and statics.
617+
static:: Emitted for "static" functions, also known as functions that do not take a `self` param, as well as statics and consts.
618+
trait:: Emitted for associated trait items.
619+
unsafe:: Emitted for unsafe operations, like unsafe function calls, as well as the `unsafe` token.
620+
621+
528622
image::https://user-images.githubusercontent.com/48062697/113164457-06cfb980-9239-11eb-819b-0f93e646acf8.png[]
529623
image::https://user-images.githubusercontent.com/48062697/113187625-f7f50100-9250-11eb-825e-91c58f236071.png[]
530624

manual.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,18 @@ $ cargo xtask install --server
151151
== rust-analyzer Language Server Binary
152152

153153
Other editors generally require the `rust-analyzer` binary to be in `$PATH`.
154-
You can download the pre-built binary from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page.
155-
Typically, you then need to rename the binary for your platform, e.g. `rust-analyzer-mac` if you're on Mac OS, to `rust-analyzer` and make it executable in addition to moving it into a directory in your `$PATH`.
154+
You can download pre-built binaries from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page.
155+
You will need to uncompress and rename the binary for your platform, e.g. from `rust-analyzer-aarch64-apple-darwin.gz` on Mac OS to `rust-analyzer`, make it executable, then move it into a directory in your `$PATH`.
156156

157-
On Linux to install the `rust-analyzer` binary into `~/.local/bin`, this commands could be used
157+
On Linux to install the `rust-analyzer` binary into `~/.local/bin`, these commands should work:
158158

159159
[source,bash]
160160
----
161-
$ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ~/.local/bin/rust-analyzer
161+
$ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer
162162
$ chmod +x ~/.local/bin/rust-analyzer
163163
----
164164

165-
Ensure `~/.local/bin` is listed in the `$PATH` variable.
165+
Make sure that `~/.local/bin` is listed in the `$PATH` variable and use the appropriate URL if you're not on a `x86-64` system.
166166

167167
Alternatively, you can install it from source using the command below.
168168
You'll need the latest stable version of the Rust toolchain.

0 commit comments

Comments
 (0)