Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
208 stars 49 forks source link

auto-generate structs from JSON command #231

Open WebFreak001 opened 2 years ago

WebFreak001 commented 2 years ago

see goland

the idea of this command is to mainly aid in developing vibe.d applications, but would apply to other JSON areas too.

e.g. convert

{
    "name": "Bob",
    "foo": [],
    "bar": {
        "entries": [1, 2, 3]
    }
}

to

struct ${0:T}
{
    struct Bar
    {
        int[] entries;
    }

    string name;
    JSONValue[] foo; // or other types than JSONValue, e.g. when mir-ion, vibe.d or other popular JSON libraries are included
    Bar bar;
}

open questions: