| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
7898: generate_function assist: infer return type r=JoshMcguigan a=JoshMcguigan
This PR makes two changes to the generate function assist:
1. Attempt to infer an appropriate return type for the generated function
2. If a return type is inferred, and that return type is not unit, don't render the snippet
```rust
fn main() {
let x: u32 = foo$0();
// ^^^ trigger the assist to generate this function
}
// BEFORE
fn foo() ${0:-> ()} {
todo!()
}
// AFTER (only change 1)
fn foo() ${0:-> u32} {
todo!()
}
// AFTER (change 1 and 2, note the lack of snippet around the return type)
fn foo() -> u32 {
todo!()
}
```
These changes are made as two commits, in case we want to omit change 2. I personally feel like it is a nice change, but I could understand there being some opposition.
#### Pros of change 2
If we are able to infer a return type, and especially if that return type is not the unit type, the return type is almost as likely to be correct as the argument names/types. I think this becomes even more true as people learn how this feature works.
#### Cons of change 2
We could never be as confident about the return type as we are about the function argument types, so it is more likely a user will want to change that. Plus it is a confusing UX to sometimes have the cursor highlight the return type after triggering this assist and sometimes not have that happen.
#### Why omit unit type?
The assumption is that if we infer the return type as unit, it is likely just because of the current structure of the code rather than that actually being the desired return type. However, this is obviously just a heuristic and will sometimes be wrong. But being wrong here just means falling back to the exact behavior that existed before this PR.
Co-authored-by: Josh Mcguigan <[email protected]>
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
7889: Make group imports configurable r=lnicola a=asv1
Co-authored-by: asv <[email protected]>
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
7896: Only replace quotes in replace_string_with_char assist r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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 <[email protected]>
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Also fix typo in example.
|
| | | |
| | | |
| | | |
| | | | |
The implementation uses hir create to find the implemented trait.
|
| | | |
| | | |
| | | |
| | | | |
Also added test cases for code present within module.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Also added 1 test case to test multiple struct blocks are present.
|
| | | | |
|
| | | | |
|
| | |/
| |/|
| | |
| | | |
The Generate Default impl from new function.
|
|\ \ \
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | | |
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 <[email protected]>
|
| | | |
|
| |/
|/| |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
7869: Add support for deref assignments to "pull assignment up" assist. r=Veykril a=Jesse-Bakker
Fixes #7867
Co-authored-by: Jesse Bakker <[email protected]>
|
| |/
| |
| |
| | |
Fixes #7867
|
|\ \
| |/
|/|
| |
| |
| |
| |
| | |
7880: Honor snippet capability when using the extract function assist r=lnicola a=Arthamys
This fixes issue #7793
Co-authored-by: san <[email protected]>
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
7851: Compress tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| |
| | |
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 <[email protected]>
|
| | |
|
| | |
|