Commit graph

389 commits

Author SHA1 Message Date
bors[bot]
f2736c969c
Merge #9663
9663: fix: Don't offer extract_variable assist when there is no surrounding block r=Veykril a=Veykril

Fixes #9143
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-21 16:00:08 +00:00
Lukas Wirth
9279c1c939 Don't offer extract_variable assist when there is no surrounding block 2021-07-21 17:52:54 +02:00
bors[bot]
1c8cfa4310
Merge #9652
9652: Don't concat path in replace_qualified assist when they start with a keyword r=Veykril a=Veykril

Also keep the path if we can't find a path to the item instead of becoming non applicable.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-20 16:58:30 +00:00
Lukas Wirth
4f99c6467b Don't concat path in replace_qualified assist when they start with a keyword 2021-07-20 18:57:12 +02:00
Aleksey Kladov
60e7c1de83 minor: address review comments 2021-07-20 17:49:33 +03:00
Aleksey Kladov
3c5827cc18 internal: remove one usage of a slow method 2021-07-20 17:11:09 +03:00
Aleksey Kladov
8e0630e728 internal: remove one usage of a slow method 2021-07-20 17:02:37 +03:00
bors[bot]
a2f83c956e
Merge #9614
9614: Parse input expressions for dbg! invocations in remove_dbg r=Veykril a=Veykril

Instead of inspecting the input tokentree manually, parse the input as `,` delimited expressions instead and act on that. This simplifies the assist quite a bit.

Fixes #8455

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-16 13:48:23 +00:00
Lukas Wirth
c5bcd56433 Cleanup tests 2021-07-16 15:47:59 +02:00
Lukas Wirth
da00208ab9 Parse input expressions in for dbg! in remove_dbg 2021-07-16 15:20:50 +02:00
Kirill Bulatov
8a5b24eb7e Explicitly connect an ambiguous import path case logic with the test on it 2021-07-16 00:41:00 +03:00
patrick-gu
6c591a9275 fix: Single-line and nested blocks in unwrap_block
Rework the system for stripping whitespace and braces in the
unwrap_block assist to allow correct unwrapping of `{$0 { 0 } }`
2021-07-14 12:02:38 -07:00
Lukas Wirth
c41f1279a3 Inline name classification reference calls 2021-07-11 15:39:09 +02:00
Lukas Wirth
c65bb7f8b9 Explicitly check for reference locals or fields in Name classification 2021-07-11 15:04:40 +02:00
bors[bot]
87621de2b9
Merge #9567 #9568
9567: remove unneded special case r=matklad a=matklad

bors r+
🤖

9568: feat: add 'for' postfix completion r=lnicola a=mahdi-frms


![Peek 2021-07-11 16-45](https://user-images.githubusercontent.com/62165556/125194692-a0aaf780-e267-11eb-952a-81de7955d9a1.gif)


adds #9561

used ```ele``` as identifier for each element in the iteration

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-11 12:51:33 +00:00
Lukas Wirth
c6b6f18520 Simplify Semantics::type_of_expr_with_coercion 2021-07-11 14:44:10 +02:00
Aleksey Kladov
1171dc74e0 internal: remove unused param 2021-07-11 15:08:00 +03:00
Aleksey Kladov
5021f10660 internal: add a test for broken refactor 2021-07-11 15:05:16 +03:00
Aleksey Kladov
f42648e305 internal: remove needless distinction between a carte and its root mod 2021-07-11 14:55:24 +03:00
bors[bot]
2e52d6ea93
Merge #9557
9557: fix: Respect coercions in `inline_call` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 17:25:16 +00:00
Lukas Wirth
9e1eb77f6b Respect coercions in inline_call 2021-07-10 19:24:49 +02:00
Lukas Wirth
7e6f40b6f1 Expose coercions for patterns and expressions in semantics 2021-07-10 19:03:46 +02:00
bors[bot]
f83f069f94
Merge #9552
9552: internal: `add_explicit_type` respects coercions r=Veykril a=Veykril

or so I'd like to say but there is one odd case here where it doesn't work(see [review](https://github.com/rust-analyzer/rust-analyzer/pull/9552#discussion_r667351856))

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 16:25:58 +00:00
Lukas Wirth
576e3a4e12 add_explicit_type respects coercions 2021-07-10 18:19:46 +02:00
bors[bot]
2d7727fe31
Merge #9553
9553: minor: Disambiguate replace with if let assist labels r=Veykril a=Veykril

Turns out we have two assists for replacing something with `if let` constructs, so having the cursor on a `let` keyword inside a match gave you two identical assist labels which is rather confusing.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 16:07:01 +00:00
Lukas Wirth
0796288ed2 Disambiguate replace with if let assist labels 2021-07-10 18:00:22 +02:00
bors[bot]
4337f5e456
Merge #9555 #9556
9555: feat: Enable `auto_import` on ident patterns r=Veykril a=Veykril

Helpful for when you want to import a type in a pattern right before destructuring it.

9556: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-10 15:59:26 +00:00
Lukas Wirth
79614c486b Enable auto_import on ident patterns 2021-07-10 17:57:33 +02:00
Lukas Wirth
0db5992311 replace_qualified_name_with_use keeps qualifier for import 2021-07-10 17:03:24 +02:00
vi_mi
57f119b5fa fix: Adding async keyword when await is present in generate_function assist 2021-07-09 20:04:55 +05:30
Lukas Wirth
d91704cac5 Invert boolean literals in assist negation logic 2021-07-06 20:30:26 +02:00
bors[bot]
112e53f10e
Merge #9500
9500: internal: Only inline closure, literal and local arguments when used once r=Veykril a=Veykril

See https://github.com/rust-analyzer/rust-analyzer/pull/9474#discussion_r663881507 for reasoning.

This still inlines single use closures and literals as naming these is usually not as useful. Prime examples being the Option/Result consuming functions like `map_or` etc.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-06 16:20:54 +00:00
Lukas Wirth
e71ae68b2d Only inline closure, literal and local arguments when used once 2021-07-05 16:43:16 +02:00
Lukas Wirth
46c42166d6 Yeet replace_unwrap_with_match in favor of inline_call 2021-07-05 15:47:55 +02:00
Lukas Wirth
dafbe6940e Wrap inlined closures in parens when inlined in an expression in inline_call 2021-07-05 15:42:11 +02:00
Lukas Wirth
2579dc6d82 Update inline_call assist doc example 2021-07-05 14:24:25 +02:00
bors[bot]
2bc4f9e371
Merge #9474
9474: fix: Inline parameters in `inline_call` if possible r=Veykril a=Veykril

Fixes #9491

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-05 11:50:18 +00:00
Lukas Wirth
ea02d27a1e Fixup emitted whitespace in most cases 2021-07-05 13:44:42 +02:00
Aleksey Kladov
86720f2953 minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
Lukas Wirth
e41b5348b8 replace_qualified_name_with_use insert qualified import paths 2021-07-03 23:42:59 +02:00
bors[bot]
e73328f22a
Merge #9477
9477: fix: Don't show an import per namespace in auto_import r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9113
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-03 20:13:14 +00:00
Lukas Wirth
05ec824ab7 Don't show an import per namespace in auto_import 2021-07-03 22:11:01 +02:00
Lukas Wirth
6181154d50 Add some more inline_call tests 2021-07-03 21:42:59 +02:00
bors[bot]
336194c09b
Merge #9476
9476: internal: overhaul codegen r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-03 19:26:04 +00:00
Aleksey Kladov
58d2ece88a internal: overhaul code generation
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.

This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
2021-07-03 22:11:03 +03:00
Lukas Wirth
d308f17a21 Inline parameters in inline_call if possible 2021-07-03 20:05:54 +02:00
bors[bot]
888bb6c452
Merge #9468
9468: feat: Make `inline_function` work on methods r=Veykril a=Veykril

Now called `inline_call`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-03 16:13:06 +00:00
Lukas Wirth
14e18bfa38 Merge the inline function/method assists into inline_call 2021-07-03 18:07:03 +02:00
Lukas Wirth
9c923068fb Don't hide meta lines 2021-07-03 12:16:07 +02:00
Lukas Wirth
688398febc feat: Implement inline_method assist 2021-07-03 01:33:34 +02:00