Commit graph

13638 commits

Author SHA1 Message Date
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
Lukas Wirth
132063ad96 Link rustc error codes in diagnostics 2020-11-18 08:50:27 +01:00
Lukas Wirth
e8282b37d4 Don't call a closure function in infer_function_return_type label 2020-11-17 22:34:15 +01:00
bors[bot]
99975d08f0
Merge #6577 #6579 #6581
6577: fix typos in syntax.md r=matklad a=jakobhellermann



6579: cargo update and add new license r=matklad a=kjeremy



6581: Use vscode-languageclient 7.0.0-next.14 r=matklad a=kjeremy



Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-17 18:01:18 +00:00
bors[bot]
156f7d6963
Merge #6553
6553: Auto imports in completion r=matklad a=SomeoneToIgnore

![completion](https://user-images.githubusercontent.com/2690773/99155339-ae4fb380-26bf-11eb-805a-655b1706ce70.gif)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/1062 but does not handle the completion order, since it's a separate task for https://github.com/rust-analyzer/rust-analyzer/issues/4922 , https://github.com/rust-analyzer/rust-analyzer/issues/4922 and maybe something else.

2 quirks in the current implementation:

* traits are not auto imported during method completion

If I understand the current situation right, we cannot search for traits by a **part** of a method name, we need a full name with correct case to get a trait for it.

* VSCode (?) autocompletion is not as rigid as in Intellij Rust as you can notice on the animation.

Intellij is able to refresh the completions on every new symbol added, yet VS Code does not query the completions on every symbol for me.
With a few debug prints placed in RA, I've observed the following behaviour: after the first set of completion suggestions is received, next symbol input does not trigger a server request, if the completions contain this symbol.
When more symbols added, the existing completion suggestions are filtered out until none are left and only then, on the next symbol it queries for completions.
It seems like the only alternative to get an updated set of results is to manually retrigger it with Esc and Ctrl + Space.

Despite the eerie latter bullet, the completion seems to work pretty fine and fast nontheless, but if you have any ideas on how to make it more smooth, I'll gladly try it out.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-17 17:50:08 +00:00
bors[bot]
f4b4f17662
Merge #6582
6582: Fill the diagnostic code field in publish_diagnostics r=kjeremy a=Veykril

Fixes #6580
Before:
![Code_znn6VgLLH9](https://user-images.githubusercontent.com/3757771/99408084-213f7100-28f0-11eb-8317-3f5c2b93313d.png)
After:
![Code_c4jJsvzOEA](https://user-images.githubusercontent.com/3757771/99408096-23093480-28f0-11eb-9bb2-8ebf2fb3d5a1.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-17 15:47:36 +00:00
Lukas Wirth
c868f0255f Fill the diagnostic code field in publish_diagnostics 2020-11-17 16:23:53 +01:00
kjeremy
1d333a8387 Use vscode-languageclient 7.0.0-next.14 2020-11-17 10:10:34 -05:00
bors[bot]
1863c0c732
Merge #6578
6578: Simpify project_model r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-17 14:41:27 +00:00
kjeremy
4e73c8f608 cargo update and add new license 2020-11-17 09:39:25 -05:00
Aleksey Kladov
e88b5fe916 Simplify 2020-11-17 15:25:58 +01:00
Aleksey Kladov
bd4d375a64 Make code more readable 2020-11-17 15:25:58 +01:00
Aleksey Kladov
a0c4dbc399 Minor 2020-11-17 15:25:58 +01:00
Aleksey Kladov
db218006c9 Remove dead code 2020-11-17 15:25:57 +01:00
Aleksey Kladov
0d19ee1d70 Simplify 2020-11-17 15:25:57 +01:00
Jakob Hellermann
7c6c812a74
fix typos in syntax.md 2020-11-17 15:16:52 +01:00
bors[bot]
66bcdcbb36
Merge #6575
6575: Use standard code style for test fixtures r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-17 13:44:37 +00:00
Aleksey Kladov
17e8a00b0b Use standard code style for test fixtures 2020-11-17 14:43:23 +01:00
bors[bot]
35ace3e265
Merge #6574
6574: **Unwrap Block** supports stand-alone blocks r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-17 13:34:46 +00:00
Aleksey Kladov
8c6f933773 **Unwrap Block** supports stand-alone blocks 2020-11-17 14:33:30 +01:00
Aleksey Kladov
10fa9c595a Simplify 2020-11-17 14:33:30 +01:00
Aleksey Kladov
8dd0b7d2b5 Assist target should point at *existing* code 2020-11-17 14:33:30 +01:00
bors[bot]
d4c970d1f2
Merge #6573
6573: Add **Ignore Test** assist r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-17 13:22:43 +00:00
Aleksey Kladov
9a30707281 Add **Ignore Test** assist 2020-11-17 14:22:04 +01:00