Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
64,600
boolean () { return myEditable; }
isEditable
64,601
boolean () { return myDeprecated; }
isDeprecated
64,602
String () { return myName; }
getName
64,603
YamlMetaType (@NotNull Relation relation) { return myPerRelationTypes.getOrDefault(relation, getMainType()); }
getType
64,604
YamlMetaType () { return getType(getDefaultRelation()); }
getDefaultType
64,605
Relation () { if (myOverriddenDefaultRelation != null) { return myOverriddenDefaultRelation; } if (myIsMany || getMainType() instanceof YamlArrayType) { return Relation.SEQUENCE_ITEM; } return getMainType() instanceof YamlScalarType ? Relation.SCALAR_VALUE : Relation.OBJECT_CONTENTS; }
getDefaultRelation
64,606
Field (boolean allow) { myEmptyValueAllowed = allow; return this; }
withEmptyValueAllowed
64,607
Field () { return withAnyName(true); }
withAnyName
64,608
Field (boolean allowAnyName) { myNamePattern = allowAnyName ? PATTERN_ANYTHING : null; return this; }
withAnyName
64,609
Field (@NotNull Pattern pattern) { myNamePattern = pattern.pattern().equals(PATTERN_ANYTHING.pattern()) ? PATTERN_ANYTHING : pattern; return this; }
withNamePattern
64,610
boolean () { return PATTERN_ANYTHING == myNamePattern; }
isAnyNameAllowed
64,611
boolean () { return myNamePattern != null; }
isByPattern
64,612
boolean (@NotNull String actualName) { if (myNamePattern == null) { return false; } if (myNamePattern == PATTERN_ANYTHING) { return true; } return myNamePattern.matcher(actualName).matches(); }
acceptsFieldName
64,613
boolean () { return myEmptyValueAllowed; }
isEmptyValueAllowed
64,614
String () { StringBuilder result = new StringBuilder(); result.append("[").append(getName()).append("]@"); result.append(Integer.toHexString(hashCode())); result.append(" : "); result.append(getMainType().getTypeName()); List<String> nonDefaultTypes = myPerRelationTypes.entrySet().stream() .filter(e -> e.getValue() == ...
toString
64,615
List<LookupElementBuilder> (@NotNull YamlMetaType ownerClass, @NotNull PsiElement insertedScalar) { if (isByPattern()) { return Collections.emptyList(); } LookupElementBuilder lookup = LookupElementBuilder .create(new TypeFieldPair(ownerClass, this), getName()) .withTypeText(getMainType().getDisplayName(), true) .withI...
getKeyLookups
64,616
PsiReference (@NotNull YAMLKeyValue keyValue) { return null; }
getReferenceFromKey
64,617
boolean (@NotNull Relation relation) { return relation == getDefaultRelation() || myPerRelationTypes.containsKey(relation); }
hasRelationSpecificType
64,618
Icon () { return myIsMany ? AllIcons.Json.Array : getMainType().getIcon(); }
getLookupIcon
64,619
Field (@NotNull YAMLValue element) { if(myMetaTypeSupplier == null) return this; YamlMetaType specializedType = myMetaTypeSupplier.getSpecializedType(element); if(specializedType == null) return this; return cloneWithNewType(specializedType); }
resolveToSpecializedField
64,620
Field (@NotNull YamlMetaType newType) { var result = newField(newType); result.myIsRequired = myIsRequired; result.myEditable = myEditable; result.myDeprecated = myDeprecated; result.myNamePattern = myNamePattern; result.myEmptyValueAllowed = myEmptyValueAllowed; result.myIsMany = myIsMany; result.myOverriddenDefaultRe...
cloneWithNewType
64,621
Field (@NotNull YamlMetaType type) { return new Field(this.myName, type); }
newField
64,622
YamlMetaType () { if(myMainType != null) return myMainType; assert myMetaTypeSupplier != null; synchronized (myMetaTypeSupplier) { if(myMainType == null) { try { YamlMetaType mainType = myMetaTypeSupplier.getMainType(); assert !(myMainType instanceof YamlArrayType) : "Type supplier must not provide array types"; myMain...
getMainType
64,623
YamlIntegerType (boolean quotedValuesAllowed) { return quotedValuesAllowed ? SHARED_INSTANCE_QUOTED_VALUES_ALLOWED : SHARED_INSTANCE_NO_QUOTED_VALUES_ALLOWED; }
getInstance
64,624
void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { try { if (!myQuotedValuesAllowed && scalarValue instanceof YAMLQuotedText) { throw new NumberFormatException("no quoted values allowed"); } Long.parseLong(scalarValue.getTextValue()); } catch (NumberFormatException e) { holder.registerProblem(scal...
validateScalarValue
64,625
Field (@NotNull String name) { return null; }
findFeatureByName
64,626
List<String> (@NotNull Set<String> existingFields) { return Collections.emptyList(); }
computeMissingFields
64,627
List<Field> (@Nullable YAMLMapping existingMapping) { return Collections.emptyList(); }
computeKeyCompletions
64,628
Icon () { return PlatformIcons.PROPERTY_ICON; }
getIcon
64,629
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { if (value instanceof YAMLScalar) { validateScalarValue((YAMLScalar)value, problemsHolder); } else if (value instanceof YAMLCompoundValue) { problemsHolder.registerProblem(value, YAMLBundle.message("YamlScalarType.error.scalar.value"), ProblemHigh...
validateValue
64,630
void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { // }
validateScalarValue
64,631
void (@NotNull YamlInsertionMarkup markup, @NotNull Field.Relation relation, @NotNull ForcedCompletionPath.Iteration iteration) { switch (relation) { case OBJECT_CONTENTS /* weird, but let's ignore and breakthrough to defaults */, SCALAR_VALUE -> { markup.append(": "); if (iteration.isEndOfPathReached()) { markup.appen...
buildInsertionSuffixMarkup
64,632
YamlEnumType (String... literals) { myLiterals = cloneArray(literals); return this; }
withLiterals
64,633
YamlEnumType (String... hiddenLiterals) { myHiddenLiterals = hiddenLiterals.clone(); return this; }
withHiddenLiterals
64,634
YamlEnumType (String... deprecatedLiterals) { myDeprecatedLiterals = deprecatedLiterals.clone(); return this; }
withDeprecatedLiterals
64,635
Stream<String> () { return Stream.concat(Arrays.stream(myLiterals), Arrays.stream(myDeprecatedLiterals)); }
getLiteralsStream
64,636
void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { super.validateScalarValue(scalarValue, holder); String text = scalarValue.getTextValue(); if (text.isEmpty()) { // not our business return; } if (Arrays.asList(myDeprecatedLiterals).contains(text)) { holder.registerProblem(scalarValue, YAMLBundle....
validateScalarValue
64,637
List<LookupElement> (@NotNull YAMLScalar insertedScalar, @Nullable CompletionContext completionContext) { return Stream.concat( Arrays.stream(myLiterals).map((String literal) -> createValueLookup(literal, false)), Arrays.stream(myDeprecatedLiterals).map((String literal) -> createValueLookup(literal, true)) ) .filter(Ob...
getValueLookups
64,638
LookupElement (@NotNull String literal, boolean deprecated) { return LookupElementBuilder.create(literal).withStrikeoutness(deprecated); }
createValueLookup
64,639
YamlMetaType () { return myOwnerClass; }
getMetaType
64,640
Field () { return myField; }
getField
64,641
YamlNumberType (boolean quotedValuesAllowed) { return quotedValuesAllowed ? SHARED_INSTANCE_QUOTED_VALUES_ALLOWED : SHARED_INSTANCE_NO_QUOTED_VALUES_ALLOWED; }
getInstance
64,642
void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { try { if (!myQuotedValuesAllowed && scalarValue instanceof YAMLQuotedText) { throw new NumberFormatException("no quoted values allowed"); } final String textValue = scalarValue.getTextValue(); // Float.parseFloat() successfully parses values like ...
validateScalarValue
64,643
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull YamlMetaTypeProvider metaTypeProvider) { return new StructureChecker(holder, metaTypeProvider); }
doBuildVisitor
64,644
void (@NotNull YAMLKeyValue keyValue) { if (keyValue.getKey() == null) { return; } YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getKeyValueMetaType(keyValue); if (meta != null && !meta.getField().isEditable()) { String msg = YAMLBundle.message("YamlNonEditableKeysInspectionBase.noneditable.key", keyValu...
visitYAMLKeyValue
64,645
String () { return YAMLBundle.message("YamlNonEditableKeyInspectionBase.strip.noneditable.keys.quickfix.name"); }
getFamilyName
64,646
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final ArrayList<YAMLKeyValue> keysToDelete = new ArrayList<>(); descriptor.getPsiElement().getContainingFile().accept(new YamlRecursivePsiElementVisitor() { @Override public void visitKeyValue(@NotNull YAMLKeyValue keyValue) { final YamlMetaTypePr...
applyFix
64,647
void (@NotNull YAMLKeyValue keyValue) { final YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getKeyValueMetaType(keyValue); if (meta != null && !meta.getField().isEditable()) { if (keyValue.getParentMapping() != null) { keysToDelete.add(keyValue); } else { Logger.getInstance(YamlNonEditableKeysInspectionB...
visitKeyValue
64,648
PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { YamlMetaTypeProvider provider = getMetaTypeProvider(holder); return provider == null ? PsiElementVisitor.EMPTY_VISITOR : doBuildVisitor(holder, provider); }
buildVisitor
64,649
void (@NotNull PsiElement element) { ProgressIndicatorProvider.checkCanceled(); if (element instanceof YAMLKeyValue) { visitYAMLKeyValue((YAMLKeyValue)element); } else if (element instanceof YAMLMapping) { visitYAMLMapping((YAMLMapping)element); } else if (element instanceof YAMLSequenceItem) { visitYAMLSequenceItem((Y...
visitElement
64,650
void (@NotNull YAMLKeyValue keyValue) { }
visitYAMLKeyValue
64,651
void (@NotNull YAMLMapping mapping) { }
visitYAMLMapping
64,652
void (@NotNull YAMLDocument document) { }
visitYAMLDocument
64,653
void (@NotNull YAMLSequenceItem item) { }
visitYAMLSequenceItem
64,654
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull YamlMetaTypeProvider metaTypeProvider) { return new StructureChecker(holder, metaTypeProvider); }
doBuildVisitor
64,655
void (@NotNull YAMLKeyValue keyValue) { if (keyValue.getKey() == null) { return; } if ("<<".equals(keyValue.getKey().getText())) { // validation of merge types is not supported, but at least there should be no red code return; } YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getKeyValueMetaType(keyValue);...
visitYAMLKeyValue
64,656
YamlInsertionMarkup (@NotNull InsertionContext context, @NotNull ForcedCompletionPath forcedCompletionPath) { YamlInsertionMarkup markup = new YamlInsertionMarkup(context); Field.Relation relation = myToBeInserted.getDefaultRelation(); YamlMetaType defaultType = myToBeInserted.getType(relation); defaultType.buildInsert...
computeInsertionMarkup
64,657
String () { return myToBeInserted.getName(); }
getReplacement
64,658
PsiElement (@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement contextElement, int targetOffset) { if (contextElement == null || !isRelevant(contextElement)) { return null; } return createFromPsiElement(contextElement); }
getCustomDocumentationElement
64,659
PsiElement (PsiManager psiManager, Object object, PsiElement contextElement) { if(!isRelevant(contextElement)) return null; if (object instanceof ForcedCompletionPath) { // deep completion return createFromCompletionPath((ForcedCompletionPath)object, contextElement); } else if (object instanceof TypeFieldPair) { // bas...
getDocumentationElementForLookupItem
64,660
DocumentationElement (@Nullable PsiElement contextElement) { if (contextElement == null) { return null; } final YamlMetaTypeProvider modelProvider = getMetaTypeProvider(contextElement); if (modelProvider == null) { return null; } YAMLPsiElement yamlElement = getTypedAncestorOrSelf(contextElement, YAMLPsiElement.class);...
createFromPsiElement
64,661
DocumentationElement (@NotNull ForcedCompletionPath path, @NotNull PsiElement contextElement) { final YamlMetaTypeProvider typeProvider = getMetaTypeProvider(contextElement); if (typeProvider == null) { return null; } final Field field = path.getFinalizingField(); if (field == null) { return null; } YamlMetaType type =...
createFromCompletionPath
64,662
DocumentationElement (@NotNull String fieldName, @NotNull PsiElement contextElement) { final YamlMetaTypeProvider typeProvider = getMetaTypeProvider(contextElement); if (typeProvider == null) { return null; } final YamlMetaTypeProvider.MetaTypeProxy proxy = typeProvider.getMetaTypeProxy(contextElement); if (proxy == nu...
createFromString
64,663
DocumentationElement (@NotNull TypeFieldPair field, @NotNull PsiElement contextElement) { return new DocumentationElement(contextElement.getManager(), field.getMetaType(), field.getField()); }
createFromField
64,664
String () { return "DocumentationElement: " + myType + "#" + myField; }
toString
64,665
String () { return myField != null ? myField.getName() + " : " + myField.getDefaultType().getDisplayName() : myType.getDisplayName(); // todo replace with rich presentation }
getText
64,666
String () { return YamlDocumentationProviderBase.this.getDocumentation(myProject, myType, myField); }
getDocumentation
64,667
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DocumentationElement element = (DocumentationElement)o; return Objects.equals(myProject, element.myProject) && Objects.equals(myType, element.myType) && Objects.equals(myField, element.myField); }
equals
64,668
int () { return Objects.hash(myProject, myType, myField); }
hashCode
64,669
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull YamlMetaTypeProvider metaTypeProvider) { return new StructureChecker(holder, metaTypeProvider); }
doBuildVisitor
64,670
void (@NotNull YAMLMapping mapping) { final YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getMetaTypeProxy(mapping); if (meta == null) { return; } final YamlMetaType metaType = meta.getMetaType(); if (metaType instanceof YamlScalarType) { return; } final Collection<String> missingKeys = getMissingKeys(ma...
visitYAMLMapping
64,671
String () { return getFamilyName(); }
getText
64,672
String () { return YAMLBundle.message("YamlMissingKeysInspectionBase.add.missing.keys.quickfix.name"); }
getFamilyName
64,673
boolean (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { PsiElement mapping = getMappingFromHighlightElement(startElement); return mapping != null; }
isAvailable
64,674
void (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { PsiElement mapping = getMappingFromHighlightElement(startElement); if (mapping == null) { return; } final YAMLElementGenerator elementGenerator = YAMLElementGenerator.getIn...
invoke
64,675
PsiElement (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 (par...
getMappingFromHighlightElement
64,676
PsiElement (@NotNull YAMLMapping mapping) { final PsiElement parent = mapping.getParent(); if (parent instanceof YAMLDocument) { return parent; } else if (parent instanceof YAMLSequenceItem) { final PsiElement key = parent.getFirstChild(); return key != null ? key : mapping; } else if (parent instanceof YAMLKeyValue) {...
getElementToHighlight
64,677
String (@NotNull final Collection<String> missingKeys) { return String.join(", ", missingKeys); }
composeKeyList
64,678
Collection<String> (@NotNull YAMLMapping mapping, @NotNull YamlMetaType metaClass) { Set<String> existingKeys = mapping.getKeyValues().stream().map(it -> it.getKeyText().trim()).collect(Collectors.toSet()); return metaClass.computeMissingFields(existingKeys); }
getMissingKeys
64,679
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull YamlMetaTypeProvider metaTypeProvider) { return new ValuesChecker(holder, metaTypeProvider); }
doBuildVisitor
64,680
void (@NotNull YAMLSequenceItem item) { YAMLValue value = item.getValue(); if (value == null) { return; } if (value instanceof YAMLKeyValue || value instanceof YAMLMapping) { // will be handled separately return; } YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getValueMetaType(value); if (meta != null &&...
visitYAMLSequenceItem
64,681
void (@NotNull YAMLKeyValue keyValue) { if (keyValue.getKey() == null) { return; } YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getKeyValueMetaType(keyValue); if (meta == null) { return; } YAMLValue value = keyValue.getValue(); if (value == null || YamlMetaUtil.isNull(value)) { validateEmptyValue(meta.g...
visitYAMLKeyValue
64,682
void (@NotNull YAMLMapping mapping) { YamlMetaTypeProvider.MetaTypeProxy meta = myMetaTypeProvider.getValueMetaType(mapping); if (meta != null) { meta.getMetaType().validateValue(mapping, myProblemsHolder); } }
visitYAMLMapping
64,683
void (@NotNull YamlMetaTypeProvider.MetaTypeProxy meta, @NotNull YAMLValue value) { if (meta.getField().isMany()) { requireMultiplicityMany(meta, value); } else { requireMultiplicityOne(meta, value); } }
validateMultiplicity
64,684
void (@NotNull YamlMetaTypeProvider.MetaTypeProxy meta, @NotNull YAMLValue value) { if (meta.getField().hasRelationSpecificType(Field.Relation.SEQUENCE_ITEM)) { return; } if (value instanceof YAMLSequence) { for (YAMLSequenceItem next : ((YAMLSequence)value).getItems()) { if (next.getValue() == null || !next.getKeysVal...
requireMultiplicityOne
64,685
void (@NotNull YamlMetaTypeProvider.MetaTypeProxy meta, @NotNull YAMLValue value) { if (meta.getField().hasRelationSpecificType(Field.Relation.OBJECT_CONTENTS)) { return; } boolean actuallyOne = value instanceof YAMLScalar || (value instanceof YAMLMapping && !meta.getField().isAnyNameAllowed()); if (actuallyOne) { myPr...
requireMultiplicityMany
64,686
void (@NotNull Field feature, @NotNull YAMLKeyValue withoutValue) { assert withoutValue.getKey() != null; //would not be able to find `this` as a type if (!feature.isEmptyValueAllowed()) { InspectionManager manager = myProblemsHolder.getManager(); YAMLValue value = withoutValue.getValue(); ProblemDescriptor eolError = ...
validateEmptyValue
64,687
String (@Nullable PsiElement psi) { if (psi == null) { return "<null>"; } String text = psi.getText(); if (text.contains("\n")) { int firstEol = text.indexOf('\n'); int lastEol = text.lastIndexOf('\n'); if (firstEol >= 0) { text = text.substring(0, firstEol) + " ... " + text.substring(lastEol + 1); } } return psi + ", ...
getDebugInfo
64,688
MetaTypeProxy (@NotNull PsiElement psi) { if (psi instanceof YAMLValue) { return getValueMetaType((YAMLValue)psi); } YAMLValue metaOwner = getMetaOwner(psi); return metaOwner == null ? null : getValueMetaType(metaOwner); }
getMetaTypeProxy
64,689
YAMLValue (@NotNull PsiElement psi) { PsiFile file = psi.getContainingFile(); if (!(file instanceof YAMLFile)) { return null; } return getTypedAncestorOrSelf(psi, YAMLValue.class); }
getMetaOwner
64,690
MetaTypeProxy (@NotNull YAMLKeyValue keyValue) { if (keyValue.getValue() != null) { return getMetaTypeProxy(keyValue.getValue()); } Field type = computeMetaType(keyValue); return FieldAndRelation.forNullable(type, Field.Relation.OBJECT_CONTENTS); }
getKeyValueMetaType
64,691
MetaTypeProxy (@NotNull YAMLValue typedValue) { return CachedValuesManager.getCachedValue(typedValue, myKey, () -> { debug(() -> " >> computing type for : " + YamlDebugUtil.getDebugInfo(typedValue)); MetaTypeProxy computed = computeMetaType(typedValue); debug(() -> " << finished for : " + YamlDebugUtil.getDebugInfo(typ...
getValueMetaType
64,692
MetaTypeProxy (@NotNull YAMLValue value) { PsiElement typed = PsiTreeUtil.getParentOfType(value, YAMLKeyValue.class, YAMLSequenceItem.class, YAMLDocument.class); if (typed instanceof YAMLDocument) { Field root = myMetaModel.getRoot((YAMLDocument)typed); return FieldAndRelation.forNullable(root, Field.Relation.OBJECT_CO...
computeMetaType
64,693
Field (@NotNull YAMLKeyValue keyValue) { YAMLMapping parentMapping = keyValue.getParentMapping(); if (parentMapping == null) { debug(() -> "Unexpected: keyValue parent is not a mapping: " + keyValue.getParent()); return null; } MetaTypeProxy parentMeta = getMetaTypeProxy(parentMapping); Field childMeta = findChildMeta(...
computeMetaType
64,694
Field (@NotNull Field field, @Nullable YAMLValue value) { return value != null ? field.resolveToSpecializedField(value) : field; }
specializeField
64,695
Field (@Nullable MetaTypeProxy parentMeta, @NotNull YAMLKeyValue child) { if (parentMeta == null) { return null; } String tag = child.getKeyText().trim(); return parentMeta.getMetaType().findFeatureByName(tag); }
findChildMeta
64,696
void (Supplier<String> textSupplier) { if(LOG.isDebugEnabled()) { String text = textSupplier.get(); LOG.debug(text); //System.err.println(text); } }
debug
64,697
boolean (@NotNull YAMLKeyValue keyValue, @NotNull PsiElement keySibling) { if (keySibling.getParent() != keyValue) { return false; //assert? } PsiElement key = keyValue.getKey(); for (PsiElement prev = keySibling.getPrevSibling(); prev != null && prev != key; prev = prev.getPrevSibling()) { if (prev.getNode().getElemen...
hasLineBreakBetweenKeyAndValue
64,698
FieldAndRelation (@Nullable Field field, @NotNull Field.Relation relation) { return field == null ? null : new FieldAndRelation(field, relation); }
forNullable
64,699
Field () { return myField; }
getField