Grab All functions from js and vue files
已回答
I am trying to figure out how I can grab all the function and parameters from js and vue files but have not found any. I did some reading on psiFiles but that looks to just be for Java(if I am wrong feel free to correct me).
请先登录再写评论。
Zachary, you can use the PsiViewer plugin to check the PSI structure of the JavaScript file. For the following file:
function foo(bar) {return true
}
it looks like:
Thanks to that information, you may walk through the tree using, i.e.:
psiFile.acceptChildren(object : PsiElementVisitor() {override fun visitElement(element: PsiElement) {
if (element is JSFunction) {
...
}
}
})
Thank you Jakub!! That seems to be just what I am looking for!!!