RangeMarker (final PsiElement elt) { final PsiFile psiFile = elt.getContainingFile(); final PsiDocumentManager instance = PsiDocumentManager.getInstance(elt.getProject()); final Document document = instance.getDocument(psiFile); return document.createRangeMarker(elt.getTextRange()); }