Commit Graph

228 Commits

Author SHA1 Message Date
hi-rustin
f5ea2a2ab0 Remove attrs 2021-05-15 21:12:06 +08:00
hi-rustin
696a8bf870 Address comments and add more tests
Fix tests

Fmt code
2021-05-15 20:44:45 +08:00
hi-rustin
3f0222565d Generate the impl block via generate_trait_impl_text 2021-05-15 11:29:33 +08:00
Aleksey Kladov
883dd1568f internal: use more mutable APIs 2021-05-14 20:00:35 +03:00
Aleksey Kladov
6c21d04307 internal: use standard style for tests 2021-05-14 18:53:53 +03:00
Aleksey Kladov
cea589b3b5 internal: rewrite assoc item manipulaion to use mutable trees 2021-05-14 18:47:08 +03:00
bors[bot]
1552fdd3bc
Merge #8814
8814: fix: Keep doc comments and outer attrs on "Move module to file" assist r=Veykril a=Jesse-Bakker

Fixes #8804


Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-05-13 17:37:52 +00:00
bors[bot]
908cd23f81
Merge #8820
8820: fix: Return absolute paths in find_path if crate start is ambiguous r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-13 16:48:11 +00:00
mixio
0cb5443455
Corrected minor typo on line 20 2021-05-13 18:29:48 +02:00
Jesse Bakker
8c95b205a2 fix: Keep doc comments and outer attrs on "Move module to file" assist 2021-05-13 07:51:00 +02:00
Lukas Wirth
69e0b10150 Return absolute paths in find_path if crate start is ambiguous 2021-05-13 02:53:32 +02:00
bors[bot]
1c927d2f8e
Merge #8802
8802: Keep comments and attrs when extracting struct from enum variant r=Veykril a=DropDemBits

Fixes #6730

Still unsure if existing visibilities of fields should be forced to pub (which is what was previously done), or if it's okay to keep it in the extracted struct.

Co-authored-by: DropDemBits <r3usrlnd@gmail.com>
2021-05-12 14:42:01 +00:00
DropDemBits
7fefac4bdc
Keep comments and attrs when extracting struct from enum variant 2021-05-11 11:07:47 -04:00
bors[bot]
9fa9d166d8
Merge #8800
8800: feat: Make "pull assignments up" assist work in more cases r=Jesse-Bakker a=Jesse-Bakker

Fixes #8771

Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-05-11 13:14:55 +00:00
Jesse Bakker
5f37e34406 Make "pull assignments up" assist work in more cases 2021-05-11 15:14:23 +02:00
Lukas Wirth
6a8d47e7f0 Give MergeBehaviour variants better names 2021-05-10 21:14:59 +02:00
Aleksey Kladov
bf26e13cd2 simplify 2021-05-10 15:25:56 +03:00
Aleksey Kladov
4f3c0adc5a internal: introduce ast::make::ext module with common shortcuts
There's a tension between keeping a well-architectured minimal
orthogonal set of constructs, and providing convenience functions.
Relieve this pressure by introducing an dedicated module for
non-orthogonal shortcuts.

This is inspired by the django.shortcuts module which serves a similar
purpose architecturally.
2021-05-09 19:55:43 +03:00
Aleksey Kladov
680a0d54e4 internal: fix make API 2021-05-09 19:22:33 +03:00
Aleksey Kladov
5342800147 internal: rewrite **Repalce impl Trait** assist to mutable syntax trees 2021-05-09 18:20:37 +03:00
Aleksey Kladov
984d20aad8 cleanups 2021-05-09 18:01:54 +03:00
Aleksey Kladov
d9c9f6dc2c cleanups 2021-05-09 17:58:03 +03:00
Aleksey Kladov
edeb492782 minor: fix test style 2021-05-09 17:47:02 +03:00
bors[bot]
cf4d4f646b
Merge #8773
8773: fix: Correctly support SelfType when searching for usages r=Veykril a=Veykril

Fixes #7443

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-08 22:09:03 +00:00
Lukas Wirth
41f470fea8 Correctly support SelfType when searching for usages 2021-05-08 22:34:55 +02:00
Aleksey Kladov
1ee12b5db1 feat: add "mentoring instructions" test for pull up assist 2021-05-08 23:19:08 +03:00
Aleksey Kladov
1755b57e1a internal: pull_assignment_up uses mutable trees 2021-05-08 23:11:42 +03:00
Aleksey Kladov
e603090961 minor: add missing test 2021-05-08 20:40:07 +03:00
Aleksey Kladov
7ab4fd7628 internal: remove one more usage of SyntaxRewriter 2021-05-08 15:45:17 +03:00
Aleksey Kladov
1fdc9d8e9e internal: remove one more syntax rewriter 2021-05-08 14:47:14 +03:00
bors[bot]
6d812efcd9
Merge #8711
8711: Only resolve selected assist r=matklad a=SomeoneToIgnore

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

Now resolves only the assist that was selected out of the list, while before the whole assist list was resolved despite a single popup selection.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-05-04 11:51:09 +00:00
Aleksey Kladov
ae6b9c25ed internal: remove one more usage of the rewriter 2021-05-04 09:42:20 +03:00
Lukas Tobias Wirth
3d6d4e9855 Don't mutate the tree while traversing in reorder_impl 2021-05-03 18:36:31 +02:00
Kirill Bulatov
90fc329377 Index retrieval fix 2021-05-03 19:35:44 +03:00
Kirill Bulatov
53a73de3d1 Small fixes 2021-05-03 18:45:30 +03:00
Kirill Bulatov
8089a227f4 Tests added 2021-05-03 18:40:04 +03:00
Kirill Bulatov
28293d370f Add docs and use better naming 2021-05-03 18:16:35 +03:00
Kirill Bulatov
1679a376f3 Resolve single assist only 2021-05-03 18:03:28 +03:00
Kirill Bulatov
e5cdcb8b12 Add a way to resolve certain assists 2021-05-03 17:14:49 +03:00
Aleksey Kladov
1a01a5ae19 internal: fix naming polarity
Type Constructors have *parameters*, when they are substituted with type
*arguments*, we have a type.
2021-04-30 11:55:59 +03:00
Aleksey Kladov
cb3ef552e8 internal: normalize name
All def types in hir are unsubstituted
2021-04-30 11:52:31 +03:00
Lukas Wirth
050c69c19d Split out merge_imports module from helpers::insert_use 2021-04-24 13:31:43 +02:00
bors[bot]
5cbde9f531
Merge #8591 #8638
8591: Remove SyntaxRewriter usage in insert_use in favor of mutable syntax trees r=matklad a=Veykril

Unfortunately changing `insert_use` to not use `SyntaxRewriter` creates a lot of changes since so much relies on that. But on the other hand this should be the biggest usage of `SyntaxRewriter` I believe.

8638: Remove SyntaxRewriter::from_fn r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-23 16:49:08 +00:00
Lukas Wirth
e6e4417bbb Remove SyntaxRewriter::from_fn 2021-04-23 18:36:43 +02:00
bors[bot]
85bab7539a
Merge #8317
8317: Convert tuple struct to named struct assist r=Veykril a=unexge

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8192

Co-authored-by: unexge <unexge@gmail.com>
2021-04-23 13:37:48 +00:00
unexge
5e765895cf Add missing test case for "Convert to named struct" assist 2021-04-23 16:18:10 +03:00
unexge
97270dfb91 Stop iterating reference after made an edit in "Convert to named struct" assist 2021-04-23 13:08:07 +03:00
bors[bot]
0bb074aa26
Merge #8620
8620: Remove unnecessary braces for extracted block expression r=Veykril a=brandondong

This change addresses the first bullet point of https://github.com/rust-analyzer/rust-analyzer/issues/7839.

Specifically, when extracting block expressions, remove the unneeded extra braces inside the generated function.

Co-authored-by: Brandon <brandondong604@hotmail.com>
2021-04-22 15:22:43 +00:00
unexge
affd8d3518 Move reference editing logic into own function to make error handling more ease in "Convert to named struct" assist 2021-04-22 11:33:56 +03:00
Brandon
1713f4c7cd Remove unnecessary braces for extracted block expression 2021-04-21 23:39:35 -07:00