Commit Graph

13661 Commits

Author SHA1 Message Date
bors[bot]
0bcd8147ec
Merge #6637
6637: Publish diagnostics on file open r=jonas-schievink a=jonas-schievink

Diagnostics are sometimes only showing up when typing. This should fix that.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6381

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 12:42:29 +00:00
Jonas Schievink
9ed883f373 Publish diagnostics on file open
Diagnostics are sometimes only showing up when typing.
This should fix that.
2020-11-26 13:33:47 +01:00
bors[bot]
db6988d4e7
Merge #6614 #6632
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
bors[bot]
ed5c1753b3
Merge #6496
6496: Use builtin scopes more r=matklad a=georgewfraser

VSCode has added more builtin fallback scopes, so we can remove some of our fallback scopes by aligning with their conventions. 

Note that the macro scope doesn't seem to actually *work* at the moment. I have filed a bug with VSCode: https://github.com/microsoft/vscode/issues/110150

Co-authored-by: George Fraser <george@fivetran.com>
2020-11-26 10:36:26 +00:00
George Fraser
ac314f88c6 Just remove the macro fallback 2020-11-25 08:41:40 -08:00
kjeremy
9a3142664b Pin cargo_metadata 2020-11-25 10:11:53 -05:00
bors[bot]
9b512f8569
Merge #6631
6631: Gate autoimports begind experimental completions flag r=kjeremy a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612

Adds a possibility to disable autoimports:

<img width="598" alt="image" src="https://user-images.githubusercontent.com/2690773/100156673-f8037f80-2eb1-11eb-8e74-59ebe4260ba3.png">

and other experimental completions we might want to add later.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-24 23:40:05 +00:00
Kirill Bulatov
9812150047 Document experimental completions 2020-11-25 00:42:58 +02:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
bors[bot]
5478aaebfe
Merge #6630
6630: followup to "hir_expand: propagate expansion errors" r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/6625

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 21:01:33 +00:00
Jonas Schievink
9559bce311 Rename parse_macro to parse_macro_expansion
This does not parse macros, it expands a macro and parses the *result*
2020-11-24 21:57:51 +01:00
Jonas Schievink
f9d0d51101 hir_expand::db: reduce fn visibility 2020-11-24 21:55:08 +01:00
Jonas Schievink
9a3bb19d32 Remove fixed FIXME, propagate errors better 2020-11-24 21:52:19 +01:00
bors[bot]
e2d8e1120f
Merge #6625
6625: hir_expand: propagate expansion errors r=jonas-schievink a=jonas-schievink

This is needed to collect and report expansion errors later.

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 18:01:49 +00:00
Jonas Schievink
d5e9bf80f9 hir_expand: propagate expansion errors 2020-11-24 19:00:23 +01:00
bors[bot]
d2f398cd76
Merge #6624
6624: Check structs for match exhaustiveness r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 17:51:46 +00:00
Lukas Wirth
377fa7db3f Check structs for match exhaustiveness 2020-11-24 18:50:56 +01:00
bors[bot]
b769f5da6e
Merge #6621
6621: Handle ellipsis in tuple patterns in match exhaustiveness checking r=flodiebold a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:57:32 +00:00
Lukas Wirth
4d841dc4e7 Add middle ellipsis missing arm text 2020-11-24 16:46:06 +01:00
Lukas Wirth
a4b5275656 Handle ellipsis in tuple patterns in match exhaustiveness checking 2020-11-24 16:43:28 +01:00
bors[bot]
67d45851bf
Merge #6618
6618: Properly infer tuple patterns when encountering ellipsis r=Veykril a=Veykril

We basically just split the subpatterns into two halves when the ellipsis is present and then offset the latter half to account for the ignored bindings.

Fixes #6616

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:13:25 +00:00
Lukas Wirth
a5efefd3d7 Properly infer tuple struct patterns when encountering ellipsis 2020-11-24 16:11:40 +01:00
bors[bot]
f7e63bdf91
Merge #6620
6620: cargo update (without cargo_metadata) r=kjeremy a=kjeremy

This is a `cargo update` run without updating `cargo_metadata`.

`cargo_metadata` `0.12.1` pins `semver-parser` to `0.10.0` (4e88e5624c) which brings back the compile time blowup that @matklad tried so hard to avoid in https://github.com/steveklabnik/semver-parser/pull/50.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-24 15:00:54 +00:00
kjeremy
24bbf3b838 cargo update 2020-11-24 09:13:26 -05:00
bors[bot]
08a3f8f7f0
Merge #6619
6619: New lsp-types to fix versioning r=kjeremy a=kjeremy

Fixes #6603

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-24 13:53:38 +00:00
kjeremy
e981485b76 New lsp-types to fix versioning
Fixes #6603
2020-11-24 08:52:24 -05:00
Lukas Wirth
35dd62e915 Properly infer tuple patterns when encountering ellipsis 2020-11-24 13:56:20 +01:00
bors[bot]
2d2615db15
Merge #6617
6617: Avoid string allocations in ignore_test r=lnicola a=lnicola

CC @jakobhellermann

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-24 10:10:05 +00:00
Laurențiu Nicola
8af1ed6a09 Avoid string allocations in ignore_test 2020-11-24 12:08:54 +02:00
bors[bot]
6294286fee
Merge #6610
6610: add 'Re-enable this test' assist r=SomeoneToIgnore a=jakobhellermann

The `Ignore this test` assist previously allowed ignoring multiple times, each time adding a `#[ignore]` attribute.

This PR instead shows an assist to undo the ignoring.

Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
2020-11-24 00:54:53 +00:00
bors[bot]
2ff78cde31
Merge #6613
6613: Don't assume DidChangeTextDocument paths exist r=SomeoneToIgnore a=mjibson

Fixes #5933

Co-authored-by: Matt Jibson <matt.jibson@gmail.com>
2020-11-24 00:41:08 +00:00
Kirill Bulatov
4baac238a8 Improve autoimports on completion speed
* Ignore modules eaferly
* Do less completion string rendering
2020-11-24 02:28:45 +02:00
Matt Jibson
117c793e80 Don't assume DidChangeTextDocument paths exist
Fixes #5933
2020-11-23 16:35:34 -07:00
Jakob Hellermann
a172c2317c add 'Re-enable this test' assist 2020-11-23 20:31:57 +01:00
bors[bot]
036ea6317c
Merge #6609
6609: Minor, import style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-23 18:20:01 +00:00
Aleksey Kladov
2c083c993f Minor, import style 2020-11-23 21:19:37 +03:00
bors[bot]
224387a4de
Merge #6606
6606: Parse unsafe extern block r=lnicola a=dtolnay

`unsafe extern` block is parsed successfully by rustc, which means it is usable in attribute macro input.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f805556f176d082d87255957f16b5f6

```rust
#[cfg(parse)]
unsafe extern "C++" {
    fn demo();
}
```

```diff
  SOURCE_FILE@0..52
-   ERROR@0..33
+   EXTERN_BLOCK@0..52
      ATTR@0..13
        POUND@0..1 "#"
        L_BRACK@1..2 "["
        PATH@2..5
          PATH_SEGMENT@2..5
            NAME_REF@2..5
              IDENT@2..5 "cfg"
        TOKEN_TREE@5..12
          L_PAREN@5..6 "("
          IDENT@6..11 "parse"
          R_PAREN@11..12 ")"
        R_BRACK@12..13 "]"
      WHITESPACE@13..14 "\n"
      UNSAFE_KW@14..20 "unsafe"
      WHITESPACE@20..21 " "
      ABI@21..33
        EXTERN_KW@21..27 "extern"
        WHITESPACE@27..28 " "
        STRING@28..33 "\"C++\""
-   WHITESPACE@33..34 " "
-   ERROR@34..52
-     L_CURLY@34..35 "{"
-     WHITESPACE@35..40 "\n    "
-     FN@40..50
-       FN_KW@40..42 "fn"
-       WHITESPACE@42..43 " "
-       NAME@43..47
-         IDENT@43..47 "demo"
-       PARAM_LIST@47..49
-         L_PAREN@47..48 "("
-         R_PAREN@48..49 ")"
-       SEMICOLON@49..50 ";"
-     WHITESPACE@50..51 "\n"
-     R_CURLY@51..52 "}"
+     WHITESPACE@33..34 " "
+     EXTERN_ITEM_LIST@34..52
+       L_CURLY@34..35 "{"
+       WHITESPACE@35..40 "\n    "
+       FN@40..50
+         FN_KW@40..42 "fn"
+         WHITESPACE@42..43 " "
+         NAME@43..47
+           IDENT@43..47 "demo"
+         PARAM_LIST@47..49
+           L_PAREN@47..48 "("
+           R_PAREN@48..49 ")"
+         SEMICOLON@49..50 ";"
+       WHITESPACE@50..51 "\n"
+       R_CURLY@51..52 "}"
```

This is of interest for https://github.com/dtolnay/cxx.

Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-11-23 07:05:31 +00:00
David Tolnay
8a11da40a7
Parse unsafe extern block 2020-11-22 20:44:56 -08:00
Benjamin Coenen
775c69183c add let and letm postfix to turn expressions into variables
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-21 15:06:22 +01:00
Lukas Wirth
1f87a41989 Add attribute highlight modifier to all tokens inside attributes 2020-11-21 12:51:05 +01:00
bors[bot]
cadf0e9fb6
Merge #6598
6598: Textmate grammar: ensure word boundary after `true` r=dustypomerleau a=dustypomerleau

Adding round brackets ensures word boundaries on both sides of booleans (reported in https://github.com/dustypomerleau/rust-syntax/issues/7).

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-21 07:49:13 +00:00
Dusty Pomerleau
4410af455e ensure word boundary after true 2020-11-21 18:44:38 +11:00
bors[bot]
48bb4bf228
Merge #6595
6595: Don't wrap parens around expr in remove_dbg assist if its in conditions r=Veykril a=Veykril

If the expr in the `dbg!` macro consists of multiple elements it won't remove the parentheses if its in a `match` or condition-using construct, as these are followed by siblings causing the `is_leaf` check to fail.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-20 16:30:04 +00:00
Lukas Wirth
5d39f6a357 Don't wrap parens around expr in remove_dbg assist if its in conditions 2020-11-20 17:28:56 +01:00
bors[bot]
66db0d3cad
Merge #6592
6592: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-19 20:04:12 +00:00
kjeremy
1472ec4c05 cargo update 2020-11-19 15:00:56 -05:00
bors[bot]
0c9ee2902a
Merge #6585
6585: Link rustc error page and clippy lint page via CodeDescription r=kjeremy a=Veykril

Fixes #6371

This makes the error code in here clickable, same for clippy lints
![image](https://user-images.githubusercontent.com/3757771/99459468-6d110b00-292e-11eb-9cde-d43ec9cebc09.png)

For clippy I just chose the master build of the site as I believe that to be pretty much always the best fitting.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-18 14:01:29 +00:00
Lukas Wirth
91a1a83601 Fill code_description for rust_analyzer diagnostics 2020-11-18 08:54:52 +01:00
Lukas Wirth
56a0021e61 update diagnostics test_data with code_description changes 2020-11-18 08:50:27 +01:00
Lukas Wirth
863fdcfa24 Link clippy lint codes in diagnostics 2020-11-18 08:50:27 +01:00