long (@NotNull ExpectedHighlightingData data) { Project project = getProject(); EdtTestUtil.runInEdtAndWait(() -> PsiDocumentManager.getInstance(project).commitAllDocuments()); PsiFileImpl file = (PsiFileImpl)getHostFile(); FileElement hardRefToFileElement = file.calcTreeElement();//to load text // to load AST for changed files before it's prohibited by "fileTreeAccessFilter" ensureIndexesUpToDate(project); long start = System.currentTimeMillis(); VirtualFileFilter fileTreeAccessFilter = myVirtualFileFilter; Disposable disposable = Disposer.newDisposable(); if (fileTreeAccessFilter != null) { PsiManagerEx.getInstanceEx(project).setAssertOnFileLoadingFilter(fileTreeAccessFilter, disposable); } // ProfilingUtil.startCPUProfiling(); List<HighlightInfo> infos; try { infos = doHighlighting(); removeDuplicatedRangesForInjected(infos); } finally { Disposer.dispose(disposable); } // ProfilingUtil.captureCPUSnapshot("testing"); long elapsed = System.currentTimeMillis() - start; data.checkResult(file, infos, file.getText()); if (data.hasLineMarkers()) { Document document = getDocument(getFile()); data.checkLineMarkers(file, DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject()), document.getText()); } Reference.reachabilityFence(hardRefToFileElement); return elapsed; }