String () { YAMLAnchor[] anchors = PsiTreeUtil.getChildrenOfType(myValue, YAMLAnchor.class); if (anchors == null || anchors.length == 0) return myValue.getText(); int endOffset = anchors[anchors.length - 1].getTextRange().getEndOffset(); TextRange valueTextRange = myValue.getTextRange(); int offset = valueTextRange.getEndOffset(); TextRange range = new TextRange(endOffset, offset); range = range.shiftLeft(valueTextRange.getStartOffset()); String text = myValue.getText(); return text.substring(range.getStartOffset()).trim(); }