void () { PlatformTestUtil.assumeEnoughParallelism(); TextEditorHighlightingPassRegistrarImpl registrar = (TextEditorHighlightingPassRegistrarImpl)TextEditorHighlightingPassRegistrar.getInstance(myProject); assertFalse("Somebody (rogue plugin?) has left the dangerous setting on", registrar.isSerializeCodeInsightPasses()); registerInspection(new LocalInspectionTool() { @Override public @NotNull String getID() { return getTestName(false)+"MySlowInspectionTool"; } @Override public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { return new PsiElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { assertTrue("File has to be already annotated", annotated.get()); inspected.set(true); } }; } }); annotated.set(false); injectedAnnotated.set(false); inspected.set(false); try { myDaemonCodeAnalyzer.serializeCodeInsightPasses(true); Map<com.intellij.lang.Language, MyRecordingAnnotator @NotNull []> annotatorsByLanguage = new HashMap<>(); annotatorsByLanguage.put(JavaLanguage.INSTANCE, new MyRecordingAnnotator[]{new MySlowAnnotator()}); annotatorsByLanguage.put(XMLLanguage.INSTANCE, new MyRecordingAnnotator[]{new MyInjectedSlowAnnotator()}); useAnnotatorsIn(annotatorsByLanguage, () -> { configureByText(JavaFileType.INSTANCE, """ class X{ // language=XML String ql = "<value>1</value>"; }"""); doHighlighting(); assertTrue("File already has to be java annotated", annotated.get()); assertTrue("File already has to annotate xml injection", injectedAnnotated.get()); assertTrue("File already has to run inspections", inspected.get()); }); } finally { myDaemonCodeAnalyzer.serializeCodeInsightPasses(false); annotated.set(false); injectedAnnotated.set(false); inspected.set(false); } }