PsiElement (@NotNull PsiElement value) { if (!(value instanceof YAMLValue)) return value; YAMLAnchor[] anchors = PsiTreeUtil.getChildrenOfType(value, YAMLAnchor.class); if (anchors == null || anchors.length == 0) return value; PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(anchors[anchors.length - 1]); return next == null ? value : next; }