private static @Nullable PsiElement getMappingFromHighlightElement(PsiElement elementToHighlight) {
    if (elementToHighlight instanceof YAMLDocument) {
      return PsiTreeUtil.getChildOfAnyType(elementToHighlight, YAMLMapping.class);
    }

    PsiElement parent = elementToHighlight.getParent();
    if (parent instanceof YAMLKeyValue) {
      return ((YAMLKeyValue)parent).getValue();
    }
    else if (parent instanceof YAMLSequenceItem) {
      return ((YAMLSequenceItem)parent).getValue();
    }
    else {
      return PsiTreeUtil.getParentOfType(elementToHighlight, YAMLMapping.class);
    }
  }
private static @Nullable PsiElement getMappingFromHighlightElement(PsiElement elementToHighlight)