void () { EmptyAnnotator emptyAnnotator = new EmptyAnnotator(); runWithReparseDelay(2000, () -> useAnnotatorsIn(JavaLanguage.INSTANCE, new MyRecordingAnnotator[]{emptyAnnotator}, () -> { @Language("JAVA") String text = "class X {\n}"; configureByText(JavaFileType.INSTANCE, text); ((EditorImpl)myEditor).getScrollPane().getViewport().setSize(1000, 1000); @NotNull Editor editor = getEditor(); assertEquals(getFile().getTextRange(), editor.calculateVisibleRange()); CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject()); doHighlighting(); MyRecordingAnnotator.clearAll(); type(" import java.lang.*;\n"); long start = System.currentTimeMillis(); for (int i=0; i<10; i++) { type(" "); TimeoutUtil.sleep(100); UIUtil.dispatchAllInvocationEvents(); } long typing = System.currentTimeMillis(); while (!emptyAnnotator.didIDoIt()) { UIUtil.dispatchAllInvocationEvents(); } long end = System.currentTimeMillis(); long typingElapsed = typing - start; long highlightElapsed = end - typing; assertTrue("; typed in " + typingElapsed + "ms; highlighted in " + highlightElapsed + "ms", typingElapsed > 1000 && highlightElapsed >= 2000); }) ); }