| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
7562: add `generate_enum_match` assist r=matklad a=yoshuawuyts
This adds a `generate_enum_match` assist, which generates `is_` variants for enums (e.g. `Option::{is_none,is_some}` in std). This is my first attempt at contributing to Rust-Analyzer, so I'm not sure if I've gotten everything right. Thanks!
## Example
**Input**
```rust
pub(crate) enum Variant {
Undefined,
Minor, // cursor here
Major,
}
```
**Output**
```rust
pub(crate) enum Variant {
Undefined,
Minor,
Major,
}
impl Variant {
pub(crate) fn is_minor(&self) -> bool {
matches!(self, Self::Minor)
}
}
```
## Future Directions
I made this as a stepping stone for some of the more involved refactors (e.g. #5944). I'm not sure yet how to create, use, and test `window.showQuickPick`-based asssists in RA. But once that's possible, it'd probably be nice to be able to generate match methods in bulk through the quickpick UI rather than one-by-one:
```
[x] Select enum members to generate methods for. (3 selected) [ OK ]
---------------------------------------------------------------------------
[x] Undefined
[x] Minor
[x] Major
```
Co-authored-by: Yoshua Wuyts <[email protected]>
Co-authored-by: Yoshua Wuyts <[email protected]>
|
| | |
|
|/
|
|
|
|
|
|
| |
there are a few currently limitations:
* no modifications of function body
* does not handle mutability and references
* no method support
* may produce incorrect results
|
|
|
|
| |
Signed-off-by: Benjamin Coenen <[email protected]>
|
|
|
|
| |
Signed-off-by: Benjamin Coenen <[email protected]>
|
| |
|
|
|
|
| |
Closes #6110
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Vertical code motions are conventionally called "pull up" / "push
down".
"extract" is used for introducing new names.
|
| |
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Benjamin Coenen <[email protected]>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
6256: Assist: replace string with char r=bnjjj a=bnjjj
close #6252
Co-authored-by: Benjamin Coenen <[email protected]>
Co-authored-by: Coenen Benjamin <[email protected]>
|
| |
| |
| |
| | |
Signed-off-by: Benjamin Coenen <[email protected]>
|
|/ |
|
|
|
|
| |
Signed-off-by: Benjamin Coenen <[email protected]>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|