@NotNull private static Collection<VirtualFile> gatherIncludeRoots(Collection<VirtualFile> goPathSourcesRoots, Set<VirtualFile> excludeRoots) { Collection<VirtualFile> includeRoots = ContainerUtil.newHashSet(); for (VirtualFile goPathSourcesDirectory : goPathSourcesRoots) { ProgressIndicatorProvider.checkCanceled(); boolean excludedRootIsAncestor = false; for (VirtualFile excludeRoot : excludeRoots) { ProgressIndicatorProvider.checkCanceled(); if (VfsUtilCore.isAncestor(excludeRoot, goPathSourcesDirectory, false)) { excludedRootIsAncestor = true; break; } } if (excludedRootIsAncestor) { continue; } for (VirtualFile file : goPathSourcesDirectory.getChildren()) { ProgressIndicatorProvider.checkCanceled(); if (file.isDirectory() && !excludeRoots.contains(file)) { includeRoots.add(file); } } } return includeRoots; } }
@NotNull private static Collection<VirtualFile> gatherIncludeRoots(Collection<VirtualFile> ballerinaPathSourcesRoots, Set<VirtualFile> excludeRoots) { Collection<VirtualFile> includeRoots = ContainerUtil.newHashSet(); for (VirtualFile ballerinaPathSourcesDirectory : ballerinaPathSourcesRoots) { ProgressIndicatorProvider.checkCanceled(); boolean excludedRootIsAncestor = false; for (VirtualFile excludeRoot : excludeRoots) { ProgressIndicatorProvider.checkCanceled(); if (VfsUtilCore.isAncestor(excludeRoot, ballerinaPathSourcesDirectory, false)) { excludedRootIsAncestor = true; break; } } if (excludedRootIsAncestor) { continue; } ProgressIndicatorProvider.checkCanceled(); if (ballerinaPathSourcesDirectory.isDirectory() && !excludeRoots.contains(ballerinaPathSourcesDirectory)) { includeRoots.add(ballerinaPathSourcesDirectory); } } return includeRoots; } }
@Override public void visitCompositeElement(@NotNull GoCompositeElement o) { super.visitCompositeElement(o); for (PsiElement psiElement : o.getChildren()) { psiElement.accept(this); ProgressIndicatorProvider.checkCanceled(); } }
@Override public void visitFile(@NotNull PsiFile file) { super.visitFile(file); for (PsiElement psiElement : file.getChildren()) { psiElement.accept(this); ProgressIndicatorProvider.checkCanceled(); } } }
@NotNull @Override public Result visitFileEx(@NotNull VirtualFile file) { ProgressIndicatorProvider.checkCanceled(); if (file.isDirectory() && !FileIndexFacade.getInstance(getProject()).isInContent(file)) { return SKIP_CHILDREN; } if (!file.isDirectory() && GoCoverageEngine.INSTANCE.coverageProjectViewStatisticsApplicableTo(file)) { DirCoverageInfo dirCoverageInfo = getOrCreateDirectoryInfo(file.getParent()); FileCoverageInfo fileCoverageInfo = getOrCreateFileInfo(file); data.processFile(file.getPath(), rangeData -> { if (rangeData.hits > 0) { fileCoverageInfo.coveredLineCount += rangeData.statements; } fileCoverageInfo.totalLineCount += rangeData.statements; return true; }); if (fileCoverageInfo.totalLineCount > 0) { dirCoverageInfo.totalLineCount += fileCoverageInfo.totalLineCount; dirCoverageInfo.totalFilesCount++; } if (fileCoverageInfo.coveredLineCount > 0) { dirCoverageInfo.coveredLineCount += fileCoverageInfo.coveredLineCount; dirCoverageInfo.coveredFilesCount++; } } return CONTINUE; }
Collection<VirtualFile> goPathSourcesRoots = GoSdkUtil.getGoPathSources(project, myModule); Set<VirtualFile> excludeRoots = ContainerUtil.newHashSet(ProjectRootManager.getInstance(project).getContentRoots()); ProgressIndicatorProvider.checkCanceled(); if (!myLastHandledGoPathSourcesRoots.equals(goPathSourcesRoots) || !myLastHandledExclusions.equals(excludeRoots)) { Collection<VirtualFile> includeRoots = gatherIncludeRoots(goPathSourcesRoots, excludeRoots);
Set<VirtualFile> excludeRoots = ContainerUtil.newHashSet(ProjectRootManager.getInstance(project).getContentRoots()); ProgressIndicatorProvider.checkCanceled();
@Override public void visitElement(@NotNull PsiElement o) { // fixme no idea why generated visitor has recursion ProgressIndicatorProvider.checkCanceled(); }
@Override public void visitElement(final PsiElement element) { ProgressIndicatorProvider.checkCanceled(); element.acceptChildren(this); }
@Override public void enterEveryRule(ParserRuleContext ctx) { ProgressIndicatorProvider.checkCanceled(); markers.push(getBuilder().mark()); }
@Override public void exitEveryRule(ParserRuleContext ctx) { ProgressIndicatorProvider.checkCanceled(); PsiBuilder.Marker marker = markers.pop(); marker.done(getRuleElementTypes().get(ctx.getRuleIndex())); } }
@Override public void visitElement(PsiElement element) { ProgressIndicatorProvider.checkCanceled(); if (element == null) { return; } if (element instanceof PsiMethod) { lineMarkersHolder.updateMethodMarker((PsiMethod) element, markupModel); return; } element.acceptChildren(this); } }
@Override public void visitElement(PsiElement element) { ProgressIndicatorProvider.checkCanceled(); if (element == null) { return; } if (element instanceof PsiMethod) { lineMarkersHolder.removeInvalidMethods(markupModel); lineMarkersHolder.removeIconIfPresent((PsiMethod) element, markupModel); return; } element.acceptChildren(this); } }
ProgressIndicatorProvider.checkCanceled();
@NotNull @Override public ASTNode parse(IElementType root, PsiBuilder builder) { ProgressIndicatorProvider.checkCanceled(); ParseTreeWalker.DEFAULT.walk(listener, parseTree); while (!builder.eof()) { ProgressIndicatorProvider.checkCanceled(); builder.advanceLexer();
ProgressIndicatorProvider.checkCanceled();
ProgressIndicatorProvider.checkCanceled(); functionCall.acceptChildren(this);