frhagn / Typewriter

Automatic TypeScript template generation from C# source files
http://frhagn.github.io/Typewriter
Apache License 2.0
537 stars 132 forks source link

$Classes cannot find record classes #337

Open KeithHenry opened 3 years ago

KeithHenry commented 3 years ago

C#9 introduces record as a immutable class, with a new terse syntax.

So instead of:

public class Person {
    public Person(string name) { this.Name = name; }
    public string Name { get; private set; }
}

We can now do:

public record Person(string Name);

This creates a special class that is read only and has built-in value equality.

Unfortunately $Classes cannot find any of these record classes, and there doesn't appear to be any way to include them in template output.

Either:

dperetz1 commented 3 years ago

any workaround?

AdaskoTheBeAsT commented 3 years ago

I forked sources and started to work on this - is seems it cannot be realised by CodeDom but only Roslyn (or I am wrong ;)). when I will have some working code a I will release it as some unofficial fork

dperetz1 commented 3 years ago

I forked sources and started to work on this - is seems it cannot be realised by CodeDom but only Roslyn (or I am wrong ;)). when I will have some working code a I will release it as some unofficial fork

Cool, thanks. why not making a PR to the official repo?

AdaskoTheBeAsT commented 3 years ago

it seems that Fredrik is quite busy - my last PR is waiting for more than a year https://github.com/frhagn/Typewriter/pull/322

AdaskoTheBeAsT commented 3 years ago

Unofficial release https://github.com/AdaskoTheBeAsT/Typewriter/releases/tag/1.30.0

dperetz1 commented 3 years ago

Unofficial release https://github.com/AdaskoTheBeAsT/Typewriter/releases/tag/1.30.0

Thank you very much :smiley: . I'm sorry if it's a dumb question but - @frhagn, although you're probably busy, I think it's quite important - would you accept a PR for it? (so it will be official)

s4m0r4m4 commented 3 years ago

@AdaskoTheBeAsT - I have had a similar experience that the repo owner is busy and non-responsive, no judgement from me, it happens. If you were interested in hosting a "v2" repo, I would be able to support and help gather other open-source developers - I've seen a lot of interest from others on this repo in getting a new version off the ground and I'd be happy to help direct them to your repo if you'd like to use it for an official v2 and accept PRs from others.

luizfbicalho commented 3 years ago

I would try to help too

AdaskoTheBeAsT commented 3 years ago

Ok let me try - I am thinking if it still need to be done as vsix or there is possibility to incorporate new source generator thingy

s4m0r4m4 commented 3 years ago

Sounds good. I would recommend setting up a repo (or using your fork) just to release a new version of the vsix (seems like you've basically already got that), and then you can work on moving towards a different tech stack.

There was some good discussion on this thread: https://github.com/frhagn/Typewriter/issues/317 about the possibility of moving to a compile-time setup using Source Generators, or perhaps even an npm script. That being said, I think just getting a functional repo again that uses the same .tst syntax would be a huge win and you could go from there.

johnknoop commented 3 years ago

Great to see someone making this effort. I've evaluated a bunch of other C#->TS generators, but none come close in terms of customizability, and it's a shame that the project is effectively abandoned.

If you could modernize it in the ways mentioned by @s4m0r4m4 and perhaps remove the dependency on Visual Studio (a lot of folks just use VS Code nowadays) it would be even better, but as you state, getting a live repository up and running is a great step in the right direction.

s4m0r4m4 commented 3 years ago

@AdaskoTheBeAsT any luck setting up a new repo? I'd love to contribute

AdaskoTheBeAsT commented 3 years ago

hi sorry I am in the middle of changing job right now - it will take some time...