Skip to content

Commit

Permalink
Merge pull request #150 from Vlatombe/more-view-types-in-structure
Browse files Browse the repository at this point in the history
Add support for groovy views as well as help files in the structure view
  • Loading branch information
duemir authored Apr 27, 2023
2 parents 2402c41 + 68de68c commit 3452cb1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiPackage;
import org.kohsuke.stapler.idea.psi.JellyFile;
import java.util.Set;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -34,12 +34,16 @@ public StructureViewTreeElement[] getChildren(PsiElement parent) {
if (psiPackage != null) {
PsiFile[] maybeViewFiles = psiPackage.getFiles(getCurrentScope(parent));
for (PsiFile file : maybeViewFiles) {
if (file instanceof JellyFile) {
if (isView(file)) {
files.add(new LeafPsiStructureViewTreeElement(file));
}
}
}
}
return files.toArray(StructureViewTreeElement.EMPTY_ARRAY);
}

private static boolean isView(PsiFile file) {
return Set.of("Groovy", "HTML", "Jelly").contains(file.getFileType().getName());
}
}

0 comments on commit 3452cb1

Please sign in to comment.