Kirill Bulatov
33c83e72b9
Work towards better import labels
2021-03-08 23:59:20 +02:00
Kirill Bulatov
89d410cef5
Do not propose already imported imports
2021-03-08 23:59:20 +02:00
Kirill Bulatov
9482353fa8
Properly handle turbofishes in qualifiers
2021-03-08 23:59:20 +02:00
Kirill Bulatov
582cee2cdf
Return more data about located imports
2021-03-08 23:59:18 +02:00
Kirill Bulatov
309421c117
Draft the qualifier import resolution
2021-03-08 23:58:48 +02:00
Kirill Bulatov
005bc49d74
Test and initial refactoring
2021-03-08 23:58:32 +02:00
Laurențiu Nicola
fc9eed4836
Use upstream cov-mark
2021-03-08 22:19:44 +02:00
Aleksey Kladov
9faf8dd69a
Hygiene is an internal implementation detail of the compiler
2021-03-08 22:14:52 +03:00
bors[bot]
d54e1157b6
Merge #7889
...
7889: Make group imports configurable r=lnicola a=asv1
Co-authored-by: asv <asv7c2@gmail.com>
2021-03-07 08:24:02 +00:00
asv
96fc01a30b
Make group imports configurable
2021-03-07 10:15:17 +02:00
Josh Mcguigan
d645b81b28
generate_function assist infer return type
2021-03-06 14:28:54 -08:00
bors[bot]
c44575b485
Merge #7896
...
7896: Only replace quotes in replace_string_with_char assist r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-06 20:22:36 +00:00
Lukas Wirth
1a276f8959
Only replace quotes in replace_string_with_char assist
2021-03-06 21:21:18 +01:00
bors[bot]
5480bed936
Merge #7800
...
7800: [WIP] 7708: Initial implementation of generate Default assist. r=Veykril a=chetankhilosiya
The Generate Default impl from new function.
Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-03-06 20:01:50 +00:00
Chetan Khilosiya
d40a4fc92c
7708: rust ideomatic code fixes.
2021-03-07 01:26:05 +05:30
bors[bot]
856c2850cd
Merge #7865
...
7865: preserve escape sequences when replacing string with char r=Veykril a=jDomantas
Currently it replaces escape sequence with the actual value, which is very wrong for `"\n"`.
Co-authored-by: Domantas Jadenkus <djadenkus@gmail.com>
2021-03-06 19:54:36 +00:00
Chetan Khilosiya
e4b6541c7a
7708: handle both FamousDefs fixture and plain code.
...
Also fix typo in example.
2021-03-07 00:51:48 +05:30
Chetan Khilosiya
9a84daf47d
7708: Added the updated implementation of is_default_implemented.
...
The implementation uses hir create to find the implemented trait.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
b8e6d6a606
7708: Added the logic to check is default impl is already present.
...
Also added test cases for code present within module.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
a59a97ae04
7708: Updated generate default fn logic.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
54b4727fa3
7708: Added the work for review comments.
...
Also added 1 test case to test multiple struct blocks are present.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
135c9e2027
7708: Fixed many documentaion example issues.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
69a6e4c80c
7708: Format code through rust-analyzer formatter.
2021-03-07 00:49:03 +05:30
Chetan Khilosiya
cb3f4d43d9
7708: Initial implementation of generate Default assist.
...
The Generate Default impl from new function.
2021-03-07 00:49:03 +05:30
Josh Mcguigan
e29b53f1e6
generate function assist convert arg names to lower snake case
2021-03-06 09:53:21 -08:00
bors[bot]
7199d5b56d
Merge #7869
...
7869: Add support for deref assignments to "pull assignment up" assist. r=Veykril a=Jesse-Bakker
Fixes #7867
Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-03-05 19:52:15 +00:00
Jesse Bakker
ab84a4746b
Add support for deref assignments to "pull assignment up" assist.
...
Fixes #7867
2021-03-05 20:42:23 +01:00
bors[bot]
2b55cce49e
Merge #7880
...
7880: Honor snippet capability when using the extract function assist r=lnicola a=Arthamys
This fixes issue #7793
Co-authored-by: san <san@alien.parts>
2021-03-05 16:24:32 +00:00
san
769b3bca28
Honor snippet capability in extract function assist
2021-03-05 17:20:26 +01:00
Domantas Jadenkus
5bb4aec05f
preserve escape sequences when replacing string with char
2021-03-03 23:20:18 +02:00
Jesse Bakker
1363d60111
Special-case parenthesized and negated expressions in demorgan assist
2021-03-03 13:18:24 +01:00
bors[bot]
0ce539ec96
Merge #7851
...
7851: Compress tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-02 15:46:02 +00:00
Aleksey Kladov
8471da62e6
Compress tests
2021-03-02 18:35:52 +03:00
Conrad Ludgate
2c3c728e0a
chore: remove redundant tests
2021-03-02 15:26:36 +00:00
Conrad Ludgate
b41e73ac12
chore: codegen
2021-03-02 14:55:37 +00:00
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