Lukas Wirth
774a8cf08b
Fix inline_call breaking RecordExprField shorthands
2021-09-28 19:22:32 +02:00
Lukas Wirth
b6ed91a6de
Rename *Owner
traits to Has*
2021-09-27 12:54:24 +02:00
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
bors[bot]
c51a3c78cf
Merge #10358
...
10358: internal: Remove inherent methods from ast nodes that do non-syntactic complex tasks r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-26 14:49:25 +00:00
Lukas Wirth
151afdfe5c
Remove inherent methods from ast node that carry semantic meaning
2021-09-26 16:49:03 +02:00
bors[bot]
cd7b26c6eb
Merge #10352
...
10352: feat: Implement inline callers assist r=Veykril a=Veykril
Fixes #7242
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-26 14:02:25 +00:00
Lukas Wirth
215a077ee4
Remove imports when inlining all calls in a file
2021-09-26 16:01:54 +02:00
Lukas Wirth
79c70d0ad3
Simplify
2021-09-26 14:56:43 +02:00
Lukas Wirth
1a50f904ef
Reject recursive calls in inline_call
2021-09-26 14:55:03 +02:00
Lukas Wirth
1ccb21a0ca
feat: Implement inline callers assist
2021-09-25 18:39:43 +02:00
bors[bot]
d401f2a062
Merge #10211
...
10211: assists: Promote module to folder r=jonas-schievink a=longfangsong
Close part of #10143 .
This PR adds a assist to promote module to directory, which means make a .rs file module into a directory style module with the same name.
![未命名(1)](https://user-images.githubusercontent.com/13777628/132958377-14555d6f-a64a-4b9b-9154-90a3b86fd685.gif )
Co-authored-by: longfangsong <longfangsong@icloud.com>
2021-09-25 15:32:00 +00:00
longfangsong
22abbe86f3
Address comments
2021-09-25 22:48:57 +08:00
Aleksey Kladov
d72f7cf3af
internal: add => () rule; emphasize n_items
rule
2021-09-25 14:10:25 +03:00
zhoufan
8690cfb868
Change the style of the code
2021-09-22 06:32:23 +08:00
zhoufan
7912d3a4b3
Generate function assist creates bad param names for const/static item args
2021-09-22 00:15:57 +08:00
Lukas Wirth
ba84b91e78
Add a mirror function-like proc-macro expander for tests
2021-09-21 14:55:54 +02:00
Lukas Wirth
8b1e8197fe
Merge iter_for_each_to_for and for_to_iter_for_each assists modules
2021-09-21 10:34:11 +02:00
Lukas Wirth
8b2be8572f
Rename some assists
2021-09-21 00:54:09 +02:00
longfangsong
cd599ec202
Address comments
2021-09-20 21:37:18 +08:00
rainy-me
11fbafdee3
Narrow "if-let to match" assist available range
2021-09-18 05:28:52 +09:00
bors[bot]
d44779f8a5
Merge #10260
...
10260: fix: fix names generation in `Generate function` r=Veykril a=iDawer
- Improve fn name computation (close #10176 ).
- Handle tuple indexing expressions in argument position (should close #10241 )
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-17 18:35:36 +00:00
Andrzej Głuszak
11a56f886b
assists: turn while into loop
2021-09-16 22:20:27 +02:00
Dawer
1d94e234d5
Handle tuple indexing expression in argument position in Generate function
2021-09-16 23:45:41 +05:00
Dawer
4dc33140a3
Imrove fn name computation in Generate function
2021-09-16 21:03:37 +05:00
Lukas Wirth
747f2d1719
fix: Do not wrap inlined local in parens when at block tail position
2021-09-14 18:29:34 +02:00
Lukas Wirth
a044175412
Simplify
2021-09-13 18:50:19 +02:00
Aleksey Kladov
46cdde75f8
internal: document tribal knowledge of how to assist
2021-09-13 14:19:10 +03:00
Aleksey Kladov
076c972e3b
internal: prevent possible bugs when adding magical comments
2021-09-13 13:43:13 +03:00
longfangsong
cafc7e3501
Fix doc test
2021-09-12 11:20:28 +08:00
longfangsong
3edc25dc26
Add docs strings
2021-09-12 10:53:56 +08:00
longfangsong
fede1a3beb
Add promote_mod_file assist
2021-09-12 10:45:14 +08:00
Dawer
535761e63f
minor: update test
2021-09-04 15:19:44 +05:00
Dawer
3d9d10be39
fix: use placeholder as default type in Extract into function
.
2021-09-04 14:25:17 +05:00
Dawer
a6c650edf6
fix: use placeholder as default type in Generate function
.
2021-09-04 14:24:54 +05:00
Yotam Ofek
dd9433cc63
Update crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs
...
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-03 21:02:48 +03:00
Yotam Ofek
0d453cc2be
Fix replacing for loops over ranges with for_each.
2021-09-03 19:43:40 +03:00
Lukas Wirth
8e8ea537ab
Deduplicate imports for qualify_path
2021-09-01 21:51:28 +02:00
Daiki Ihara
4d005e529b
Fix extract_function with macro arg
2021-09-01 11:11:57 +02:00
DropDemBits
3bafb5f025
feat: Use enum's visibility for extracted struct fields
2021-08-30 21:33:19 -04:00
DropDemBits
95bf89d3c8
fix: Keep comments & attrs from enum variant
2021-08-30 21:33:12 -04:00
DropDemBits
681efe6dcb
feat: Properly indent extracted struct and enum
2021-08-30 21:26:21 -04:00
bors[bot]
d250aa77ec
Merge #10015
...
10015: internal: more declarative re-indentation API r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-30 08:34:49 +00:00
Aleksey Kladov
78365c64c8
internal: slightly improve compile times
...
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Lukas Wirth
5c3a93ca9e
Remove incorrect assertion in extract_function
2021-08-27 19:58:57 +02:00
Aleksey Kladov
d1cd81f387
internal: more declarative re-indentation API
2021-08-24 18:18:43 +03:00
bors[bot]
6287d388c0
Merge #9944
...
9944: internal: introduce in-place indenting API r=matklad a=iDawer
Introduce `edit_in_place::Indent` that uses mutable tree API and intended to replace `edit::AstNodeEdit`.
Closes #9903
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-08-24 13:11:50 +00:00
bors[bot]
43021525e5
Merge #9994
...
9994: add static method generation assist r=matklad a=mahdi-frms
Adds feature: #9948
Will soon send a GIF for the changelog.
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-08-24 09:26:52 +00:00
bors[bot]
ced65f77c4
Merge #10001
...
10001: Sort enum variant r=Veykril a=vsrs
A small fix to the problem noted by `@lnicola` :
> ![sort-fields](https://user-images.githubusercontent.com/308347/129513196-4ffc7937-be58-44d4-9ec7-ba8745dcb460.gif )
>
> (note the slight inconsistency here: to sort the variants of `Animal` I have to select the enum name, but to sort the fields of `Cat` I have to select the fields themselves)
Co-authored-by: vsrs <vit@conrlab.com>
2021-08-23 22:19:50 +00:00
vsrs
7a8f881a09
Sort enum variant
2021-08-23 20:31:54 +03:00
mahdi-frms
cf5f1c102c
add static method generation assist
2021-08-23 12:14:23 +04:30