]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd runnables::related_tests
vsrs [Sat, 27 Feb 2021 14:59:52 +0000 (17:59 +0300)]
Add runnables::related_tests

3 years agoMerge #7566
bors[bot] [Sat, 27 Feb 2021 14:39:22 +0000 (14:39 +0000)]
Merge #7566

7566: Add benchmark tests for mbe r=matklad a=edwin0cheng

This PR add more real world tests dumped from `rust-analyzer analysis-stats .` to benchmark its performance.

cc #7513

r? @matklad

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agoMerge #7677
bors[bot] [Sat, 27 Feb 2021 14:29:10 +0000 (14:29 +0000)]
Merge #7677

7677: More enum matching r=yoshuawuyts a=jDomantas

* Renamed existing `generate_enum_match_method` to `generate_enum_is_variant`
* Added two similar assists to generate `into_` and `as_` methods.
* Made all of them general enough to work on record and tuple variants too.

For `as_` method generation there's room to improve:
* Right now it always returns `Option<&Field>`, even though `Option<Field>` would be nicer when `Field: Copy`. I don't know how to check if the field type implements `Copy`. If given suggestions I could try to fix this in a follow-up pr.
* `&String` could be replaced with `&str`, `&Box<_>` with `&_`, and probably some more. I don't know what would be a good way to do that.

Closes #7604

Co-authored-by: Domantas Jadenkus <djadenkus@gmail.com>
3 years agogenerate try_into instead of into
Domantas Jadenkus [Tue, 16 Feb 2021 21:43:21 +0000 (23:43 +0200)]
generate try_into instead of into

3 years agorename generate_enum_match_method file to match assist name
Domantas Jadenkus [Mon, 15 Feb 2021 21:28:57 +0000 (23:28 +0200)]
rename generate_enum_match_method file to match assist name

3 years agomove into_ and as_ generation to a separate file
Domantas Jadenkus [Mon, 15 Feb 2021 21:25:33 +0000 (23:25 +0200)]
move into_ and as_ generation to a separate file

3 years agocargo fmt
Domantas Jadenkus [Sun, 14 Feb 2021 17:28:22 +0000 (19:28 +0200)]
cargo fmt

3 years agoadd generate_enum_as_method assist
Domantas Jadenkus [Sun, 14 Feb 2021 17:26:37 +0000 (19:26 +0200)]
add generate_enum_as_method assist

3 years agodeduplicate some
Domantas Jadenkus [Sun, 14 Feb 2021 10:15:20 +0000 (12:15 +0200)]
deduplicate some

3 years agoadd generate_enum_into_method assist
Domantas Jadenkus [Sun, 14 Feb 2021 10:06:42 +0000 (12:06 +0200)]
add generate_enum_into_method assist

3 years agomake generate_enum_is_method work on any variants
Domantas Jadenkus [Sun, 14 Feb 2021 09:33:46 +0000 (11:33 +0200)]
make generate_enum_is_method work on any variants

3 years agorename existing assist to generate_enum_is_method
Domantas Jadenkus [Sun, 14 Feb 2021 09:09:56 +0000 (11:09 +0200)]
rename existing assist to generate_enum_is_method

3 years agoMerge #7794
bors[bot] [Fri, 26 Feb 2021 18:10:07 +0000 (18:10 +0000)]
Merge #7794

7794: Disable "Flip comma" assist inside a macro call r=Veykril a=greenhat

Fix #7693

Disables "Flip comma" assist if called inside a macro call.

Co-authored-by: Denys Zadorozhnyi <denys@zadorozhnyi.com>
3 years agoDisable "Flip comma" assist inside a macro call
Denys Zadorozhnyi [Fri, 26 Feb 2021 17:12:53 +0000 (19:12 +0200)]
Disable "Flip comma" assist inside a macro call

3 years agoMerge #7792
bors[bot] [Fri, 26 Feb 2021 07:29:05 +0000 (07:29 +0000)]
Merge #7792

7792: docs(ide_assists): Change remaining occurrences of importMergeBehaviour to importMergeBehavior r=lnicola a=SanchithHegde

Co-authored-by: Sanchith Hegde <sanchith.hegde01@gmail.com>
3 years agodocs(ide_assists): Change importMergeBehaviour to importMergeBehavior
Sanchith Hegde [Fri, 26 Feb 2021 07:08:12 +0000 (12:38 +0530)]
docs(ide_assists): Change importMergeBehaviour to importMergeBehavior

3 years agoMerge #7786
bors[bot] [Thu, 25 Feb 2021 15:35:37 +0000 (15:35 +0000)]
Merge #7786

7786: bump crates r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agobump crates
kjeremy [Thu, 25 Feb 2021 15:34:48 +0000 (10:34 -0500)]
bump crates

3 years agoMerge #7785
bors[bot] [Thu, 25 Feb 2021 14:56:29 +0000 (14:56 +0000)]
Merge #7785

7785: :arrow_up: crates r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years ago:arrow_up: crates
Aleksey Kladov [Thu, 25 Feb 2021 14:55:50 +0000 (17:55 +0300)]
:arrow_up: crates

3 years agoAdd benchmark test for mbe
Edwin Cheng [Fri, 5 Feb 2021 11:57:32 +0000 (19:57 +0800)]
Add benchmark test for mbe

3 years agoMerge #7741
bors[bot] [Wed, 24 Feb 2021 19:24:22 +0000 (19:24 +0000)]
Merge #7741

7741: Add convert_for_to_iter_for_each assist r=mattyhall a=mattyhall

Implements one direction of #7681

I wonder if this tries to guess too much at the right thing here. A common pattern is:

```rust
let col = vec![1, 2, 3];
for v in &mut col {
  *v *= 2;
}
// equivalent to:
col.iter_mut().for_each(|v| *v *= 2);
```

I've tried to detect this case by checking if the expression after the `in` is a (mutable) reference and if not inserting iter()/iter_mut(). This is just a convention used in the stdlib however, so could sometimes be wrong. I'd be happy to make an improvement for this, but not sure what would be best. A few options spring to mind:
1. Only allow this for types that are known to have iter/iter_mut (ie stdlib types)
2. Try to check if iter/iter_mut exists and they return the right iterator type
3. Don't try to do this and just add `.into_iter()` to whatever is after `in`

Co-authored-by: Matt Hall <matthew@quickbeam.me.uk>
3 years agoAddress further review comments
Matt Hall [Wed, 24 Feb 2021 19:23:12 +0000 (19:23 +0000)]
Address further review comments

* Use known names for iter/iter_mut method (simplifies checking if the
  method exists
* Extract code to check assist with fixtures to function

3 years agoMerge #7719
bors[bot] [Wed, 24 Feb 2021 12:19:22 +0000 (12:19 +0000)]
Merge #7719

7719: De Morgan's Law assist now correctly parenthesizes binary expressions. r=Veykril a=lbrande

Closes #7694 by parenthesizing binary expressions that are negated.

Co-authored-by: lbrande <lovbra00@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #7775
bors[bot] [Wed, 24 Feb 2021 11:03:39 +0000 (11:03 +0000)]
Merge #7775

7775: Fix typo. r=Veykril a=boxdot

Co-authored-by: boxdot <d@zerovolt.org>
3 years agoAdd tests for apply_demorgan
Lukas Wirth [Wed, 24 Feb 2021 10:42:32 +0000 (11:42 +0100)]
Add tests for apply_demorgan

3 years agoDe Morgan's Law assist now correctly inverts <, <=, >, >=.
lbrande [Mon, 22 Feb 2021 15:23:42 +0000 (16:23 +0100)]
De Morgan's Law assist now correctly inverts <, <=, >, >=.

3 years agoDe Morgan's Law assist now correctly parenthesizes binary expressions.
lbrande [Fri, 19 Feb 2021 13:48:07 +0000 (14:48 +0100)]
De Morgan's Law assist now correctly parenthesizes binary expressions.

3 years agoFix typo.
boxdot [Wed, 24 Feb 2021 10:56:48 +0000 (11:56 +0100)]
Fix typo.

3 years agoMerge #7772
bors[bot] [Tue, 23 Feb 2021 22:32:47 +0000 (22:32 +0000)]
Merge #7772

7772: Pickup ConstReference patterns in FindUsages r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoPickup ConstReference patterns in FindUsages
Lukas Wirth [Tue, 23 Feb 2021 22:31:07 +0000 (23:31 +0100)]
Pickup ConstReference patterns in FindUsages

3 years agoAddress review comments
Matt Hall [Tue, 23 Feb 2021 19:19:48 +0000 (19:19 +0000)]
Address review comments

* Move code to build replacement into closure
* Look for iter/iter_mut methods on types behind reference

3 years agoAdd convert_for_to_iter_for_each assist
Matt Hall [Sun, 21 Feb 2021 17:36:37 +0000 (17:36 +0000)]
Add convert_for_to_iter_for_each assist

3 years agoMerge #7770
bors[bot] [Tue, 23 Feb 2021 18:02:40 +0000 (18:02 +0000)]
Merge #7770

7770: reliable memory usage during benchmarking r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoreliable memory usage during benchmarking
Aleksey Kladov [Tue, 23 Feb 2021 18:02:17 +0000 (21:02 +0300)]
reliable memory usage during benchmarking

3 years agoMerge #7769
bors[bot] [Tue, 23 Feb 2021 17:18:58 +0000 (17:18 +0000)]
Merge #7769

7769: Update mio r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate mio
kjeremy [Tue, 23 Feb 2021 17:16:56 +0000 (12:16 -0500)]
Update mio

3 years agoMerge #7768
bors[bot] [Tue, 23 Feb 2021 17:06:57 +0000 (17:06 +0000)]
Merge #7768

7768: Fix visibility computation when inside a block expression r=jonas-schievink a=jonas-schievink

fixes https://github.com/rust-analyzer/rust-analyzer/issues/7728

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoMerge #7766
bors[bot] [Tue, 23 Feb 2021 16:56:21 +0000 (16:56 +0000)]
Merge #7766

7766: Update our vscode npm packages r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agois_visible_from_def_map: handle block expressions
Jonas Schievink [Tue, 23 Feb 2021 16:56:16 +0000 (17:56 +0100)]
is_visible_from_def_map: handle block expressions

3 years agoUpdate our vscode npm packages
kjeremy [Tue, 23 Feb 2021 16:39:19 +0000 (11:39 -0500)]
Update our vscode npm packages

3 years agoAdd test
Jonas Schievink [Tue, 23 Feb 2021 13:54:01 +0000 (14:54 +0100)]
Add test

3 years agoMerge #7759
bors[bot] [Mon, 22 Feb 2021 20:28:17 +0000 (20:28 +0000)]
Merge #7759

7759: 7526: Rename ide related crates r=Veykril a=chetankhilosiya

renamed assists -> ide_assists and ssr -> ide_ssr.
the completion crate is already renamed.

Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
3 years ago7526: Renamed create ssr to ide_ssr.
Chetan Khilosiya [Mon, 22 Feb 2021 19:14:58 +0000 (00:44 +0530)]
7526: Renamed create ssr to ide_ssr.

3 years ago7526: Rename crate assists to ide_assists.
Chetan Khilosiya [Mon, 22 Feb 2021 18:47:48 +0000 (00:17 +0530)]
7526: Rename crate assists to ide_assists.

3 years agoMerge #7756
bors[bot] [Mon, 22 Feb 2021 18:23:33 +0000 (18:23 +0000)]
Merge #7756

7756: update tracing-tree r=kjeremy a=kjeremy

Removes some dependencies

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoupdate tidy
kjeremy [Mon, 22 Feb 2021 17:25:02 +0000 (12:25 -0500)]
update tidy

3 years agoupdate tracing-tree
kjeremy [Mon, 22 Feb 2021 17:03:34 +0000 (12:03 -0500)]
update tracing-tree

3 years agoMerge #7753
bors[bot] [Mon, 22 Feb 2021 13:54:53 +0000 (13:54 +0000)]
Merge #7753

7753: Add isize to the list of suffixed integers in typed_integer r=kjeremy a=jonasbb

The missing `isize` in `typed_integers` seems to just be an oversight.

Might fix: #7751

Co-authored-by: Jonas Bushart <jonas@bushart.org>
3 years agoAdd isize to the list of suffixed integers in typed_integer
Jonas Bushart [Mon, 22 Feb 2021 13:33:42 +0000 (14:33 +0100)]
Add isize to the list of suffixed integers in typed_integer

The missing `isize` in `typed_integers` seems to just be an oversight.

Might fix: #7751

3 years agoMerge #7752
bors[bot] [Mon, 22 Feb 2021 13:32:40 +0000 (13:32 +0000)]
Merge #7752

7752: up once_cell r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoup once_cell
kjeremy [Mon, 22 Feb 2021 13:31:33 +0000 (08:31 -0500)]
up once_cell

3 years agoMerge #7749
bors[bot] [Mon, 22 Feb 2021 13:15:04 +0000 (13:15 +0000)]
Merge #7749

7749: Make more common assist easier to ues r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMake more common assist easier to ues
Aleksey Kladov [Mon, 22 Feb 2021 12:18:11 +0000 (15:18 +0300)]
Make more common assist easier to ues

3 years agoMerge #7739
bors[bot] [Sun, 21 Feb 2021 17:34:54 +0000 (17:34 +0000)]
Merge #7739

7739: Bump deps r=lnicola a=lnicola

Closes #7273

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoPin ungrammar
Laurențiu Nicola [Sun, 21 Feb 2021 17:33:55 +0000 (19:33 +0200)]
Pin ungrammar

3 years agoAdd test from #7273
Laurențiu Nicola [Sun, 21 Feb 2021 17:17:06 +0000 (19:17 +0200)]
Add test from #7273

3 years agoBump deps
Laurențiu Nicola [Sun, 21 Feb 2021 17:11:49 +0000 (19:11 +0200)]
Bump deps

3 years agoMerge #7735
bors[bot] [Sun, 21 Feb 2021 00:18:49 +0000 (00:18 +0000)]
Merge #7735

7735: Stop mixing Result and Option with ? in inline_local_variable r=Veykril a=scottmcm

Depending on the discussion in https://github.com/rust-lang/rfcs/pull/3058 this might not end up being necessary, but I think it's a reasonable change regardless.

Co-authored-by: Scott McMurray <scottmcm@users.noreply.github.com>
3 years agoStop mixing Result and Option with ? in inline_local_variable
Scott McMurray [Sat, 20 Feb 2021 22:45:30 +0000 (14:45 -0800)]
Stop mixing Result and Option with ? in inline_local_variable

Depending on the discussion in RFC#3058 this might not end up being necessary, but I think it's a reasonable change regardless.

3 years agoMerge #7732
bors[bot] [Sat, 20 Feb 2021 20:17:14 +0000 (20:17 +0000)]
Merge #7732

7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril

Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects?

Fixes #7683(hopefully for real this time)

I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see https://github.com/Veykril/rust-analyzer/commit/b9d69048451a5f2e9c5a72c800369bbeef36fdcf) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #7733
bors[bot] [Sat, 20 Feb 2021 19:59:43 +0000 (19:59 +0000)]
Merge #7733

7733: Update some crates r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
3 years agoUpdate tests
Jeremy Kolb [Sat, 20 Feb 2021 19:59:05 +0000 (14:59 -0500)]
Update tests

3 years agoDon't write trailing whitespace when formatting empty GenericPredicates
Lukas Wirth [Sat, 20 Feb 2021 19:43:04 +0000 (20:43 +0100)]
Don't write trailing whitespace when formatting empty GenericPredicates

3 years agoUpdate some crates
Jeremy Kolb [Sat, 20 Feb 2021 19:15:26 +0000 (14:15 -0500)]
Update some crates

3 years agoDon't lower TypeBound::Lifetime as GenericPredicate::Error
Lukas Wirth [Sat, 20 Feb 2021 17:51:42 +0000 (18:51 +0100)]
Don't lower TypeBound::Lifetime as GenericPredicate::Error

3 years agoMerge #7729
bors[bot] [Sat, 20 Feb 2021 17:35:37 +0000 (17:35 +0000)]
Merge #7729

7729: Try to detect musl distros in the Code extension r=andylizi a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/7658#issuecomment-782701138

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoMerge #7730
bors[bot] [Sat, 20 Feb 2021 17:12:41 +0000 (17:12 +0000)]
Merge #7730

7730: Fix #7712 retain visibility extracting mod to file r=lnicola a=mattyhall

Co-authored-by: Matt Hall <matthew@quickbeam.me.uk>
3 years agoUse format_to! to make logic a bit nicer
Matt Hall [Sat, 20 Feb 2021 17:11:04 +0000 (17:11 +0000)]
Use format_to! to make logic a bit nicer

3 years agoFix #7712 retain visibility extracting mod to file
Matt Hall [Sat, 20 Feb 2021 16:51:16 +0000 (16:51 +0000)]
Fix #7712 retain visibility extracting mod to file

3 years agoTry to detect musl distros in the Code extension
Laurențiu Nicola [Sat, 20 Feb 2021 16:39:26 +0000 (18:39 +0200)]
Try to detect musl distros in the Code extension

3 years agoMerge #7727
bors[bot] [Sat, 20 Feb 2021 15:31:59 +0000 (15:31 +0000)]
Merge #7727

7727: Remove documentation of obsolete extend selection command r=matklad a=lnicola

Closes #7454

This is available in LSP as `textDocument/selectionRange` and no longer exists as a stand-alone command, so we shouldn't mention it in the manual because it's confusing (it doesn't appear in `package.json`).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoRemove documentation of obsolete extend selection command
Laurențiu Nicola [Sat, 20 Feb 2021 15:06:00 +0000 (17:06 +0200)]
Remove documentation of obsolete extend selection command

3 years agoMerge #7726
bors[bot] [Sat, 20 Feb 2021 14:18:34 +0000 (14:18 +0000)]
Merge #7726

7726: feat(completion): add doc(hidden) completion for attributes r=lnicola a=bnjjj

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agofeat(completion): add doc(hidden) completion for attributes
Benjamin Coenen [Sat, 20 Feb 2021 14:16:05 +0000 (15:16 +0100)]
feat(completion): add doc(hidden) completion for attributes

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #7725
bors[bot] [Sat, 20 Feb 2021 14:07:19 +0000 (14:07 +0000)]
Merge #7725

7725: fix(assist): display where predicates when we want to generate impl r=lnicola a=bnjjj

close #7721

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agofix(assist): display where predicates when we want to generate impl
Benjamin Coenen [Sat, 20 Feb 2021 14:05:01 +0000 (15:05 +0100)]
fix(assist): display where predicates when we want to generate impl

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #7724
bors[bot] [Sat, 20 Feb 2021 11:55:17 +0000 (11:55 +0000)]
Merge #7724

7724: Consider import prefix config settings during flyimports r=SomeoneToIgnore a=SomeoneToIgnore

Fixes #7666

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoConsider import prefix config settings during flyimports
Kirill Bulatov [Sat, 20 Feb 2021 11:53:50 +0000 (13:53 +0200)]
Consider import prefix config settings during flyimports

3 years agoMerge #7723
bors[bot] [Sat, 20 Feb 2021 11:03:15 +0000 (11:03 +0000)]
Merge #7723

7723: Fix typos r=lnicola a=azzamsa

I have checked all the documents inside `docs/` using `grammarly.com`.
There are many suggestions in each document (some of them are false positive). I choose to fix the typos only to avoid lengthy grammar discussions. I would like to suggest to the maintainers to take a look. It is worth it.

IMHO, it better to put the article into `grammarly.com` or `languagetool.org` before pushing :).

Co-authored-by: azzamsa <me@azzamsa.com>
3 years agoFix typos
azzamsa [Sat, 20 Feb 2021 10:53:19 +0000 (17:53 +0700)]
Fix typos

3 years agoMerge #7722
bors[bot] [Sat, 20 Feb 2021 10:49:12 +0000 (10:49 +0000)]
Merge #7722

7722: Fix incorrect missing field diagnostic with box patterns r=Veykril a=lnicola

Closes #7711

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoAdd test
Laurențiu Nicola [Sat, 20 Feb 2021 10:43:52 +0000 (12:43 +0200)]
Add test

3 years agoFix incorrect missing field diagnostic with box patterns
Laurențiu Nicola [Sat, 20 Feb 2021 10:36:17 +0000 (12:36 +0200)]
Fix incorrect missing field diagnostic with box patterns

3 years agoMerge #7707
bors[bot] [Wed, 17 Feb 2021 14:54:55 +0000 (14:54 +0000)]
Merge #7707

7707: rename completion -> ide_completion r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agorename completion -> ide_completion
Aleksey Kladov [Wed, 17 Feb 2021 14:53:31 +0000 (17:53 +0300)]
rename completion -> ide_completion

We don't have completion-related PRs in flight, so lets do it

3 years agoMerge #7706
bors[bot] [Wed, 17 Feb 2021 14:02:07 +0000 (14:02 +0000)]
Merge #7706

7706: Revert "Replace usage of ast::NameOrNameRef with ast::NameLike" r=Veykril a=Veykril

This reverts commit e1dbf43cf85f84c3a7e40f9731fc1f7ac96f8979.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoRevert "Replace usage of ast::NameOrNameRef with ast::NameLike"
Lukas Wirth [Wed, 17 Feb 2021 14:00:44 +0000 (15:00 +0100)]
Revert "Replace usage of ast::NameOrNameRef with ast::NameLike"

This reverts commit e1dbf43cf85f84c3a7e40f9731fc1f7ac96f8979.

3 years agoMerge #7699
bors[bot] [Wed, 17 Feb 2021 13:45:27 +0000 (13:45 +0000)]
Merge #7699

7699: Implement ast::AstNode for NameLike and move it to node_ext r=matklad a=Veykril

With this `search`(and 2 other modules) don't necessarily go through 3 calls of `find_node_at_offset_with_descend` to find the correct node. Also makes the code that searches for NameLikes a bit easier on the eyes imo, though that can be fixed with just a helper function as well so its not that relevant.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #7705
bors[bot] [Wed, 17 Feb 2021 13:17:15 +0000 (13:17 +0000)]
Merge #7705

7705: Show hover info of the definition of ConstReference patterns instead of its type r=Veykril a=Veykril

Closes #7671
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoShow hover info of the definition of ConstReference patterns instead of its type
Lukas Wirth [Wed, 17 Feb 2021 13:14:58 +0000 (14:14 +0100)]
Show hover info of the definition of ConstReference patterns instead of its type

3 years agoReplace usage of ast::NameOrNameRef with ast::NameLike
Lukas Wirth [Wed, 17 Feb 2021 13:02:34 +0000 (14:02 +0100)]
Replace usage of ast::NameOrNameRef with ast::NameLike

3 years agoMerge #7704
bors[bot] [Wed, 17 Feb 2021 11:58:35 +0000 (11:58 +0000)]
Merge #7704

7704: Avoid transmitting unchanged diagnostics r=matklad a=michalmuskala

Reading through the code for diagnostics and observing debug logs, I noticed
that diagnostics are transmitted after every change for every opened file,
even if they haven't changed (especially visible for files with no diagnostics).

This change avoids marking files as "changed" if diagnostics are the same to what
was already sent before. This will only work if diagnostics are always produced in
the same order, but from my limited testing it seems this is the case.

Co-authored-by: Michał Muskała <michal@muskala.eu>
3 years agoAvoid transmitting unchanged diagnostics
Michał Muskała [Wed, 17 Feb 2021 11:38:11 +0000 (12:38 +0100)]
Avoid transmitting unchanged diagnostics

Reading through the code for diagnostics and observing debug logs, I noticed
that diagnostics are transmitted after every change for every opened file,
even if they haven't changed (especially visible for files with no diagnostics).

This change avoids marking files as "changed" if diagnostics are the same to what
was already sent before. This will only work if diagnostics are always produced in
the same order, but from my limited testing it seems this is the case.

3 years agoMerge #7701
bors[bot] [Wed, 17 Feb 2021 09:43:13 +0000 (09:43 +0000)]
Merge #7701

7701: Remove semantic tokens workaround r=SomeoneToIgnore a=kjeremy

Let's try this again.

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoMerge #7703
bors[bot] [Wed, 17 Feb 2021 01:24:25 +0000 (01:24 +0000)]
Merge #7703

7703: Allow comments between newlines in chaining hints r=Veykril a=unratito

Currently, chaining hints are not generated if there are comments between newlines, which is a very common pattern:

```rust
let vec = (0..10)
    // Multiply by 2
    .map(|x| x * 2)
    // Add 3
    .map(|x| x + 3)
    .collect::<Vec<i32>>();
```

Besides, it seems a bit weird that this piece of code generates a chaining hint:

```rust
let vec = (0..10)

    .collect::<Vec<i32>>();
```

But this one doesn't:

```rust
let vec = (0..10)

    // This is a comment

    .collect::<Vec<i32>>();
```

Co-authored-by: Paco Soberón <unratito@gmail.com>
3 years agoMerge #7702
bors[bot] [Wed, 17 Feb 2021 01:02:21 +0000 (01:02 +0000)]
Merge #7702

7702: Remove use of deprecated `std::collections::Bound` r=Veykril a=bstrie

`std::collections::Bound` has been deprecated since Rust 1.26, but due to a bug (https://github.com/rust-lang/rust/issues/82080) it never triggered a visible deprecation warning. Fixing this is being done in https://github.com/rust-lang/rust/pull/82122 , but landing that requires rustc-analyzer to build without triggering any deprecation warnings (https://github.com/rust-lang-ci/rust/runs/1911884006#step:24:19361).

Co-authored-by: bstrie <865233+bstrie@users.noreply.github.com>
3 years agoRemove use of deprecated `std::collections::Bound`
bstrie [Tue, 16 Feb 2021 23:22:14 +0000 (18:22 -0500)]
Remove use of deprecated `std::collections::Bound`

3 years agoAllow comments between newlines in chaining hints
Paco Soberón [Tue, 16 Feb 2021 23:09:31 +0000 (00:09 +0100)]
Allow comments between newlines in chaining hints

3 years agoRemove Semantic Tokens flicker workaround
kjeremy [Tue, 16 Feb 2021 21:27:30 +0000 (16:27 -0500)]
Remove Semantic Tokens flicker workaround

https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with
the latest vscode-languageclient release.