boolean (Editor editor, PsiElement current, int offset) { editor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, current.getContainingFile()); final CaretModel caretModel = editor.getCaretModel(); if (caretModel.getOffset() == offset) return false; caretModel.moveToOffset(offset); final Caret caret = caretModel.getCurrentCaret(); ScrollingModel scrollingModel = editor.getScrollingModel(); if (caret == caretModel.getPrimaryCaret()) { scrollingModel.scrollToCaret(ScrollType.RELATIVE); } return true; }