void (@NotNull final Project project, @NotNull final Editor editor, @NotNull Map<PsiElement, RangeHighlighter> highlighterMap, @NotNull PsiElement element) { final List<RangeHighlighter> highlighters = new ArrayList<>(); final HighlightManager highlightManager = HighlightManager.getInstance(project); final int startOffset = element.getTextRange().getStartOffset(); final int endOffset = element.getTextRange().getEndOffset(); highlightManager.addRangeHighlight(editor, startOffset, endOffset, EditorColors.SEARCH_RESULT_ATTRIBUTES, true, highlighters); highlighterMap.put(element, highlighters.get(0)); final LogicalPosition logicalPosition = editor.offsetToLogicalPosition(startOffset); editor.getScrollingModel().scrollTo(logicalPosition, ScrollType.MAKE_VISIBLE); }