void () { myDaemonCodeAnalyzer.setUpdateByTimerEnabled(false); // to prevent auto-start highlighting UIUtil.dispatchAllInvocationEvents(); configureByText(JavaFileType.INSTANCE, "class <caret>S { int ffffff = 0;}"); UIUtil.dispatchAllInvocationEvents(); int[] creation = {0}; class Fac implements TextEditorHighlightingPassFactory { @Override public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) { TextRange textRange = FileStatusMap.getDirtyTextRange(editor.getDocument(), file, Pass.UPDATE_ALL); if (textRange == null) return null; return new MyPass(myProject); } final class MyPass extends TextEditorHighlightingPass { private MyPass(Project project) { super(project, getEditor().getDocument(), false); creation[0]++; } @Override public void doCollectInformation(@NotNull ProgressIndicator progress) { } @Override public void doApplyInformationToEditor() { } } } TextEditorHighlightingPassRegistrar registrar = TextEditorHighlightingPassRegistrar.getInstance(getProject()); registrar.registerTextEditorHighlightingPass(new Fac(), null, null, false, -1); assertEmpty(highlightErrors()); assertEquals(1, creation[0]); //cached assertEmpty(highlightErrors()); assertEquals(1, creation[0]); assertEmpty(highlightErrors()); assertEquals(1, creation[0]); type(' '); assertEmpty(highlightErrors()); assertEquals(2, creation[0]); assertEmpty(highlightErrors()); assertEquals(2, creation[0]); assertEmpty(highlightErrors()); assertEquals(2, creation[0]); }