We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like to be able to use meta variable that captured outside of rewrite rule inside it.
Here is my case I tried to replace spread with set of calls.
Source:
createService( ...c.resolve("A", "B", "С") )
Goal:
createService( c.resolve("A"), c.resolve("B"), c.resolve("C") )
Rule:
# YAML Rule is more powerful! # https://ast-grep.github.io/guide/rule-config.html#rule rule: kind: spread_element has: kind: call_expression pattern: $NAME.resolve($$$IDENTS) rewriters: - id: rewrite-identifer rule: pattern: $IDENT kind: string fix: $NAME.resolve($IDENT) transform: RESOLVES: rewrite: rewriters: [rewrite-identifer] source: $$$IDENTS joinBy: "\n" fix: $RESOLVES
$NAME is empty inside the rewriters. I suggest to make external context available.
$NAME
rewriters
Additional Links:
The text was updated successfully, but these errors were encountered:
thanks for reporting. I will try to implement it in 0.21.x releases
Sorry, something went wrong.
feat: support referencing metavar outside rewriter
35de3ef
part of #1072
2deb8c4
No branches or pull requests
⭐ Suggestion
I would like to be able to use meta variable that captured outside of rewrite rule inside it.
💻 Use Cases
Here is my case
I tried to replace spread with set of calls.
Source:
Goal:
Rule:
$NAME
is empty inside therewriters
.I suggest to make external context available.
Additional Links:
The text was updated successfully, but these errors were encountered: