Skip to content

Generate rust type from json #12905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 8, 2022
Merged

Generate rust type from json #12905

merged 3 commits into from
Aug 8, 2022

Conversation

HKalbasi
Copy link
Member

fix #10118

Should this be a diagnostic? I made it a diagnostic because of issue label.

&& node.first_token().map(|x| x.kind()) == Some(SyntaxKind::L_CURLY)
&& node.last_token().map(|x| x.kind()) == Some(SyntaxKind::R_CURLY)
{
let node_string = node.to_string();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to not create a new string here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could fetch the file's backing string and indexing into that with the node's range

@HKalbasi HKalbasi force-pushed the master branch 6 times, most recently from 596fd71 to e70fb0d Compare August 2, 2022 17:06
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General nit, can you replace the xs with it? We prefer that for things that don't need a proper name

@HKalbasi HKalbasi force-pushed the master branch 2 times, most recently from de9706b to 802b3f6 Compare August 6, 2022 15:06
@Veykril
Copy link
Member

Veykril commented Aug 8, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Aug 8, 2022

📌 Commit 851f6db has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 8, 2022

⌛ Testing commit 851f6db with merge 3805067...

@bors
Copy link
Contributor

bors commented Aug 8, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 3805067 to master...

@bors bors merged commit 3805067 into rust-lang:master Aug 8, 2022
@lnicola
Copy link
Member

lnicola commented Aug 15, 2022

json-to-type.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate Rust type from JSON
5 participants