typeshare icon indicating copy to clipboard operation
typeshare copied to clipboard

Support for types generated by macros

Open axos88 opened this issue 1 year ago • 5 comments

Does typeshare support types generated by a macro? Is it something that could be implemented without too much effort? #49 seems to be related.

axos88 avatar Mar 10 '23 22:03 axos88

Currently, Typeshare parses source files as-is, without first expanding macros. This means that types (or any code) generated by a macro will not be considered when exporting types for other languages. Unfortunately, adding this functionality would likely require a significant investment, but it is something we'd like to get to at some point.

LuminaSapphira avatar Mar 13 '23 16:03 LuminaSapphira

Status update after today's triage meeting:

Implementing this would require essentially totally rewriting typeshare from scratch, a 2.0 level project. Currently this would be nice-to-have, but we have no plans to implement for the forseeable future.

Lucretiel avatar May 01 '23 17:05 Lucretiel

Just spitballing here, could cargo-expand help at all? Either in downstream toolchains or called from typeshare.

LuminaSapphira avatar May 03 '23 13:05 LuminaSapphira

cargo-expand would be one potential way to do it; another (the way I was leaning) would be to use --output-format json with rustdoc to produce machine-readable output from rustdoc, which typeshare would then ingest.

Lucretiel avatar May 04 '23 01:05 Lucretiel

+1, would really like this too.

FrozenDroid avatar Nov 18 '23 16:11 FrozenDroid