Skip to content

Commit

Permalink
Changelog #168
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Feb 13, 2023
1 parent 8fa475a commit 5a17127
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 12 deletions.
31 changes: 30 additions & 1 deletion generated_assists.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
//! Generated by `sourcegen_assists_docs`, do not edit by hand.

[discrete]
=== `add_braces`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/add_braces.rs#L8[add_braces.rs]

Adds braces to lambda and match arm expressions.

.Before
```rust
fn foo(n: i32) -> i32 {
match n {
1 =>┃ n + 1,
_ => 0
}
}
```

.After
```rust
fn foo(n: i32) -> i32 {
match n {
1 => {
n + 1
},
_ => 0
}
}
```


[discrete]
=== `add_explicit_type`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/add_explicit_type.rs#L7[add_explicit_type.rs]
Expand Down Expand Up @@ -1717,7 +1746,7 @@ fn main() {

[discrete]
=== `inline_macro`
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_macro.rs#L5[inline_macro.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_macro.rs#L6[inline_macro.rs]

Takes a macro and inlines it one step.

Expand Down
13 changes: 13 additions & 0 deletions generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ Relative path to the sysroot, or "discover" to try to automatically find it via

Unsetting this disables sysroot loading.

This option does not take effect until rust-analyzer is restarted.
--
[[rust-analyzer.cargo.sysrootSrc]]rust-analyzer.cargo.sysrootSrc (default: `null`)::
+
--
Relative path to the sysroot library sources. If left unset, this will default to
`{cargo.sysroot}/lib/rustlib/src/rust/library`.

This option does not take effect until rust-analyzer is restarted.
--
[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
Expand Down Expand Up @@ -219,6 +227,11 @@ with `self` prefixed to them when inside a method.
--
Whether to add parenthesis and argument snippets when completing function.
--
[[rust-analyzer.completion.limit]]rust-analyzer.completion.limit (default: `null`)::
+
--
Maximum number of completions to return. If `None`, the limit is infinite.
--
[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
+
--
Expand Down
2 changes: 1 addition & 1 deletion generated_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917


=== Inlay Hints
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L336[inlay_hints.rs]
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L343[inlay_hints.rs]

rust-analyzer shows additional information inline with the source code.
Editors usually render this using read-only virtual text snippets interspersed with code.
Expand Down
33 changes: 23 additions & 10 deletions manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,6 @@ https://docs.helix-editor.com/[Helix] supports LSP by default.
However, it won't install `rust-analyzer` automatically.
You can follow instructions for installing <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.

=== Crates

There is a package named `ra_ap_rust_analyzer` available on https://crates.io/crates/ra_ap_rust-analyzer[crates.io], for someone who wants to use it programmatically.

For more details, see https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/publish.yml[the publish workflow].

=== Visual Studio 2022

There are multiple rust-analyzer extensions for Visual Studio 2022 on Windows:
Expand Down Expand Up @@ -577,6 +571,17 @@ https://github.com/sourcegear/rust-vs-extension[GitHub (docs, issues, discussion
* Free (no-cost)
* Supports all editions of Visual Studio 2022 on Windows: Community, Professional, or Enterprise

=== Lapce

https://lapce.dev/[Lapce] has a Rust plugin which you can install directly.
Unfortunately, it downloads an old version of `rust-analyzer`, but you can set the server path under Settings.

=== Crates

There is a package named `ra_ap_rust_analyzer` available on https://crates.io/crates/ra_ap_rust-analyzer[crates.io], for someone who wants to use it programmatically.

For more details, see https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/publish.yml[the publish workflow].

== Troubleshooting

Start with looking at the rust-analyzer version.
Expand Down Expand Up @@ -768,14 +773,18 @@ See https://github.com/rust-analyzer/rust-project.json-example for a small examp

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

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.
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 `rust-analyzer.check.overrideCommand` configuration.
As an example, the following configuration explicitly sets `cargo check` as the `check` command.

[source,json]
----
{ "rust-analyzer.checkOnSave.overrideCommand": ["cargo", "check", "--message-format=json"] }
{ "rust-analyzer.check.overrideCommand": ["cargo", "check", "--message-format=json"] }
----

The `checkOnSave.overrideCommand` requires the command specified to output json error messages for rust-analyzer to consume. The `--message-format=json` flag does this for `cargo check` so whichever command you use must also output errors in this format. See the <<Configuration>> section for more information.
`check.overrideCommand` requires the command specified to output json error messages for rust-analyzer to consume.
The `--message-format=json` flag does this for `cargo check` so whichever command you use must also output errors in this format.
See the <<Configuration>> section for more information.

== Security

Expand Down Expand Up @@ -816,6 +825,10 @@ include::./generated_assists.adoc[]
While most errors and warnings provided by rust-analyzer come from the `cargo check` integration, there's a growing number of diagnostics implemented using rust-analyzer's own analysis.
Some of these diagnostics don't respect `\#[allow]` or `\#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.experimental.enable` or `rust-analyzer.diagnostics.disabled` settings.

=== Clippy

To run `cargo clippy` instead of `cargo check`, you can set `"rust-analyzer.check.command": "clippy"`.

include::./generated_diagnostic.adoc[]

== Editor Features
Expand Down Expand Up @@ -948,7 +961,7 @@ Also note that a full runnable name is something like *run bin_or_example_name*,

Instead of relying on the built-in `cargo check`, you can configure Code to run a command in the background and use the `$rustc-watch` problem matcher to generate inline error markers from its output.

To do this you need to create a new https://code.visualstudio.com/docs/editor/tasks[VS Code Task] and set `rust-analyzer.checkOnSave.enable: false` in preferences.
To do this you need to create a new https://code.visualstudio.com/docs/editor/tasks[VS Code Task] and set `"rust-analyzer.checkOnSave": false` in preferences.

For example, if you want to run https://crates.io/crates/cargo-watch[`cargo watch`] instead, you might add the following to `.vscode/tasks.json`:

Expand Down
40 changes: 40 additions & 0 deletions thisweek/_posts/2023-02-13-changelog-168.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
= Changelog #168
:sectanchors:
:experimental:
:page-layout: post

Commit: commit:646f97385709fab31db2f10661125c0bbbda6b7c[] +
Release: release:2023-02-13[] (`0.3.1402`)

== New Features

* pr:14095[] (first contribution) add `unsafe` postfix completions.
* pr:14098[] (first contribution) add support for `DidChangeWorkspaceFolders` notifications.
* pr:13991[] add an "Add braces: assist:
+
image::https://user-images.githubusercontent.com/4973437/213783924-7c8a8ab5-6a52-4d80-837c-cf2a9b56f061.gif["Screen recording showing an assist that adds braces around the bodies of a closure and a `match` arm"]
* pr:14087[], pr:14094[] support computing layout of RPIT.
* pr:13986[] add a setting to limit the number of completions.
* pr:14127[] build `i686-pc-windows-msvc` binaries.
* pr:14135[] add Lapce installation instructions.
* pr:14134[] add clippy configuration section to the manual.

== Fixes

* pr:14114[] (first contribution) insert spaces when inlining macros.
* pr:14084[] fix parsing of nested tuple field accesses (in a cursed way).
* pr:14092[] don't panic on broken syntax trees in adjustment inlay hints.
* pr:14099[] properly use location links for type hints of `impl Future` and its associated type.
* pr:14103[] don't insert a semicolon when typing `=` if parse errors are encountered.
* pr:14110[] fix completions after functions with no bodies.
* pr:14111[] hide proc macro server version detection errors.
* pr:14125[] don't render bind pattern inlay hints for constants.
* pr:14116[] render discriminant inlay hints for mixed variants if at least one discriminant is specified.
* pr:13975[] suppress extra indent after the end of field and function chains.

== Internal Improvements

* pr:14091[] support sysroot library source being defined inside the workspace.
* pr:14100[] allow specifying what proc-macro server to run in `rust_analyzer::load_cargo`.
* pr:14119[] remove a few allocations in `hir_ty::utils`.
* pr:14090[] unify language configuration folding markers with server behaviour.

0 comments on commit 5a17127

Please sign in to comment.