rust-analyzer/crates/hir/src
bors 84ef3cfa91 Auto merge of #17138 - Kohei316:generate-function-assist-for-new, r=Veykril
feature: Make generate function assist generate a function as a constructor if the generated function has the name "new" and is an asscociated function.

close #17050
This PR makes `generate function assist` generate a function as a constructor if the generated function has the name "new" and is an asscociated function.
If the asscociate type is a record struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self { field_1: todo!(), field_2: todo!() }
    }
}
```
If the asscociate type is a tuple struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self(todo!(), todo!())
    }
}
```
If the asscociate type is a unit struct, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        Self
    }
}
```
If the asscociate type is another adt, it generates the constructor like this.
```rust
impl Foo {
    fn new() -> Self {
        todo!()
    }
}
```
2024-04-30 12:09:34 +00:00
..
semantics Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
term_search chore: remove repetitive words 2024-03-19 22:14:13 +08:00
attrs.rs fix: Ignore generic arguments in intra doc link path resolution 2024-02-28 14:47:47 +01:00
db.rs Update per_query_memory_usage query listing 2024-04-17 18:44:50 +02:00
diagnostics.rs different error code based on variant 2024-04-23 20:54:03 +08:00
display.rs fix: remove space within {} when no fields in struct 2024-04-20 10:07:33 +08:00
from_id.rs Eagerly lower enum variants in CrateDefMap construction 2024-01-15 10:24:14 +01:00
has_source.rs internal: Improve rooted upmapping 2024-03-12 13:46:58 +01:00
lib.rs Auto merge of #17138 - Kohei316:generate-function-assist-for-new, r=Veykril 2024-04-30 12:09:34 +00:00
semantics.rs Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
source_analyzer.rs internal: Treat the self param as different from patterns when lowering 2024-03-11 09:46:28 +01:00
symbols.rs internal: Improve rooted upmapping 2024-03-12 13:46:58 +01:00
term_search.rs Add make_tuple tactic 2024-02-26 20:17:09 +02:00