void (@NotNull Project project, @NotNull Editor editor, @NotNull Alarm alarm) { ThreadingAssertions.assertEventDispatchThread(); if (editor.getDocument().isInBulkUpdate()) { return; } if (!BackgroundHighlightingUtil.isValidEditor(editor)) { return; } BackgroundHighlightingUtil.lookForInjectedFileInOtherThread( project, editor, (newFile, newEditor) -> { int offsetBefore = editor.getCaretModel().getOffset(); submitIdentifierHighlighterPass(editor, offsetBefore, newFile, newEditor); return HeavyBraceHighlighter.match(newFile, offsetBefore); }, (newFile, newEditor, maybeMatch) -> { BraceHighlightingHandler handler = new BraceHighlightingHandler(project, newEditor, alarm, newFile); if (maybeMatch == null) { handler.updateBraces(); } else { CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance(); if (BackgroundHighlightingUtil.needMatching(newEditor, codeInsightSettings)) { FileType fileType = PsiUtilBase.getPsiFileAtOffset(newFile, maybeMatch.first.getStartOffset()).getFileType(); handler.clearBraceHighlighters(); handler.highlightBraces(maybeMatch.first, maybeMatch.second, true, false, fileType); } } }); }