7894: generate_function assist: convert arg names to lower snake case r=Veykril a=JoshMcguigan
This PR fixes one of the points listed by @TimoFreiberg in #3639. Specifically that all generated argument names should be converted to lower snake case.
```rust
struct BazBaz;
fn foo() {
bar$0(BazBaz);
// ^ when triggering the assist here, you get the output below
}
// BEFORE
fn bar(BazBaz: BazBaz) ${0:-> ()} {
todo!()
}
// AFTER
fn bar(baz_baz: BazBaz) ${0:-> ()} {
todo!()
}
```
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
7888: Add a line about code action commands to the CoC section of the docs r=lnicola a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
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>
7870: Use chalk_ir::AdtId r=Veykril a=Veykril
It's a bit unfortunate that we got two AdtId's now(technically 3 with the alias in the chalk module but that one won't allow pattern matching), one from hir_def and one from chalk_ir(hir_ty). But the hir_ty/chalk one doesn't leave hir so it shouldn't be that bad I suppose. Though if I see this right this will happen for almost all IDs.
I imagine most of the intermediate changes to using chalk ids will turn out not too nice until the refactor is over.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
7862: Remove incorrect broken test r=jonas-schievink a=jonas-schievink
`Struct` cannot be named at all in that position, since `super` doesn't
resolve to the block scope
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
7824: feat: add type ascription r=matklad a=conradludgate
Based on this conversation: https://twitter.com/rust_analyzer/status/1366092401278922757
Built off of `add_turbo_fish`, finds the current `let` statement, checks if it has type/turbofish already and checks if the rhs function is generic.
There's one case I couldn't figure out how to implement that would be nice:
```rust
#[test]
fn add_type_ascription_function_result() {
check_assist(
add_type_ascription,
r#"
fn make<T>() -> Result<T, &'static str> {}
fn main() {
let x = make()$0;
}
"#,
r#"
fn make<T>() -> Result<T, &'static str> {}
fn main() {
let x: Result<${0:_}, &'static str> = make();
}
"#,
);
}
```
The `Function::ret_type` fn wasn't returning anything much useful so I'm not sure how to identity such scenarios just yet
Co-authored-by: Conrad Ludgate <conradludgate@gmail.com>