RangeMarker (final PsiReference ref) { PsiElement element = ref.getElement(); return myDocument.createRangeMarker(ref.getRangeInElement().shiftRight( InjectedLanguageManager.getInstance(myFile.getProject()).injectedToHost(element, element.getTextRange().getStartOffset()) )); }