Skip to content

Changelog #73 #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions generated_assists.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,37 @@ impl Default for Example {
```


[discrete]
=== `generate_deref`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_deref.rs#L15[generate_deref.rs]

Generate `Deref` impl using the given struct field.

.Before
```rust
struct A;
struct B {
┃a: A
}
```

.After
```rust
struct A;
struct B {
a: A
}

impl std::ops::Deref for B {
type Target = A;

fn deref(&self) -> &Self::Target {
&self.a
}
}
```


[discrete]
=== `generate_derive`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_derive.rs#L9[generate_derive.rs]
Expand Down
6 changes: 6 additions & 0 deletions generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ List of features to activate.
--
Run build scripts (`build.rs`) for more precise code analysis.
--
[[rust-analyzer.cargo.useRustcWrapperForBuildScripts]]rust-analyzer.cargo.useRustcWrapperForBuildScripts (default: `true`)::
+
--
Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
avoid compiling unnecessary things.
--
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
+
--
Expand Down
8 changes: 4 additions & 4 deletions generated_diagnostic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This diagnostic is triggered if the `break` keyword is used outside of a loop.


=== inactive-code
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L126[diagnostics.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L127[diagnostics.rs]

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

Expand All @@ -18,7 +18,7 @@ This diagnostic is triggered if an item name doesn't follow https://doc.rust-lan


=== macro-error
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L199[diagnostics.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L200[diagnostics.rs]

This diagnostic is shown for macro expansion errors.

Expand Down Expand Up @@ -101,7 +101,7 @@ This diagnostic is triggered when `.filter_map(..).next()` is used, rather than


=== unlinked-file
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/diagnostics/unlinked_file.rs#L23[unlinked_file.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/diagnostics/unlinked_file.rs#L24[unlinked_file.rs]

This diagnostic is shown for files that are not included in any crate, or files that are part of
crates rust-analyzer failed to discover. The file will not have IDE features available.
Expand Down Expand Up @@ -133,7 +133,7 @@ This diagnostic is triggered if rust-analyzer is unable to discover referred mod


=== unresolved-proc-macro
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L159[diagnostics.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L160[diagnostics.rs]

This diagnostic is shown when a procedural macro can not be found. This usually means that
procedural macro support is simply disabled (and hence is only a weak hint instead of an error),
Expand Down
3 changes: 2 additions & 1 deletion generated_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,14 @@ image::https://user-images.githubusercontent.com/48062697/113065576-04298180-91b


=== On Enter
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L15[on_enter.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/typing/on_enter.rs#L16[on_enter.rs]

rust-analyzer can override kbd:[Enter] key to make it smarter:

- kbd:[Enter] inside triple-slash comments automatically inserts `///`
- kbd:[Enter] in the middle or after a trailing space in `//` inserts `//`
- kbd:[Enter] inside `//!` doc comments automatically inserts `//!`
- kbd:[Enter] after `{` indents contents and closing `}` of single-line block

This action needs to be assigned to shortcut explicitly.

Expand Down
2 changes: 1 addition & 1 deletion manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ include::./generated_assists.adoc[]
== Diagnostics

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.
These diagnostics don't respect `#[allow]` or `#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.enableExperimental` or `rust-analyzer.diagnostics.disabled` settings.
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.enableExperimental` or `rust-analyzer.diagnostics.disabled` settings.

include::./generated_diagnostic.adoc[]

Expand Down
52 changes: 52 additions & 0 deletions thisweek/_posts/2021-04-19-changelog-73.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
= Changelog #73
:sectanchors:
:page-layout: post

Commit: commit:4f94bcd611bd3eb7d845ec1d3909f69ed065699c[] +
Release: release:2021-04-19[]

== Sponsors

**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or
https://github.com/sponsors/rust-analyzer[GitHub Sponsors].

== New Features

* pr:8467[] (first contribution) add "generate `Deref` impl" assist:
+
image::https://user-images.githubusercontent.com/5489149/115183917-9971b480-a091-11eb-98b0-d847543cde01.gif[]
* pr:8476[] avoid checking the whole project during initial loading.
* pr:8481[], pr:8494[], pr:8498[] improve performance by delaying computation of fixes for diagnostics.
* pr:8354[] distinguish between different operators in semantic highlighting.

== Fixes

* pr:8478[] don't spam repeated error messages when `cargo check` fails.
* pr:8496[] exclude `nightly` tag from `git describe` to really fix version string.
* pr:8489[] indent block expressions on enter:
+
image::https://user-images.githubusercontent.com/1786438/114444123-cb38d600-9bce-11eb-8af2-8e8d1c0f9908.gif[]
* pr:8415[] fix faulty assertion when extracting function with macro call.
* pr:8432[] consider outer scopes' ``#[allow]``s in `decl_check`.
* pr:8526[] do not show flyimports in trait or impl declarations.
* pr:8510[] move cursor position when using item movers.
* pr:8536[] (first contribution) slightly improve status messages.
* pr:8543[] (first contribution) fix "Fill match arms" issue with single-element tuples.
* pr:8545[] fix primitive shadowing with inner items.
* pr:8539[] do not propose inherent traits in flyimports and import assists.
* pr:8546[] return `CallInfo` for unclosed call expressions.
* pr:8550[] handle extended key-value attributes in MBE.
* pr:8560[] (first contribution) correctly escape characters in doc comments when passed through macros.
* pr:8561[] accept `E<error_number>` notation in doctests.
* pr:8564[] expand `global_asm!` to nothing.
* pr:8569[] support inherent impls in unnamed consts.

== Internal Improvements

* pr:8483[] clarify who rls-2.0 wg really is.
* pr:8499[] don't use `#[should_panic]` for tests.
* pr:8500[] fix flakiness of "accidentally quadratic?" test.
* pr:8507[] follow test style guide in `typing.rs`.
* pr:8514[], pr:8515[] add more profiling spans to type inference.
* pr:8549[] fix `TestDB::module_at_position` with submodules.
* pr:8551[] (first contribution) nail down `rowan` version.