XFFXFF
e29a6780b1
restrict the assist so that it only appears if the cursor is on the loop keyword
2022-06-11 07:11:56 +08:00
XFFXFF
fac4d28012
change 'loop to 'l, as 'loop is not a valid label name
2022-06-11 07:11:56 +08:00
XFFXFF
0121cc1e29
make generated test pass and make tidy happy
2022-06-11 07:11:56 +08:00
XFFXFF
bb62180714
add more tests and some doc
2022-06-11 07:11:56 +08:00
XFFXFF
872536821c
Make add_label_to_loop basically work
2022-06-11 07:11:56 +08:00
bors
7b663a3a4a
Auto merge of #12464 - harpsword:fix-inline-variable-mismatched-type, r=Veykril
...
feat: fix inline variable produce mismatched type
wrap reference for RefExpr initializer to fix #12453
2022-06-10 20:24:06 +00:00
bors
e9d3fe0484
Auto merge of #12502 - Veykril:deps, r=Veykril
...
internal: Bump Dependencies
2022-06-10 19:51:04 +00:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
bjorn3
c81608c6d2
Fix a couple of weak warnings found by rust-analyzer itself
2022-06-08 14:35:11 +00:00
Lukas Wirth
fbffe73612
fix: Fix match to if let assist for wildcard pats
2022-06-05 01:02:24 +02:00
harpsword
061c5ef075
feat: fix inline variable produce mismatched type
...
wrap reference for RefExpr initializer
2022-06-04 17:07:28 +08:00
bors
43d9c3f649
Auto merge of #12460 - Veykril:move-guard, r=Veykril
...
minor: Reduce move-guard trigger range
2022-06-03 15:00:26 +00:00
Lukas Wirth
b34e27d25e
minor: Reduce move-guard trigger range
2022-06-03 17:00:03 +02:00
bors
58b6d46d5a
Auto merge of #12333 - nolanderc:order-import-assist, r=Veykril
...
Order auto-imports by relevance
Fixes #10337 .
Basically we sort the imports according to how "far away" the imported item is from where we want to import it to. This change makes it so that imports from the current crate are sorted before any third-party crates. Additionally, we make an exception for builtin crates (`std`, `core`, etc.) so that they are sorted before any third-party crates.
There are probably other heuristics that should be added to improve the experience (such as preferring imports that are common elsewhere in the same crate, and ranking crates depending on the dependency graph). However, I think this is a first good step.
PS. This is my first time contributing here, so please be gentle if I have missed something obvious :-)
2022-06-03 07:49:59 +00:00
iDawer
ea8899a445
Allow merging of multiple selected imports.
...
The selected imports have to have a common prefix in paths.
Before
```rust
$0use std::fmt::Display;
use std::fmt::Debug;$0
```
After
```rust
use std::fmt::{Display, Debug};
```
2022-06-02 23:15:55 +05:00
bors
2f0814ea35
Auto merge of #12347 - feniljain:fix_extract_module, r=Veykril
...
fix(extract_module) resolving import panics and improve import resolution
- Should solve #11766
- While adding a test case for this issue, I observed another issue:
For this test case:
```rust
mod x {
pub struct Foo;
pub struct Bar;
}
use x::{Bar, Foo};
$0type A = (Foo, Bar);$0
```
extract module should yield this:
```rust
mod x {
pub struct Foo;
pub struct Bar;
}
use x::{};
mod modname {
use super:❌ :Bar;
use super:❌ :Foo;
pub(crate) type A = (Foo, Bar);
}
```
instead it gave:
```rust
mod x {
pub struct Foo;
pub struct Bar;
}
use x::{};
mod modname {
use x::Bar;
use x::Foo;
pub(crate) type A = (Foo, Bar);
}
```
So fixed this problem with second commit
2022-06-02 12:37:17 +00:00
feniljain
8a1ef52f5c
fix(extract_module): Remove redundancy causing else, and also add import fix loop for names
2022-05-31 09:51:42 +05:30
Christofer Nolander
8e5b318d99
Cleanup auto-import ordering
...
Addresses issues raised by @Veykril in #12333
2022-05-28 11:32:07 +02:00
Amos Wenger
c06c4f9682
Make test pass
2022-05-25 18:31:08 +02:00
Amos Wenger
05563805b1
Add test for #12372 (generate enum variant in different file)
2022-05-25 18:18:08 +02:00
Amos Wenger
89e27ed0b9
Generate variant: insert code in file with enum definition
...
Closes #12372
2022-05-25 16:43:15 +02:00
Lukas Wirth
86d1d9067e
fix: Insert whitespace into trait-impl completions when coming from macros
2022-05-24 22:56:33 +02:00
Amos Wenger
ae2c0db67f
Pull text creation into the closure
2022-05-22 18:38:14 +02:00
Amos Wenger
796c4d8a10
Better lowercase/uppercase checks
2022-05-22 18:31:12 +02:00
feniljain
89f449b75d
fix(extract_module): import resolution for items of submodules
2022-05-22 17:11:15 +05:30
feniljain
ddd59b9a9a
fix(extract_module): nearby imports deletion causing panic
2022-05-21 19:13:49 +05:30
Christofer Nolander
068b138c87
Remove unecessary unwrap
2022-05-21 10:25:12 +02:00
Amos Wenger
707a5683b1
Still suggest generating enum methods if the name ref starts with a lowercase letter
2022-05-21 01:43:05 +02:00
Amos Wenger
0ed85beb15
Don't suggest enum variant if name_ref start with ASCII lowercase letter
2022-05-21 01:36:26 +02:00
Amos Wenger
7d716cbeb9
Simplify with adt.source()
2022-05-21 01:32:25 +02:00
Amos Wenger
2347da8c8d
Generate enum variant assist
...
This also disables "generate function" when what we clearly want is to
generate an enum variant.
Co-authored-by: Maarten Flippo <maartenflippo@outlook.com>
2022-05-21 01:18:35 +02:00
Christofer Nolander
aef16300f7
Order auto-imports by relevance
...
This first attempt prefers items that are closer to the module they are
imported in.
2022-05-21 00:07:06 +02:00
Jonas Schievink
e52d463524
Revert the "Add attribute" assist
2022-05-20 14:39:22 +02:00
Jonas Schievink
5279cdbefb
Include self type in generated getter/setter docs
2022-05-18 19:22:04 +02:00
Jonas Schievink
93b62dbe85
Improve docs generation assist
2022-05-18 18:05:21 +02:00
bors
187bd7d48a
Auto merge of #12130 - weirane:let-else-let-match, r=weirane
...
Turn let-else statements into let and match
Fixes #11906 .
2022-05-17 19:01:18 +00:00
weirane
4a0821f332
Simplify const reference check
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-05-17 11:43:53 -07:00
Jonas Schievink
cb135ae71b
Add a "Add attribute" assist
2022-05-17 20:28:25 +02:00
Jonas Schievink
1df6560fd8
Improve "Generate Deref
impl" assist
2022-05-16 20:10:46 +02:00
Jonas Schievink
54c8c39da0
Don't generate documentation in generate_setter
2022-05-16 19:27:27 +02:00
Jonas Schievink
f1b6e45fba
Handle getters and setters in documentation template assist
2022-05-16 19:10:38 +02:00
bors
bfb241afa3
Auto merge of #12188 - Veykril:auto-import, r=Veykril
...
fix: Allow auto importing starting segments of use items
2022-05-07 14:16:00 +00:00
Lukas Wirth
61e074f016
fix: Allow auto importing starting segments of use items
2022-05-07 15:52:22 +02:00
Lukas Wirth
0c4e23b8ef
internal: Remove unqualified_path completions module
2022-05-05 22:21:42 +02:00
Wang Ruochen
8d7a393008
Check const reference
2022-05-05 11:44:11 -07:00
Wang Ruochen
81d7cbbbe2
Avoid allocations
2022-05-05 10:14:11 -07:00
Maybe Waffle
e315124798
Remove "Sort methods by trait definition" assist
...
It was replaced by the "Sort items by trait definition" assist.
2022-05-04 00:59:23 +04:00
Maybe Waffle
2b20a05fc6
Add "Sort items by trait definition"
2022-05-03 19:57:39 +04:00
Maybe Waffle
d7ed351573
Fix some typos in ide-assists/src/lib.rs
2022-05-03 19:41:07 +04:00
Wang Ruochen
a70beea9e9
Trigger only when cursor is on else
2022-05-02 15:20:13 -07:00