void (@NotNull Project project, Editor editor, PsiFile file) { PsiFile topLevelFile = InjectedLanguageManager.getInstance(project).getTopLevelFile(file); Document document = topLevelFile.getViewProvider().getDocument(); assert document != null; document.replaceString(textOffset, textOffset + 1, AMP_ENTITY); }