Commit Graph

15671 Commits

Author SHA1 Message Date
Laurențiu Nicola
d03cfe141c Add test from #7273 2021-02-21 19:22:14 +02:00
Laurențiu Nicola
48ae948b22 Bump deps 2021-02-21 19:13:11 +02:00
bors[bot]
238f3a5173
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>
2021-02-21 00:18:49 +00:00
Scott McMurray
0fe44d099a 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.
2021-02-20 14:45:30 -08:00
bors[bot]
62bc753f8b
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 b9d6904845) 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>
2021-02-20 20:17:14 +00:00
bors[bot]
d0a787152d
Merge #7733
7733: Update some crates r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2021-02-20 19:59:43 +00:00
Jeremy Kolb
1f3c637a1d Update tests 2021-02-20 14:59:05 -05:00
Lukas Wirth
0799288f01 Don't write trailing whitespace when formatting empty GenericPredicates 2021-02-20 20:43:04 +01:00
Jeremy Kolb
b43bec380f Update some crates 2021-02-20 14:15:26 -05:00
Lukas Wirth
9e5192d917 Don't lower TypeBound::Lifetime as GenericPredicate::Error 2021-02-20 19:08:20 +01:00
bors[bot]
0b4ec3c4e8
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>
2021-02-20 17:35:37 +00:00
bors[bot]
364d572de8
Merge #7730
7730: Fix #7712 retain visibility extracting mod to file r=lnicola a=mattyhall



Co-authored-by: Matt Hall <matthew@quickbeam.me.uk>
2021-02-20 17:12:41 +00:00
Matt Hall
8497b5bd75 Use format_to! to make logic a bit nicer 2021-02-20 17:11:04 +00:00
Matt Hall
b963893349 Fix #7712 retain visibility extracting mod to file 2021-02-20 16:51:16 +00:00
Laurențiu Nicola
23a8fc5284 Try to detect musl distros in the Code extension 2021-02-20 18:44:28 +02:00
bors[bot]
de67469f59
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>
2021-02-20 15:31:59 +00:00
Laurențiu Nicola
4c589aded0 Remove documentation of obsolete extend selection command 2021-02-20 17:18:53 +02:00
bors[bot]
1349f6a791
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>
2021-02-20 14:18:34 +00:00
Benjamin Coenen
cf32dbd9bf feat(completion): add doc(hidden) completion for attributes
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-02-20 15:16:05 +01:00
bors[bot]
459e10eb74
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>
2021-02-20 14:07:19 +00:00
Benjamin Coenen
d8559588c0 fix(assist): display where predicates when we want to generate impl
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-02-20 15:05:01 +01:00
bors[bot]
ba3a5c518a
Merge #7724
7724: Consider import prefix config settings during flyimports r=SomeoneToIgnore a=SomeoneToIgnore

Fixes #7666

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-02-20 11:55:17 +00:00
Kirill Bulatov
4fe5786c0c Consider import prefix config settings during flyimports 2021-02-20 13:53:50 +02:00
bors[bot]
23f0d4baa1
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>
2021-02-20 11:03:15 +00:00
azzamsa
ae50b18503 Fix typos 2021-02-20 17:53:19 +07:00
bors[bot]
900ba71168
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>
2021-02-20 10:49:12 +00:00
Laurențiu Nicola
c1d37f030f Add test 2021-02-20 12:43:52 +02:00
Laurențiu Nicola
af4148970a Fix incorrect missing field diagnostic with box patterns 2021-02-20 12:36:17 +02:00
Luciano Bestia
864fb063a0 rustfmt 1.4.30-stable 2021-02-18 16:51:21 +01:00
bors[bot]
20a911f3cc
Merge #7707
7707: rename completion -> ide_completion r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-17 14:54:55 +00:00
Aleksey Kladov
3db64a400c rename completion -> ide_completion
We don't have completion-related PRs in flight, so lets do it
2021-02-17 17:53:31 +03:00
bors[bot]
6334ce866a
Merge #7706
7706: Revert "Replace usage of ast::NameOrNameRef with ast::NameLike" r=Veykril a=Veykril

This reverts commit e1dbf43cf8.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-17 14:02:07 +00:00
Lukas Wirth
2887426da0 Revert "Replace usage of ast::NameOrNameRef with ast::NameLike"
This reverts commit e1dbf43cf8.
2021-02-17 15:00:44 +01:00
bors[bot]
4054525c41
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>
2021-02-17 13:45:27 +00:00
bors[bot]
056601b41f
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>
2021-02-17 13:17:15 +00:00
Lukas Wirth
51dda8ea8e Show hover info of the definition of ConstReference patterns instead of its type 2021-02-17 14:14:58 +01:00
Lukas Wirth
e1dbf43cf8 Replace usage of ast::NameOrNameRef with ast::NameLike 2021-02-17 14:02:34 +01:00
bors[bot]
5cd7a0f2c5
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>
2021-02-17 11:58:35 +00:00
Michał Muskała
528a0bcf9b 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.
2021-02-17 12:45:17 +01:00
bors[bot]
2920e7b28b
Merge #7701
7701: Remove semantic tokens workaround r=SomeoneToIgnore a=kjeremy

Let's try this again.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-17 09:43:13 +00:00
bors[bot]
b3c848ee28
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>
2021-02-17 01:24:25 +00:00
bors[bot]
94f56ebccf
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>
2021-02-17 01:02:21 +00:00
bstrie
3c922072ae Remove use of deprecated std::collections::Bound 2021-02-16 18:22:14 -05:00
Paco Soberón
e0eb80eaee Allow comments between newlines in chaining hints 2021-02-17 00:09:56 +01:00
kjeremy
a403be6456 Remove Semantic Tokens flicker workaround
https://github.com/microsoft/vscode-languageserver-node/issues/576 has been closed with
the latest vscode-languageclient release.
2021-02-16 16:27:30 -05:00
kjeremy
13008c4d30 vscode-languageclient 7.1.0-next.2 2021-02-16 16:23:37 -05:00
bors[bot]
4c4de19467
Merge #7700
7700: Use npm 7.x package-lock.json r=lnicola a=kjeremy

Supposedly backwards compatible

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-16 21:05:24 +00:00
kjeremy
338c08f13e Use npm 7.x package-lock.json 2021-02-16 15:48:27 -05:00
Lukas Wirth
e52bdc55ef Implement ast::AstNode for NameLike and move it to node_ext 2021-02-16 19:27:08 +01:00
bors[bot]
054caa81c5
Merge #7690
7690: Extract `fn load_workspace(…)` from `fn load_cargo(…)` r=matklad a=regexident

Unfortunately in https://github.com/rust-analyzer/rust-analyzer/pull/7595 I forgot to `pub use` (rather than just `use`) the newly introduced `LoadCargoConfig`.

So this PR fixes this now.

It also:

- splits up `fn load_cargo` into a "workspace loading" and a "project loading" phase
- adds a `progress: &dyn Fn(String)` to allow third-parties to provide CLI progress updates, too

The motivation behind both of these is the fact that rust-analyzer currently does not support caching.
As such any third-party making use of `ra_ap_…` needs to providing a caching layer itself.
Unlike for rust-analyzer itself however a common use-pattern of third-parties is to analyze a specific target (`--lib`/`--bin <BIN>`/…) from a specific package (`--package`). The targets/packages of a crate can be obtained via `ProjectWorkspace::load(…)`, which currently is performed inside of `fn load_cargo`, effectively making the returned `ProjectWorkspace` inaccessible to the outer caller. With this information one can then provide early error handling via CLI (in case of ambiguities or invalid arguments, etc), instead of `fn load_cargo` failing with a possibly obscure error message. It also allows for annotating the persisted caches with its specific associated package/target selector and short-circuit quickly if a matching cache is found on disk, significantly cutting load times.

Before:

```rust
pub struct LoadCargoConfig {
    pub cargo_config: &CargoConfig,
    pub load_out_dirs_from_check: bool,
    pub with_proc_macro: bool,
}

pub fn load_cargo(
    root: &Path,
    config: &LoadCargoConfig
) -> Result<(AnalysisHost, vfs::Vfs)> {
    // ...
}
```

After:

```rust
pub fn load_workspace(
    root: &Path,
    config: &CargoConfig,
    progress: &dyn Fn(String),
) -> Result<ProjectWorkspace> {
        // ...
}

pub struct LoadCargoConfig {
    pub load_out_dirs_from_check: bool,
    pub with_proc_macro: bool,
}

pub fn load_cargo(
    ws: ProjectWorkspace,
    config: &LoadCargoConfig,
    progress: &dyn Fn(String),
) -> Result<(AnalysisHost, vfs::Vfs)> {
    // ...
}
```


Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-02-16 18:24:28 +00:00