void () { List<TextEditorHighlightingPassFactory> collected = Collections.synchronizedList(new ArrayList<>()); List<TextEditorHighlightingPassFactory> applied = Collections.synchronizedList(new ArrayList<>()); class DumbFac implements TextEditorHighlightingPassFactory, DumbAware { @Override public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) { return new MyDumbPass(editor, file); } class MyDumbPass extends EditorBoundHighlightingPass implements DumbAware { MyDumbPass(Editor editor, PsiFile file) { super(editor, file, false); } @Override public void doCollectInformation(@NotNull ProgressIndicator progress) { collected.add(DumbFac.this); } @Override public void doApplyInformationToEditor() { applied.add(DumbFac.this); } } } TextEditorHighlightingPassRegistrar registrar = TextEditorHighlightingPassRegistrar.getInstance(getProject()); DumbFac dumbFac = new DumbFac(); registrar.registerTextEditorHighlightingPass(dumbFac, null, null, false, -1); class SmartFac implements TextEditorHighlightingPassFactory { @Override public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) { return new EditorBoundHighlightingPass(editor, file, false) { @Override public void doCollectInformation(@NotNull ProgressIndicator progress) { collected.add(SmartFac.this); } @Override public void doApplyInformationToEditor() { applied.add(SmartFac.this); } }; } } SmartFac smartFac = new SmartFac(); registrar.registerTextEditorHighlightingPass(smartFac, null, null, false, -1); configureByText(PlainTextFileType.INSTANCE, ""); doHighlighting(); assertSameElements(collected, dumbFac, smartFac); assertSameElements(applied, dumbFac, smartFac); collected.clear(); applied.clear(); myDaemonCodeAnalyzer.mustWaitForSmartMode(false, getTestRootDisposable()); DumbModeTestUtils.runInDumbModeSynchronously(myProject, () -> { type(' '); doHighlighting(); TextEditorHighlightingPassFactory f = assertOneElement(collected); assertSame(dumbFac, f); TextEditorHighlightingPassFactory f2 = assertOneElement(applied); assertSame(dumbFac, f2); }); }