void (Editor editor, PsiFile file, int offset, int inc) { final Document doc = editor.getDocument(); final TemplateLanguageFileViewProvider provider = ObjectUtils.tryCast(file.getViewProvider(), TemplateLanguageFileViewProvider.class); final Language additionalLanguage = provider != null ? provider.getTemplateDataLanguage() : null; PsiDocumentManager.getInstance(file.getProject()).commitDocument(doc); for (int i = offset + inc; i < doc.getTextLength() && i >= 0; i += inc) { PsiElement current = InjectedLanguageUtil.findElementAtNoCommit(file, i); if (checkAndMove(editor, doc, i, current)) return; if (additionalLanguage != null) { current = provider.findElementAt(i, additionalLanguage); if (checkAndMove(editor, doc, i, current)) return; } } }