-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Generate rust type from json #12905
Conversation
&& 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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
596fd71
to
e70fb0d
Compare
There was a problem hiding this 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 x
s with it
? We prefer that for things that don't need a proper name
de9706b
to
802b3f6
Compare
Thanks! |
☀️ Test successful - checks-actions |
json-to-type.mp4 |
fix #10118
Should this be a diagnostic? I made it a diagnostic because of issue label.