rust-analyzer/crates
bors 3077e6948d Auto merge of #17115 - leviska:json_is_not_rust_better_names, r=Veykril
Try to generate more meaningful names in json converter

I just found out about rust-analyzer json converter, but I think it would be more convenient, if names were more useful, like using the names of the keys.

Let's look at some realistic arbitrary json:

```json
{
    "user": {
        "address": {
            "street": "Main St",
            "house": 3
        },
        "email": "example@example.com"
    }
}
```
I think, new generated code is much easier to read and to edit, than the old:
```rust
// Old
struct Struct1{ house: i64, street: String }
struct Struct2{ address: Struct1, email: String }
struct Struct3{ user: Struct2 }

// New
struct Address1{ house: i64, street: String }
struct User1{ address: Address1, email: String }
struct Root1{ user: User1 }
```

Ideally, if we drop the numbers, I can see it being usable just as is (may be rename root)
```rust
struct Address{ house: i64, street: String }
struct User{ address: Address, email: String }
struct Root{ user: User }
```

Sadly, we can't just drop them, because there can be multiple fields (recursive) with the same name, and we can't just easily retroactively add numbers if the name has 2 instances due to parsing being single pass.
We could ignore the `1` and add number only if it's > 1, but I will leave this open to discussion and right now made it the simpler way

In sum, even with numbers, I think this PR still helps in readability
2024-04-21 16:09:17 +00:00
..
base-db Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
cfg Fix tests being non-deterministic 2024-04-19 13:22:00 +02:00
flycheck Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
hir Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
hir-def Add in-rust-tree feature to hir-expand 2024-04-20 18:44:27 +03:00
hir-expand Add in-rust-tree feature to hir-expand 2024-04-20 18:44:27 +03:00
hir-ty Add in-rust-tree feature to hir-expand 2024-04-20 18:44:27 +03:00
ide Render matched macro arm on hover of macro calls 2024-04-18 10:51:58 +02:00
ide-assists Add convert From to TryFrom assist 2024-04-19 08:29:20 +01:00
ide-completion Revert "Auto merge of #17073 - roife:better-inline-preview, r=Veykril" 2024-04-15 18:24:15 -04:00
ide-db Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
ide-diagnostics add test with multiple names 2024-04-20 21:04:53 +03: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 Extract common fields out of ProjectWorkspace variants 2024-04-21 17:03:02 +02:00
mbe Cleanup 2024-04-18 11:00:22 +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 Fix tests being non-deterministic 2024-04-19 13:22:00 +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 Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
rust-analyzer Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
salsa Fix new clippy lints 2024-04-01 17:55:56 +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 fix: replace unescape fn with the one in ra-ap-rustc_lexer 2024-04-19 20:32:53 +08:00
test-fixture Fix tests being non-deterministic 2024-04-19 13:22:00 +02:00
test-utils Fix new clippy lints 2024-04-01 17:55:56 +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 [vfs] Don't confuse paths with source roots that have the same prefix 2024-04-08 15:48:04 -07:00
vfs-notify fix: VFS should not walk circular symlinks 2024-04-17 14:40:01 -07:00