Conrad Ludgate
d4fad2be8d
refactor: re-use add_turbo_fish function
2021-03-02 14:30:11 +00:00
Conrad Ludgate
4a36129c7a
chore: fmt + docs
2021-03-02 14:30:10 +00:00
Conrad Ludgate
218390b9fb
chore: rename var
2021-03-02 14:30:10 +00:00
Conrad Ludgate
705712993f
feat: add type ascription assist
2021-03-02 14:30:10 +00:00
Vladyslav Katasonov
7066e6b362
strip useless methods, and unary ops in suggest_name
2021-03-02 16:25:24 +03:00
Vladyslav Katasonov
afc68277f6
pull out suggest_name::* to utils; enchance heuristics
2021-03-02 16:25:22 +03:00
Vladyslav Katasonov
f915ab79fa
suggest parameter name before function name
2021-03-02 16:23:00 +03:00
Vladyslav Katasonov
3b75dda745
try to suggest name when extracting variable
2021-03-02 16:23:00 +03:00
bors[bot]
2183d65c97
Merge #7777
...
7777: Implement line<->block comment assist r=Veykril a=djrenren
Fixes: https://github.com/rust-analyzer/rust-analyzer/issues/6515
Co-authored-by: John Renner <john@jrenner.net>
2021-03-02 08:04:38 +00:00
John Renner
f5cde97aae
Apply edits
2021-03-01 11:41:22 -08:00
Aleksey Kladov
406d96c7d4
Use consistent naming for assist
2021-02-28 21:14:34 +03:00
Aleksey Kladov
aa04e3bbb2
Don't spam loop-rewriting assist
...
The more focused the assist, the better!
2021-02-28 21:08:51 +03:00
Domantas Jadenkus
558bcf4e0b
generate try_into instead of into
2021-02-27 12:21:57 +02:00
Domantas Jadenkus
d4b6cbe5b6
rename generate_enum_match_method file to match assist name
2021-02-27 12:21:56 +02:00
Domantas Jadenkus
f098a2b31b
move into_ and as_ generation to a separate file
2021-02-27 12:21:06 +02:00
Domantas Jadenkus
6f25fef36a
cargo fmt
2021-02-27 12:06:00 +02:00
Domantas Jadenkus
e0f08fcc20
add generate_enum_as_method assist
2021-02-27 12:06:00 +02:00
Domantas Jadenkus
642786986f
deduplicate some
2021-02-27 12:05:59 +02:00
Domantas Jadenkus
2dcd5d7a7c
add generate_enum_into_method assist
2021-02-27 12:05:59 +02:00
Domantas Jadenkus
4ab285a8e5
make generate_enum_is_method work on any variants
2021-02-27 12:05:59 +02:00
Domantas Jadenkus
f67586066d
rename existing assist to generate_enum_is_method
2021-02-27 12:05:59 +02:00
Denys Zadorozhnyi
eb3c23588d
Disable "Flip comma" assist inside a macro call
2021-02-26 19:12:53 +02:00
Sanchith Hegde
3eaec3cd33
docs(ide_assists): Change importMergeBehaviour to importMergeBehavior
2021-02-26 12:54:50 +05:30
John Renner
9eecba4dbf
Implement line<->block comment assist
2021-02-24 17:13:00 -08:00
bors[bot]
dc14c432f5
Merge #7741
...
7741: Add convert_for_to_iter_for_each assist r=mattyhall a=mattyhall
Implements one direction of #7681
I wonder if this tries to guess too much at the right thing here. A common pattern is:
```rust
let col = vec![1, 2, 3];
for v in &mut col {
*v *= 2;
}
// equivalent to:
col.iter_mut().for_each(|v| *v *= 2);
```
I've tried to detect this case by checking if the expression after the `in` is a (mutable) reference and if not inserting iter()/iter_mut(). This is just a convention used in the stdlib however, so could sometimes be wrong. I'd be happy to make an improvement for this, but not sure what would be best. A few options spring to mind:
1. Only allow this for types that are known to have iter/iter_mut (ie stdlib types)
2. Try to check if iter/iter_mut exists and they return the right iterator type
3. Don't try to do this and just add `.into_iter()` to whatever is after `in`
Co-authored-by: Matt Hall <matthew@quickbeam.me.uk>
2021-02-24 19:24:22 +00:00
Matt Hall
a28e862825
Address further review comments
...
* Use known names for iter/iter_mut method (simplifies checking if the
method exists
* Extract code to check assist with fixtures to function
2021-02-24 19:23:12 +00:00
Lukas Wirth
694f7a7e9f
Add tests for apply_demorgan
2021-02-24 11:58:37 +01:00
lbrande
9db970ee08
De Morgan's Law assist now correctly inverts <, <=, >, >=.
2021-02-24 11:58:37 +01:00
lbrande
f7a4a87de2
De Morgan's Law assist now correctly parenthesizes binary expressions.
2021-02-24 11:58:37 +01:00
Matt Hall
98a626450d
Address review comments
...
* Move code to build replacement into closure
* Look for iter/iter_mut methods on types behind reference
2021-02-23 19:19:48 +00:00
Matt Hall
506293ca43
Add convert_for_to_iter_for_each assist
2021-02-23 18:10:01 +00:00
Chetan Khilosiya
e4756cb4f6
7526: Rename crate assists to ide_assists.
2021-02-23 00:59:16 +05:30