Commit Graph

5575 Commits

Author SHA1 Message Date
Matt Hooper
a197abbc7a Added new inlay hint kind and rules for method chaining 2020-03-24 23:18:42 +01:00
bors[bot]
fae627174a
Merge #3664
3664: Introduce TokenConverter Trait r=matklad a=edwin0cheng

This PR add a `TokenConverter` Trait to share the conversion logic between raw `lexer` token and Syntax Node Token.

Related #2158.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-24 16:41:56 +00:00
bors[bot]
9690f6bc43
Merge #3708
3708: Generalise syntax rewriting infrastructure to allow removal of nodes r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 16:15:08 +00:00
Aleksey Kladov
062f6e3bbe Generalise syntax rewriting infrastructure to allow removal of nodes 2020-03-24 17:14:33 +01:00
bors[bot]
7c2cc85806
Merge #3705
3705: Align naming r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 11:56:43 +00:00
Aleksey Kladov
9bf2cd609c Align naming 2020-03-24 12:56:07 +01:00
bors[bot]
6ef64622af
Merge #3700
3700: fill match arms with empty block rather than unit tuple r=matklad a=JoshMcguigan

As requested by @Veetaha in #3689 and #3687, this modifies the fill match arms assist to create match arms as an empty block `{}` rather than a unit tuple `()`.

In one test I left one of the pre-existing match arms as a unit tuple, and added a body to another match arm, to demonstrate that the contents of existing match arms persist. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-24 11:48:32 +00:00
bors[bot]
8617fe641d
Merge #3694
3694: Complete only missing fields r=matklad a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-24 09:49:25 +00:00
Kirill Bulatov
f1cf1cc1ca Code review fixes
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 11:33:47 +02:00
bors[bot]
c6db6e2352
Merge #3696 #3698 #3703
3696: vscode: more type safety r=matklad a=Veetaha



3698: Consider references when applying postfix completions r=matklad a=SomeoneToIgnore

Sometimes my RA debugging workflow breaks because `.dbg` is applied to the variable that is used later in the code.
It's safer to consider the refences to avoid this for completions that may trigger the move.

3703: Don't try to enable proposed API's on stable r=matklad a=matklad



bors r+
🤖

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 08:54:30 +00:00
Kirill Bulatov
dd3b64124b Add a test 2020-03-24 10:43:24 +02:00
Kirill Bulatov
944f28fe5b Use more generic public api 2020-03-24 10:43:22 +02:00
Kirill Bulatov
d5e11b33a3 Remove the upcast 2020-03-24 10:43:00 +02:00
Kirill Bulatov
d221ff4f9e Auto import macros 2020-03-24 10:43:00 +02:00
Josh Mcguigan
7ba934fe58 fill match arms with empty block rather than unit tuple 2020-03-23 19:23:30 -07:00
Kirill Bulatov
4e43df26b2 Consider references when applying postfix completions 2020-03-24 01:56:06 +02:00
Josh Mcguigan
df58ab8963 update itertools version to 0.9.0 2020-03-23 16:22:46 -07:00
Kirill Bulatov
00cbe81a5b Complete only missing fields 2020-03-24 00:36:06 +02:00
Aleksey Kladov
3bd119a4c1 Add a test 2020-03-23 20:57:42 +01:00
bors[bot]
eff1b3fe4d
Merge #3689
3689: implement fill match arm assist for tuple of enums r=matklad a=JoshMcguigan

This updates the fill match arm assist to work in cases where the user is matching on a tuple of enums. 

Note, for now this does not apply when some match arms exist (other than the trivial `_`), but I think this could be added in the future.

I think this also lays the groundwork for filling match arms when matching on tuples of non-enum values, for example a tuple of an enum and a boolean.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-23 16:41:46 +00:00
Aleksey Kladov
f8fd242199
Merge pull request #3686 from Veetaha/feature/hover-actual-type-params
ra_hir: add more privacy for Type
2020-03-23 14:06:54 +01:00
Aleksey Kladov
a2f7ca27c0
Merge pull request #3678 from edwin0cheng/refactor-rename
Fix rename argument in macro call
2020-03-23 14:06:40 +01:00
Josh Mcguigan
bc48c9d511 review comments 2020-03-23 05:19:09 -07:00
bors[bot]
851a03492e
Merge #3690
3690: ra_hir: add more docs r=matklad a=Veetaha

Cited from [hear](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/hover/near/191446937)

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-23 12:06:11 +00:00
veetaha
e6691844db ra_hir: fix typo 2020-03-23 14:04:50 +02:00
veetaha
0fc21bd303 ra_hir: add more docs 2020-03-23 14:00:51 +02:00
bors[bot]
a27f5e3e05
Merge #3632
3632: ra_cargo_watch: log errors r=matklad a=Veetaha

Until this moment we totally ignored all the errors from cargo process. Though this is still true, but we
now try to log ones that are critical (i.e. misconfiguration errors and ignore compile errors).

This fixes #3631, and gives us a better error message to more gracefully handle the #3265
![image](https://user-images.githubusercontent.com/36276403/76958683-d7e1f080-6920-11ea-83d8-04561c11ccc4.png)

Though I think that outputting this only to `Output` channel is not enough. We should somehow warn the user that he passed wrong arguments to `cargo-watch.args`. I didn't bother looking for how to do this now, but this PR at least gives us something.

*cc* @kiljacken @matklad 

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-23 11:55:26 +00:00
bors[bot]
c7a2052e73
Merge #3681
3681: Only include machine-applicable suggestions r=kiljacken a=lnicola

Fixes #3676
Fixes #3633
Fixes #3391 

r? @kiljacken

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-03-23 11:41:32 +00:00
Josh Mcguigan
2afccbe477 implement fill match arm assist for tuple of enums 2020-03-22 23:28:25 -07:00
veetaha
559aeb2932 ra_hir: add more privacy for Type 2020-03-23 02:01:07 +02:00
bors[bot]
baa11d52f4
Merge #3684
3684: ra_hir_def: fix typo r=edwin0cheng a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 19:59:05 +00:00
veetaha
dc1fbef985 ra_hir_def: fix typo 2020-03-22 19:38:55 +02:00
bors[bot]
9328aba706
Merge #3677
3677: Add support for macro in symbol_index r=kjeremy a=edwin0cheng

This PR allows macro showing up in `Open symbol` search:

![show_macro](https://user-images.githubusercontent.com/11014119/77244297-548d0b80-6c4e-11ea-8613-15926cc297b3.png)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-22 14:50:42 +00:00
Laurențiu Nicola
96da53fc56 Only include machine-applicable suggestions 2020-03-22 16:45:15 +02:00
bors[bot]
655b4f16f0
Merge #3679
3679: Some miniscule refactorings r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 14:17:06 +00:00
Edwin Cheng
af8c37cb57
Fix typo
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-22 22:01:48 +08:00
veetaha
bfb6e3fd83 ra_hir: migrate some stuff to matches!() 2020-03-22 15:45:32 +02:00
veetaha
a8e5da8a70 ra_hir_ty: fix formatting 2020-03-22 15:44:38 +02:00
Edwin Cheng
6d5443ef94 Add test 2020-03-22 19:53:34 +08:00
Edwin Cheng
cba4dd1a8a Improve find_all_ref work inside macro 2020-03-22 19:53:28 +08:00
Edwin Cheng
f647faac60 Refactor search 2020-03-22 19:52:45 +08:00
Edwin Cheng
532e178f8e Add find_node_at_offset_with_descend 2020-03-22 19:52:14 +08:00
veetaha
8be28a2d4f ra_cargo_watch: log exit code too 2020-03-22 12:01:49 +02:00
Edwin Cheng
bb22a4e386 Add support for macro in symbo_index 2020-03-22 15:00:44 +08:00
Veetaha
788b29d343
Smol self-nit 2020-03-22 01:27:03 +02:00
bors[bot]
6fe956420f
Merge #3673
3673: Add recursive limit for macro expansion when expanding expression r=flodiebold a=edwin0cheng

cc @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 22:39:06 +00:00
veetaha
8414342640 fix: typo 2020-03-21 23:37:15 +02:00
veetaha
ce73c43848 ra_cargo_watch: return Result<> from run_cargo(), and don't read stderr for now
As stated by matklad, reading the stderr
should be done alngside with
stdout via select() (or I guess poll()),
there is no such implementation in stdlib,
since it is quite low level and platform-dependent and it
also requires quite a bit of unrelated code we don't use it for now.

As referenced by bjorn3, there is an implementation of the needed read2() function
in rustc compiletest. The better solution will be to extract this function
to a separate crate in future:
https://github.com/rust-analyzer/rust-analyzer/pull/3632#discussion_r395605298
2020-03-21 23:37:15 +02:00
veetaha
59ba386bee ra_cargo_watch: log more errors 2020-03-21 23:36:31 +02:00
Edwin Cheng
d62dd63256 Use target-name for crate-name 2020-03-22 01:09:38 +08:00