Skip to content

Changelog #69 #94

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
Mar 22, 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
39 changes: 36 additions & 3 deletions generated_assists.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ fn qux(bar: Bar, baz: Baz) {}

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

Extracts selected statements into new function.

Expand Down Expand Up @@ -840,6 +840,39 @@ impl<T: Clone> Ctx<T> {
```


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

Generates is_empty implementation from the len method.

.Before
```rust
struct MyStruct { data: Vec<String> }

impl MyStruct {
p┃ub fn len(&self) -> usize {
self.data.len()
}
}
```

.After
```rust
struct MyStruct { data: Vec<String> }

impl MyStruct {
pub fn len(&self) -> usize {
self.data.len()
}

pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
```


[discrete]
=== `generate_new`
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_new.rs#L11[generate_new.rs]
Expand Down Expand Up @@ -1136,7 +1169,7 @@ fn handle(action: Action) {

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

Moves inline type bounds to a where clause.

Expand Down Expand Up @@ -1242,7 +1275,7 @@ fn main() {

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

If the name is unresolved, provides all possible qualified paths for it.

Expand Down
2 changes: 1 addition & 1 deletion generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
--
Whether to show `can't find Cargo.toml` error message.
--
[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`)::
[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `true`)::
+
--
Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
Expand Down
2 changes: 1 addition & 1 deletion generated_diagnostic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ This diagnostic is triggered if rust-analyzer is unable to discover imported mod
=== unresolved-macro-call
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/diagnostics.rs#L98[diagnostics.rs]

This diagnostic is triggered if rust-analyzer is unable to resolove path to a
This diagnostic is triggered if rust-analyzer is unable to resolve the path to a
macro in a macro invocation.


Expand Down
18 changes: 9 additions & 9 deletions generated_features.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//Generated file, do not edit by hand, see `xtask/src/codegen`
=== Annotations
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/annotations.rs#L17[annotations.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/annotations.rs#L18[annotations.rs]

Provides user with annotations above items for looking up references or impl blocks
and running/debugging binaries.
Expand Down Expand Up @@ -91,7 +91,7 @@ This is a standard LSP feature and not a protocol extension.


=== File Structure
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/file_structure.rs#L18[file_structure.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/file_structure.rs#L25[file_structure.rs]

Provides a tree of the symbols defined in the file. Can be used to

Expand Down Expand Up @@ -137,7 +137,7 @@ The following postfix snippets are available:


=== Go to Definition
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs#L16[goto_definition.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_definition.rs#L19[goto_definition.rs]

Navigates to the definition of an identifier.

Expand All @@ -149,7 +149,7 @@ Navigates to the definition of an identifier.


=== Go to Implementation
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_implementation.rs#L7[goto_implementation.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/goto_implementation.rs#L10[goto_implementation.rs]

Navigates to the impl block of structs, enums or traits. Also implemented as a code lens.

Expand Down Expand Up @@ -215,7 +215,7 @@ Join selected lines into one, smartly fixing up whitespace, trailing commas, and


=== Magic Completions
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_completion/src/lib.rs#L31[lib.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_completion/src/lib.rs#L34[lib.rs]

In addition to usual reference completion, rust-analyzer provides some ✨magic✨
completions as well:
Expand Down Expand Up @@ -334,7 +334,7 @@ Add the following to `settings.json`:


=== Parent Module
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/parent_module.rs#L11[parent_module.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/parent_module.rs#L12[parent_module.rs]

Navigates to the parent module of the current module.

Expand All @@ -346,7 +346,7 @@ Navigates to the parent module of the current module.


=== Related Tests
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L115[runnables.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L131[runnables.rs]

Provides a sneak peek of all tests where the current item is used.

Expand Down Expand Up @@ -374,7 +374,7 @@ Renames the item below the cursor and all of its references


=== Run
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L92[runnables.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L94[runnables.rs]

Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
location**. Super useful for repeatedly running just a single test. Do bind this
Expand Down Expand Up @@ -501,7 +501,7 @@ be parsed as a valid structural search and replace rule.


=== Workspace Symbol
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/symbol_index.rs#L142[symbol_index.rs]
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/symbol_index.rs#L148[symbol_index.rs]

Uses fuzzy-search to find types, modules and functions by name across your
project and dependencies. This is **the** most useful feature, which improves code
Expand Down
6 changes: 2 additions & 4 deletions manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,9 @@ If the LSP binary is not available, GNOME Builder can install it when opening a

=== Eclipse IDE

Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.

Support for Rust development in the Eclipse IDE is provided by link:https://github.com/eclipse/corrosion[Eclipse Corrosion].
While it currently uses RLS as default, you can successfully configure it so the IDE will use `rust-analyzer` instead.
To do so, with an Eclipse IDE where Corrosion is installed, just go to __Window > Preferences > Rust__ and edit the __Path to Rust Language Server__ entry to reference the path to `rust-analyzer`.
If available in PATH or in some standard location, `rust-analyzer` is detected and powers editing of Rust files without further configuration.
If `rust-analyzer` is not detected, Corrosion will prompt you for configuration of your Rust toolchain and language server with a link to the __Window > Preferences > Rust__ preference page; from here a button allows to download and configure `rust-analyzer`, but you can also reference another installation.
You'll need to close and reopen all .rs and Cargo files, or to restart the IDE, for this change to take effect.

== Configuration
Expand Down
113 changes: 113 additions & 0 deletions thisweek/_posts/2021-03-22-changelog-69.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
= Changelog #69
:sectanchors:
:page-layout: post

Commit: commit:858ad554374a8b1ad67692558a0878391abfdd86[] +
Release: release:2021-03-22[]

== Sponsors

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

== New Features

* pr:8000[] add HIR formatter infra and use it for hover text:
+
image::https://user-images.githubusercontent.com/308347/111968849-49d7b180-8b02-11eb-8f0d-4b7bc38d5247.png[]

* pr:8032[] enable proc macros by default (use `rust-analyzer.procMacro.enable` to disable them).
* pr:7966[] add diagnostic for files missing from the module tree.
* pr:7975[] include regions in file structure:
+
image::https://user-images.githubusercontent.com/308347/111967940-4bed4080-8b01-11eb-940a-fc8f81d5673b.gif[]

* pr:8021[] enable reference searching for built-in types:
+
image::https://user-images.githubusercontent.com/3757771/111132711-f69db600-8579-11eb-8c90-22fd6862d11f.png[]

* pr:8020[] power up "Go to implementation":
+
image::https://user-images.githubusercontent.com/3757771/111144403-52bb0700-8587-11eb-9205-7a2a5b8b75a3.png[]

* pr:7992[], pr:8036[] improve completions and completion sorting:
+
image::https://user-images.githubusercontent.com/22216761/111018680-0e551e80-836f-11eb-94b1-c88336ecbc6e.png[]
+
image::https://user-images.githubusercontent.com/22216761/111189395-45941d00-8573-11eb-871b-09186b35cbb9.png[]

* pr:8037[], pr:8040[] add "Generate `is_empty` method from `len` method" assist.
* pr:7900[] show function parameters in completion detail.
* pr:8060[] improve "Move bounds" assist.
* pr:8071[], pr:8086[] highlight intra-doc links in doc comments:
+
image::https://user-images.githubusercontent.com/308347/111969661-27926380-8b03-11eb-8e78-70dc95e137fd.png[]

* pr:8124[] add lifetime completion:
+
image::https://user-images.githubusercontent.com/3757771/111886437-c9b02f80-89cd-11eb-9bee-340f1536b0de.gif[]

* pr:8127[] add label completion:
+
image::https://user-images.githubusercontent.com/3757771/111900839-07946e80-8a35-11eb-90f6-a47943e7501d.gif[]

* pr:8131[] add smart case lookup into flyimport completion:
+
image::https://user-images.githubusercontent.com/308347/111970038-8821a080-8b03-11eb-9bca-b4e06aac565b.png[]

+
image::https://user-images.githubusercontent.com/308347/111970065-8e178180-8b03-11eb-8a33-8aa245401e8a.png[]

== Fixes

* pr:8025[] fix resolution of incomplete fields.
* pr:8015[] make runnable detection more resilient to out-of-tree modules.
* pr:7970[] fix incorrect diagnostics for failing built in macros.
* pr:8044[] fix macro expansion for statements without semicolon.
* pr:8048[] fix missing unresolved macro diagnostic in function body.
* pr:8066[] handle `#[cfg]` on call arguments.
* pr:8068[] handle `#[cfg]` on function parameters.
* pr:8067[] check whether cursor is on and not between intra-doc links in `goto_definition`.
* pr:8073[] improve diagnostic when including nonexistent file.
* pr:8075[] fix `use crate as <name>;` imports.
* pr:8078[] support `#[cfg]` on all associated items.
* pr:8082[] properly handle inner recursive `macro_rules!`.
* pr:8088[] fix "Go to definition" and highlighting for function-like proc macros.
* pr:8089[] update info about Eclipse Corrosion.
* pr:8094[] fix infinite recursion when computing diagnostics for inner items.
* pr:8083[] track source file IDs in source mapping of `Attrs`.
* pr:8108[] fix handling of `#![cfg]` in outline module files.
* pr:8122[] make bare underscore token an `Ident` rather than `Punct` in proc-macro.
* pr:8123[] do not display unqualified associated item completions.
* pr:8128[] expand legacy-scoped macro during collection.
* pr:8133[] fix `salsa` panic.
* pr:8134[] (first contribution) fix module resolution in `include!`ed files.
* pr:8137[] fix box pattern inference panic.


== Internal Improvements

* pr:7498[] switch to a mutable syntax tree implementation.
* pr:8023[] move `StructureNodeKind` from `ide_db` to `ide`.
* pr:8022[] fix some `clippy` performance warnings.
* pr:8026[] simplify source maps for fields.
* pr:8018[], pr:8038[] make `Ty` wrap `TyKind` in an `Arc`.
* pr:8008[] clean up `CompletionContext::expected_type`.
* pr:8030[] add `diesel` to the benchmark suite.
* pr:8029[] enable thread-local coverage mark support.
* pr:8035[] `unqualfied_path` completions aren't responsible for variant pattern completions.
* pr:8028[] prepare for returning parents in the "Locate parent module" command.
* pr:8039[] use `SmallVec` for `Substs`.
* pr:8046[] add `match` vs. `if let ... else` entry to the style guide.
* pr:8034[] implement `Crate::transitive_reverse_dependencies`.
* pr:8042[] (first contribution) add `rustc-perf` version to the metrics JSON.
* pr:8061[] structural editing API can automatically insert whitespace in simple cases.
* pr:8059[] support `cfg_attr` in doc-comment syntax highlighting.
* pr:8065[] handle block doc comments better.
* pr:8069[] support highlight injection in block doc comments.
* pr:8080[] change `ItemTree` API to accomodate creating an `ItemTree` per block expression.
* pr:8087[] make MacroDefId's `AstId` mandatory when possible.
* pr:8093[] record custom derive helpers in `DefMap`.
* pr:8097[] parse `extended_key_value_attributes`.
* pr:8112[] revamp `hir_def` attribute API.
* pr:8125[] don't use an untyped `String` for ActiveParam tracking.