Commit Graph

13033 Commits

Author SHA1 Message Date
bors[bot]
7c4bb97145
Merge #6272
6272: ⬆️ xshell r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-17 23:53:42 +00:00
Aleksey Kladov
6c7769a2e3 update deps 2020-10-18 01:53:01 +02:00
Aleksey Kladov
cb63e83237 ⬆️ xshell 2020-10-18 01:51:39 +02:00
bors[bot]
aed7b6d98a
Merge #6271
6271: Complete methods when receiver is a macro r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-17 22:45:32 +00:00
bors[bot]
63956e509e
Merge #6248
6248: Textmate grammar: prevent early termination of raw strings with hash (closes #6042) r=matklad a=dustypomerleau

Problematic sample code from #6042:

```rust
#[derive(Debug, Clone, Logos)]
enum Quoted<'source> {
    #[regex(r#"[^\\"']+"#)]
    Text(&'source str),
    #[token("\\")]
    StartEscape,
    #[token("\'", |_| Quote::Single)]
    #[token("\"", |_| Quote::Double)]
    End(Quote),

    #[error]
    Error,
}
```

Before fix:

<img width="400" alt="Screen Shot 2020-10-16 at 10 45 59" src="https://user-images.githubusercontent.com/6304651/96198390-6a726d00-0fa0-11eb-8428-e76b2866836b.png">

After fix:

<img width="400" alt="Screen Shot 2020-10-16 at 10 45 33" src="https://user-images.githubusercontent.com/6304651/96198408-7a8a4c80-0fa0-11eb-9104-ca708009fe63.png">



Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-10-17 22:38:04 +00:00
Aleksey Kladov
13451d3dc4 Complete methods when receiver is a macro 2020-10-17 23:43:13 +02:00
Aleksey Kladov
4fe4c30436 Improve readability 2020-10-17 23:35:21 +02:00
bors[bot]
783c6a333a
Merge #6265
6265: ⬆️ xshell r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-17 11:25:48 +00:00
Aleksey Kladov
0fab08740b ⬆️ xshell 2020-10-17 13:25:22 +02:00
bors[bot]
b1315be010
Merge #6262
6262: Do not spawn redundant hints r=SomeoneToIgnore a=popzxc

Closes #5206

This is a second part of the fix (first was #5997).

This PR adds a new method to the `CompletionContext`: `no_completion_required`. If this method returns `true`, it essentially means that user is unlikely to expect any hints from the IDE at this cursor position.

Currently, checks for the following cases were added:

- Previous item is `fn`: user creates a new function, names of existing functions won't be helpful. Exception for this case is `impl Foo for Bar` -- we must suggest trait function names.
- User entered `for _ i<|>`: it's obviously going to be `in` keyword, any hints here will be confusing.

More checks may be added there later, but currently I've only figured two cases.

![no_redundant_hints](https://user-images.githubusercontent.com/12111581/96332088-da4d2a00-106a-11eb-89a1-1159ece18f9d.png)



Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-17 10:31:37 +00:00
Igor Aleksanov
99c435939c Scan all ancestors for the impl trait block check 2020-10-17 11:17:58 +03:00
Igor Aleksanov
6f573bd84f Allow hints after 'fn' keyword if it's an impl trait block 2020-10-17 11:03:07 +03:00
Igor Aleksanov
8f303daf45 Add test for new pattern functions 2020-10-17 10:56:00 +03:00
Igor Aleksanov
6ae4c70a0a Improve test_no_completions_required test 2020-10-17 10:47:35 +03:00
Igor Aleksanov
70157f07d9 Remove redundant completions 2020-10-17 10:27:59 +03:00
bors[bot]
59483c2176
Merge #6260
6260: xshell r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-17 00:44:12 +00:00
Aleksey Kladov
49a90d4c31 Switch from not_bash to xshell 2020-10-17 02:42:42 +02:00
bors[bot]
f0412da4a2
Merge #6253
6253: Document change of 'cargo' Runnable kind in lsp-extensions.md r=lnicola a=popzxc

As was requested in https://github.com/rust-analyzer/rust-analyzer/pull/5954#issuecomment-708325521


Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-16 18:00:21 +00:00
Igor Aleksanov
d718366567 Document change of 'cargo' Runnable kind in lsp-extensions.md 2020-10-16 20:58:57 +03:00
bors[bot]
89aad020c8
Merge #6255
6255: Improve compile time a tiny bit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-16 17:49:08 +00:00
Aleksey Kladov
c7a079d32d Improve compile time a tiny bit 2020-10-16 19:47:47 +02:00
bors[bot]
4271e4c703
Merge #6245
6245: Update GNOME Builder docs r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-16 12:59:11 +00:00
bors[bot]
1af6275f20
Merge #6246
6246: Follow symlinks when walking project trees r=lnicola a=dfoxfranke

Fixes #3691.

~~WIP pending further testing~~:

- [X] Verify that symlinked files get indexed.
- [x] Verify that files in symlinked directories get indexed.
- [x] Verify that inotify events are properly received and handled when the target of a symlink resides outside the project tree.

Co-authored-by: Daniel Fox Franke <dfoxfranke@gmail.com>
2020-10-16 12:53:10 +00:00
bors[bot]
fb2d332f5f
Merge #6250
6250: Expand code order section r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-16 10:50:34 +00:00
Aleksey Kladov
0c67edc0f7 Expand code order section 2020-10-16 12:50:09 +02:00
Dusty Pomerleau
c2335d0cb2 fix: prevent early termination of raw strings with hash 2020-10-16 11:08:59 +11:00
Daniel Fox Franke
e821aa842b Follow symlinks when walking project trees
Fixes #3691
2020-10-15 14:22:36 -04:00
bors[bot]
0d45802d67
Merge #6220
6220: implement binary operator overloading type inference r=flodiebold a=ruabmbua

Extend type inference of *binary operator expression*, by adding support for operator overloads.

Before this merge request, the type inference of binary expressions could only resolve operations done on built-in primitive types. This merge requests adds a code path, which is executed in case the built-in inference could not get any results. It resolves the proper operator overload trait in *core::ops* via lang items, and then resolves the associated *Output* type.

```rust
struct V2([f32; 2]);

#[lang = "add"]
pub trait Add<Rhs = Self> {
    /// The resulting type after applying the `+` operator.
    type Output;

    /// Performs the `+` operation.
    #[must_use]
    fn add(self, rhs: Rhs) -> Self::Output;
}

impl Add<V2> for V2 {
    type Output = V2;

    fn add(self, rhs: V2) -> V2 {
        let x = self.0[0] + rhs.0[0];
        let y = self.0[1] + rhs.0[1];
        V2([x, y])
    }
}

fn test() {
    let va = V2([0.0, 1.0]);
    let vb = V2([0.0, 1.0]);

    let r = va + vb; // This infers to V2 now
}
```

There is a problem with operator overloads, which do not explicitly set the *Rhs* type parameter in the respective impl block. 

**Example:**

```rust
impl Add for V2 {
    type Output = V2;

    fn add(self, rhs: V2) -> V2 {
        let x = self.0[0] + rhs.0[0];
        let y = self.0[1] + rhs.0[1];
        V2([x, y])
    }
}
```

In this case, the trait solver does not realize, that the *Rhs* type parameter is actually self in the context of the impl block. This stops type inference in its tracks, and it can not resolve the associated *Output* type.

I guess we can still merge this back, because it increases the amount of resolved types, and does not regress anything (in the tests).

Somewhat blocked by https://github.com/rust-analyzer/rust-analyzer/issues/5685
Resolves  https://github.com/rust-analyzer/rust-analyzer/issues/5544

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-10-15 18:02:27 +00:00
Laurențiu Nicola
b19013feaa Update GNOME Builder docs 2020-10-15 20:00:09 +03:00
bors[bot]
1de2020109
Merge #6244
6244: Document awkward names r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-15 16:14:54 +00:00
Aleksey Kladov
86cc93ebe3 Document awkward names 2020-10-15 18:14:30 +02:00
bors[bot]
d8c6e192f7
Merge #6243
6243: Clarify classification API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-15 15:39:35 +00:00
Aleksey Kladov
c5868a4879 Clarify the names one more time 2020-10-15 17:38:51 +02:00
Aleksey Kladov
56e67e3a39 More idiomatic classification API 2020-10-15 17:38:17 +02:00
Aleksey Kladov
f9c1336873 More clarifications 2020-10-15 17:37:55 +02:00
Aleksey Kladov
bc287b8f9b Unconfuse expression and pattern field init shorthands 2020-10-15 17:37:36 +02:00
Aleksey Kladov
fa3c449d8f Clarify NameClass names a bit 2020-10-15 17:37:36 +02:00
bors[bot]
7fadc78ebb
Merge #6242
6242: Diagnost shorthand in patterns r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-15 15:11:36 +00:00
Aleksey Kladov
3086fb2ef4 Move field_shorthand to a separate module 2020-10-15 17:10:06 +02:00
Aleksey Kladov
1022672af0 Diagnose shorthand in patterns as well 2020-10-15 17:03:52 +02:00
Aleksey Kladov
e9903a91cd flatten 2020-10-15 16:51:55 +02:00
Aleksey Kladov
c8cbd398e4 Prepare for pat_field_shorthand 2020-10-15 16:48:25 +02:00
bors[bot]
8090799aa2
Merge #6234
6234: Fix hover over field pattern shorthand r=matklad a=Vlad-Shcherbina

Instead of the information about the field, it now shows the information
about the local.

Fixes #6146

Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
2020-10-15 13:09:27 +00:00
bors[bot]
d447a9a381
Merge #6240
6240: Document auto_import as a feature r=Veykril a=Veykril

Closes #6225

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-15 12:59:49 +00:00
Lukas Wirth
f8a7cc678d Document auto_import as a feature 2020-10-15 14:57:19 +02:00
bors[bot]
7dd09a7b34
Merge #6236
6236: Code: Insert a ZWNJ before `after` type hints r=matklad a=lnicola

to prevent the editor from displaying a ligature there. 

Fixes #6235

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-15 10:50:26 +00:00
bors[bot]
ba6679dc6c
Merge #6239
6239: Cleanup alloc advice r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-15 10:22:01 +00:00
Aleksey Kladov
dedfaa3844 Cleanup alloc advice 2020-10-15 12:21:38 +02:00
Laurențiu Nicola
010d123f23 Insert a ZWNJ before type hints 2020-10-15 10:56:28 +03:00
bors[bot]
3a38554f86
Merge #6231
6231: Factor macro_rules and format-string highlighting out into submodules r=Veykril a=Veykril

This moves `format`-like macro string highlighting and macro_rules highlight skipping out of the main module.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-14 20:52:41 +00:00