rust-analyzer/crates
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
..
base-db Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
cfg fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
flycheck Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
hir Auto merge of #17138 - Kohei316:generate-function-assist-for-new, r=Veykril 2024-04-30 12:09:34 +00:00
hir-def fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
hir-expand fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
hir-ty fix: Fix attributes on generic parameters colliding in item tree 2024-04-27 13:15:36 +02:00
ide Auto merge of #17134 - Veykril:lt-err-display, r=Veykril 2024-04-25 07:36:47 +00:00
ide-assists Auto merge of #17138 - Kohei316:generate-function-assist-for-new, r=Veykril 2024-04-30 12:09:34 +00:00
ide-completion Add inlay hints lifetime arg tests 2024-04-25 09:10:49 +02:00
ide-db fix: Fix expression scopes not being calculated for inline consts 2024-04-25 09:49:19 +02:00
ide-diagnostics different error code based on variant 2024-04-23 20:54:03 +08:00
ide-ssr internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros 2024-04-14 16:02:38 +02:00
intern Fix new clippy lints 2024-04-01 17:55:56 +02:00
limit Simplify 2024-04-06 13:12:07 +02:00
load-cargo Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
mbe fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
parser internal: simplify TokenSet implementation 2024-04-15 17:33:09 +03:00
paths fix: Don't assert paths being utf8 when filtering them in the watcher 2024-03-22 08:04:50 +01:00
proc-macro-api Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
proc-macro-srv Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
proc-macro-srv-cli Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
profile Merge commit '574e23ec508064613783cba3d1833a95fd9a5080' into sync-from-ra 2024-03-10 08:47:38 +02:00
project-model Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
rust-analyzer Retry inlay hint requests 2024-04-29 09:53:12 +02:00
salsa fix: Fix expression scopes not being calculated for inline consts 2024-04-25 09:49:19 +02:00
sourcegen Fix new clippy lints 2024-04-01 17:55:56 +02:00
span Cleanup 2024-04-18 11:00:22 +02:00
stdx Remove dead test code 2024-03-14 16:24:51 +01:00
syntax Auto merge of #16938 - Nilstrieb:dont-panic-tests, r=Veykril 2024-04-21 16:22:02 +00:00
test-fixture Fix tests being non-deterministic 2024-04-19 13:22:00 +02:00
test-utils Peek for panic message in test output 2024-04-21 08:50:25 +02:00
text-edit Merge commit 'ddf105b646c6749a2de2451c9a499a354eec79c2' into sync-from-ra 2024-02-11 08:40:19 +02:00
toolchain internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
tt internal: Remove span trait 2024-03-21 20:08:30 +01:00
vfs chore: add some tracing to project loading 2024-04-22 11:39:01 -04:00
vfs-notify discard when the path is invalid utf8 symbol. 2024-04-30 15:39:05 +08:00