void (@NotNull VirtualFile virtualFile) { // close editor, and clear all references retaining this document // (to make sure the DocumentMarkupModel is really recreated and populated with stored highlighters, not preserved since the previous highlighting run) FileDocumentManager.getInstance().saveAllDocuments(); FileEditorManager.getInstance(myProject).closeFile(virtualFile); try { // wait markup stored HighlightingMarkupStore.getExecutor().submit(() -> {}).get(); } catch (Exception e) { throw new RuntimeException(e); } getProject().getService(HighlightingMarkupGrave.class).clearResurrectedZombies(); myFile = null; myEditor = null; TestTimeOut t = TestTimeOut.setTimeout(100 * 2, TimeUnit.MILLISECONDS); while (!t.isTimedOut()) { CoroutineKt.executeSomeCoroutineTasksAndDispatchAllInvocationEvents(myProject); LaterInvocator.purgeExpiredItems(); LaterInvocator.dispatchPendingFlushes(); ((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).getUpdateProgress().clear(); } try { GCWatcher.tracking(FileDocumentManager.getInstance().getDocument(virtualFile)).ensureCollected(); } catch (IllegalStateException e) { LeakHunter.checkLeak(LeakHunter.allRoots(), DocumentImpl.class, doc -> FileDocumentManager.getInstance().getFile(doc) == virtualFile); throw e; } }