String (@NotNull PsiElement e) { if (e instanceof YAMLDocument) { final YAMLFile file = (YAMLFile)e.getContainingFile(); if (file == null) { return "Document"; } final List<YAMLDocument> documents = file.getDocuments(); return "Document " + getIndexOf(documents, e); } if (e instanceof YAMLKeyValue) { return ((YAMLKeyValue)e).getKeyText() + ':'; } if (e instanceof YAMLSequenceItem) { final PsiElement parent = e.getParent(); if (!(parent instanceof YAMLSequence)) { return "Item"; } final List<YAMLSequenceItem> items = ((YAMLSequence)parent).getItems(); return "Item " + getIndexOf(items, e); } if (e instanceof YAMLScalar) { return StringUtil.first(((YAMLScalar)e).getTextValue(), SCALAR_MAX_LENGTH, true); } throw new IllegalArgumentException("This element should not pass #acceptElement"); }