Use child in fix? #480
-
Hey there 👋 I'm trying to create a rule with a fix, that replaces the matched node with a child of the matched node. However, there doesn't seem to be a way (in the YAML syntax) to extract/select a child/field of a matched node. Is that correct? I discovered the "transform" mechanism, which seems to take some steps towards that. Concrete exampleGoal: Lift up the Sample input:
Sample output:
|
Beta Was this translation helpful? Give feedback.
Answered by
HerringtonDarkholme
Jun 28, 2023
Replies: 1 comment 2 replies
-
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hobofan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for using ast-grep. You can use relational rule to extract child.
link