HighlightInfo (@NotNull Project project, @NotNull Editor editor, int caretOffset, @NotNull HighlightSeverity minSeverity) { Document document = editor.getDocument(); HighlightInfo[][] infoToGo = new HighlightInfo[2][2]; //HighlightInfo[luck-noluck][skip-noskip] int caretOffsetIfNoLuck = myGoForward ? -1 : document.getTextLength(); DaemonCodeAnalyzerEx.processHighlights(document, project, minSeverity, 0, document.getTextLength(), info -> { int startOffset = getNavigationPositionFor(info, document); if (SeverityRegistrar.isGotoBySeverityEnabled(info.getSeverity())) { infoToGo[0][0] = getBetterInfoThan(infoToGo[0][0], caretOffset, startOffset, info); infoToGo[1][0] = getBetterInfoThan(infoToGo[1][0], caretOffsetIfNoLuck, startOffset, info); } infoToGo[0][1] = getBetterInfoThan(infoToGo[0][1], caretOffset, startOffset, info); infoToGo[1][1] = getBetterInfoThan(infoToGo[1][1], caretOffsetIfNoLuck, startOffset, info); return true; }); if (infoToGo[0][0] == null) infoToGo[0][0] = infoToGo[1][0]; if (infoToGo[0][1] == null) infoToGo[0][1] = infoToGo[1][1]; if (infoToGo[0][0] == null) infoToGo[0][0] = infoToGo[0][1]; return infoToGo[0][0]; }