Grab All functions from js and vue files

Answered
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).
0
2 comments

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) {
...
}
}
})
1
Avatar
Permanently deleted user

Thank you Jakub!! That seems to be just what I am looking for!!!

0

Please sign in to leave a comment.