Last active
December 2, 2016 04:27
-
-
Save andresdominguez/aa3054f239edd867188bf008c2bc438f to your computer and use it in GitHub Desktop.
Find parameter list of the inject function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nullable | |
private JSParameterList findInjectParameterList(PsiFile file) { | |
// Recursively find all the call expressions in the file. | |
Collection<JSCallExpression> callExpressions = | |
PsiTreeUtil.findChildrenOfType(file, JSCallExpression.class); | |
for (JSCallExpression jsCallExpression : callExpressions) { | |
// Find the inject() element. | |
if (jsCallExpression.getText().startsWith("inject")) { | |
// Get the parameter list. Should be a child of the call expression. | |
return PsiTreeUtil.findChildOfType(jsCallExpression, JSParameterList.class); | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment