Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexbaumgertner/e39dab37c86c7624f7722cb9cc39a1d7 to your computer and use it in GitHub Desktop.
Save alexbaumgertner/e39dab37c86c7624f7722cb9cc39a1d7 to your computer and use it in GitHub Desktop.
def el = __context__;
if (el instanceof com.intellij.lang.javascript.psi.JSReferenceExpression) {
while (true) {
el = el.getParent()
if (el == null) return false
if (el instanceof com.intellij.lang.javascript.psi.JSFunction) {
return __context__.getReferenceName().equals(el.getName())
}
}
}
return false;
@alexbaumgertner
Copy link
Author

alexbaumgertner commented Aug 22, 2020

<searchConfiguration name="functions" text="$name$($args$)" recursive="false" caseInsensitive="false" type="ECMAScript 6">
  <constraint name="__context__" script="&quot;def el = __context__;&#10;if (el instanceof com.intellij.lang.javascript.psi.JSReferenceExpression) {  &#10;  while (true) {&#10;    el = el.getParent()&#10;    if (el == null) return false&#10;    if (el instanceof com.intellij.lang.javascript.psi.JSFunction) {&#10;      return __context__.getReferenceName().equals(el.getName())&#10;    }&#10;  }&#10;} &#10;return false;&quot;" within="" contains="" />
  <constraint name="name" script="&quot;def el = __context__;  if (el instanceof com.intellij.lang.javascript.psi.JSReferenceExpression) {   while (true) {    el = el.getParent()         if (el == null) return false         if (el instanceof com.intellij.lang.javascript.psi.JSFunction) {      return __context__.getReferenceName().equals(el.getName())    }   } }  return false;&quot;" target="true" within="" contains="" />
  <constraint name="args" minCount="0" maxCount="2147483647" within="" contains="" />
</searchConfiguration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment