fix: offer on path_type for add_lifetime_to_type#22332
Conversation
| } | ||
|
|
||
| fn trigger_assist(ctx: &AssistContext<'_, '_>) -> bool { | ||
| ctx.find_node_at_offset::<ast::RefType>() |
There was a problem hiding this comment.
I think it's better to check either for ast::Lifetime or for a without-lifetime ast::RefType. Technically it will be nice if the assist will also trigger for missing lifetime params in ADTs, but I think this is better done by having a diagnostic for this with a quickfix (that can supersede this assist).
There was a problem hiding this comment.
I think it's better to check either for
ast::Lifetimeor for a without-lifetimeast::RefType.
The text range of '_ is too small, which may not be conducive to user use
but I think this is better done by having a diagnostic for this with a quickfix (that can supersede this assist).
After the diagnostics stabilize, consider migration
Technically it will be nice if the assist will also trigger for missing lifetime params in ADTs
Good idea
There was a problem hiding this comment.
The text range of '_ is too small, which may not be conducive to user use
IMO it's confusing if we offer this on unrelated parts of the path.
|
This assist always needs to be applied or not triggered because it is unlikely to have a false positive Perhaps it's a good idea for the entire Adt application, what do you think? |
What do you mean? |
|
For an Adt in development, exists a missing lifetime argument:
|
|
Anyway, let's implement it this way first. I have placed an XXX comment |
Example
---
```rust
struct Foo {
a: &'_ i32,
b: Foo<'_$0>,
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
struct Foo<'a> {
a: &'a i32,
b: Foo<'a>,
}
```
850c4ef to
9331224
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
9331224 to
dae20ce
Compare
Example
Before this PR
Assist not applicable
After this PR