Yoshua Wuyts
f64aacc0c1
Use minicore
2021-08-08 18:58:42 +02:00
Lukas Wirth
3b7c713af3
Implement if_to_bool_then assist
2021-08-08 17:56:34 +02:00
Yoshua Wuyts
dcbf385ffc
use make::name_ref
2021-08-08 16:31:28 +02:00
Yoshua Wuyts
e26ba72333
Update replace_derive_with_manual_impl.rs
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
a2e5fc659d
Improve naming and add comments
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
720508a2df
dedup struct debug impl code
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
cc3ff1b486
Fix enum debug indent level
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
4b7ae9fedc
generate Debug for enums
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
a1f2c7adcd
rename variables
...
According to https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#variable-naming
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
aa09141a8a
finish debug_struct impls
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
fd7236c791
debug for record field structs
2021-08-08 16:26:25 +02:00
Yoshua Wuyts
e2ab2e12a0
wip
2021-08-08 16:24:54 +02:00
Irina Shestak
f2e547d587
impl Debug def from trait
2021-08-08 16:24:54 +02:00
Lukas Wirth
c4a119f433
Simplify
2021-08-07 22:16:15 +02:00
Lukas Wirth
b6d574642d
extract_type_alias extracts generics correctly
2021-08-05 02:54:06 +02:00
Lukas Wirth
01413dd7d4
extract_function does not move locals defined outside of loops
2021-08-04 20:00:45 +02:00
Lukas Wirth
29c4ae6f9a
extract_assist
is aware of the expression owner
2021-08-03 20:47:51 +02:00
Lukas Wirth
9edaf0cad8
extract_function is const
aware
2021-08-03 18:43:28 +02:00
Lukas Wirth
e62ce6f61a
Reorganize functions in extract_function assist
2021-08-03 18:24:33 +02:00
Lukas Wirth
027a99fc70
Do no tear comments apart in extract_function assist
2021-08-03 17:39:49 +02:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2
Revise TypeInfo::ty usage
2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
vsrs
cc33b0dc82
Update the docs
2021-08-02 20:24:18 +03:00
vsrs
6031dee145
Enable assist only if an item is selected
2021-08-02 19:58:41 +03:00
vsrs
e71b239d37
fix generated tests
2021-08-02 19:49:36 +03:00
vsrs
0088f84c88
Allow several samples in "// Assist:" comments.
2021-08-02 19:49:36 +03:00
vsrs
580e5e277a
Some comment tests
2021-08-02 19:49:36 +03:00
vsrs
4fa66f1e1e
Sort struct enum variant fields
2021-08-02 19:49:36 +03:00
vsrs
6f8888cfe7
Sort enums
2021-08-02 19:49:36 +03:00
vsrs
2c7e99b209
Sort unions
2021-08-02 19:49:36 +03:00
vsrs
b31bf74c13
cargo fmt
2021-08-02 19:49:36 +03:00
vsrs
0694f18636
Sort struct fields
2021-08-02 19:49:36 +03:00
vsrs
643f3931f7
Sort trait and impl methods
2021-08-02 19:49:36 +03:00
Lukas Wirth
432bb222c3
Simplify inline_local_variable assist
2021-08-02 15:27:47 +02:00
bors[bot]
93873b0ce1
Merge #9739
...
9739: generate function assist favors deref cmpt types r=matklad a=mahdi-frms
Fixes #9713
Although that's still not relying on sematic info.
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-31 15:08:29 +00:00
Lukas Wirth
b363755901
Fix hover range for derive inputs
2021-07-31 14:59:31 +02:00
Lukas Wirth
7c7c4543da
Replace useless types
2021-07-31 14:29:15 +02:00
Lukas Wirth
778e6e8ba8
add_explicit_type is applicable for closure parameters
2021-07-31 14:04:34 +02:00
mahdi-frms
a5edf6de79
generate function assist favors deref cmpt types
2021-07-31 16:34:09 +04:30
bors[bot]
1f817833e7
Merge #9727
...
9727: internal: Simplify extract_function assist r=Veykril a=Veykril
also fixes #7839(blocked on #9728 )
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:56:50 +00:00
Lukas Wirth
3e351cc0ba
Add trailing comma when extracting match arm expressions into functions
2021-07-30 16:48:13 +02:00
bors[bot]
4cc961007f
Merge #9731
...
9731: feat: Add `replace_char_with_string` assist r=Veykril a=Veykril
Adds the counterpart for the `replace_string_with_char` assist and fixes the assist not escaping the `'` in the string `"'"` when transforming that to a char.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:47:38 +00:00
Lukas Wirth
17a47a830b
Add replace_char_with_string assist
2021-07-30 16:46:06 +02:00
bors[bot]
0a3ac7a96c
Merge #9728
...
9728: fix: Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:11:37 +00:00
Lukas Wirth
82c1e61887
Fix assists assuming comma belonging to MATCH_ARM_LIST
2021-07-30 16:01:26 +02:00
Lukas Wirth
322513b06c
Reorder definitions in extract_function
2021-07-29 22:10:40 +02:00
Lukas Wirth
b21f66fce3
Simplify extract_function assist
2021-07-29 22:07:56 +02:00
bors[bot]
8232804d3e
Merge #9706
...
9706: minor: perf and grammar fixes r=lnicola a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-29 16:14:10 +00:00
Lukas Wirth
b537cb186e
Use more strictly typed syntax nodes for analysis in extract_function assist
2021-07-29 17:26:37 +02:00
Lukas Wirth
2b461c50d7
Refine extraction targets of extract_function assist
2021-07-29 15:45:05 +02:00
Jonas Schievink
18f86baa62
Stop reexporting hir_def
's ItemInNs
from HIR
2021-07-28 17:39:04 +02:00
Laurențiu Nicola
636933153d
Small grammar fix
2021-07-28 12:40:21 +03:00
Lukas Wirth
456f5c6d09
Don't qualify self as crate in add_missing_impl_members assist
2021-07-27 19:29:47 +02:00
bors[bot]
d571ca814e
Merge #9593
...
9593: fix: Adding remove_unused_param for method and fixing same for assoc func r=matklad a=feniljain
Solves #9571
Co-authored-by: vi_mi <fenil.jain2018@vitstudent.ac.in>
2021-07-26 10:36:31 +00:00
Lukas Wirth
0a13259fc6
Kepp catch-all arm in fill_match_arms if it has a non-empty expression
2021-07-25 15:51:47 +02:00
Lukas Wirth
bfe0fa009e
Resolve derive attribute input macro paths in ide layer
2021-07-24 20:35:43 +02:00
bors[bot]
0bee7cb716
Merge #9453
...
9453: Add first-class limits. r=matklad,lnicola a=rbartlensky
Partially fixes #9286 .
This introduces a new `Limits` structure which is passed as an input
to `SourceDatabase`. This makes limits accessible almost everywhere in
the code, since most places have a database in scope.
One downside of this approach is that whenever you query limits, you
essentially do an `Arc::clone` which is less than ideal.
Let me know if I missed anything, or would like me to take a different approach!
Co-authored-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2021-07-22 10:33:05 +00:00
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
Robert Bartlensky
0b3d0cde8b
Add Limit
struct.
...
Fixes #9286 .
2021-07-19 13:26:11 +01:00
vi_mi
0898d3b637
add: fix: Adding remove_unused_param for method and fixing same for associative func
2021-07-18 12:06:21 +05:30
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