Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
64,500
List<YamlMetaType> (YamlMetaType... types) { if (types.length == 0) { throw new IllegalArgumentException("Nothing to compose"); } List<YamlMetaType> flattenedTypes = new SmartList<>(); Set<YamlMetaType> cerber = new ReferenceOpenHashSet<>(); for (YamlMetaType next : types) { if (!cerber.add(next)) { continue; } if (nex...
flattenTypes
64,501
Field (@NotNull String name) { if (!myFields.containsKey(name)) { List<Pair<Field, YamlMetaType>> fields = new SmartList<>(); for (YamlMetaType nextSubType : myTypes) { if (nextSubType instanceof YamlScalarType) { continue; } Field nextField = nextSubType.findFeatureByName(name); if (nextField != null && !name.equals(n...
findFeatureByName
64,502
List<String> (@NotNull Set<String> existingFields) { LinkedHashSet<String> result = new LinkedHashSet<>(); for (YamlMetaType next : myTypes) { if (next instanceof YamlScalarType) { continue; } List<String> nextMissing = next.computeMissingFields(existingFields); if (nextMissing.isEmpty()) { return Collections.emptyList...
computeMissingFields
64,503
List<Field> (@Nullable YAMLMapping existingMapping) { Set<String> processedNames = new HashSet<>(); LinkedHashSet<Field> result = new LinkedHashSet<>(); for (YamlMetaType nextSubType : myTypes) { if (nextSubType instanceof YamlScalarType) { continue; } List<Field> subTypeCompletions = nextSubType.computeKeyCompletions(...
computeKeyCompletions
64,504
void (@NotNull YamlInsertionMarkup markup, @NotNull Field.Relation relation, @NotNull ForcedCompletionPath.Iteration iteration) { if (relation == Field.Relation.SCALAR_VALUE || (relation == Field.Relation.OBJECT_CONTENTS && !listScalarSubTypes().isEmpty())) { markup.append(": "); } else { markup.append(":"); if (relati...
buildInsertionSuffixMarkup
64,505
List<YamlMetaType> () { return ContainerUtil.filter(myTypes, next -> next instanceof YamlScalarType); }
listScalarSubTypes
64,506
List<YamlMetaType> () { return ContainerUtil.filter(myTypes, next -> !(next instanceof YamlScalarType)); }
listNonScalarSubTypes
64,507
Iterable<YamlMetaType> () { return copyList(myTypes); }
getSubTypes
64,508
Stream<YamlMetaType> () { return myTypes.stream(); }
streamSubTypes
64,509
Field (@NotNull List<Pair<Field, YamlMetaType>> pairs) { switch (pairs.size()) { case 0 -> { return null; } case 1 -> { return pairs.get(0).getFirst(); } } Set<String> allNames = pairs.stream().map(fieldAndType -> fieldAndType.getFirst().getName()).collect(Collectors.toSet()); assert allNames.size() == 1 : "Can't merge...
mergeFields
64,510
boolean (@NotNull String name, @NotNull List<Pair<Field, YamlMetaType>> fields) { // it is not clear how to merge fields with different multiplicities // so we will reject the merge if they don't match Map<Boolean, List<YamlMetaType>> byMultiplicity = fields.stream().collect( Collectors.groupingBy(fieldAndType -> field...
mergeIsMany
64,511
ProblemsHolder (@NotNull ProblemsHolder original) { return new ProblemsHolder(original.getManager(), original.getFile(), original.isOnTheFly()); }
makeCopy
64,512
YamlBooleanType () { return StandardYamlBoolean.SHARED; }
getSharedInstance
64,513
void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { if (scalarValue instanceof YAMLQuotedText) { //TODO: quickfix would be nice here holder.registerProblem(scalarValue, YAMLBundle.message("YamlBooleanType.validation.error.quoted.value"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return; } sup...
validateScalarValue
64,514
LiteralBuilder (@NonNls String @NotNull ... literals) { for (String next : literals) { if (next != null) { withLiteral(next, LiteralBuilder::lower, LiteralBuilder::CAPS, LiteralBuilder::First); } } return this; }
withAllCasesOf
64,515
LiteralBuilder (@NotNull String literal, Function<String, String>... capitalizations) { if (capitalizations.length == 0) { myResult.add(literal); } else { for (Function<String, String> next : capitalizations) { myResult.add(next.apply(literal)); } } return this; }
withLiteral
64,516
String[] () { return ArrayUtilRt.toStringArray(myResult); }
toArray
64,517
String (@NotNull String text) { return StringUtil.toLowerCase(text); }
lower
64,518
String (@NotNull String text) { return StringUtil.toUpperCase(text); }
CAPS
64,519
String (@NotNull String text) { return StringUtil.toTitleCase(text); }
First
64,520
Field (@NotNull String name) { if (getFeatures().isEmpty()) { return null; } Optional<Field> byExactName = getFeatures().stream() .filter(f -> !f.isByPattern() && name.equals(f.getName())) .findAny(); return byExactName.orElse( ContainerUtil.find(getFeatures(), f -> f.isByPattern() && f.acceptsFieldName(name)) ); }
findFeatureByName
64,521
List<String> (@NotNull Set<String> existingFields) { return myFeatures.stream() .filter(Field::isRequired) .map(Field::getName) .filter(name -> !existingFields.contains(name)) .collect(Collectors.toList()); }
computeMissingFields
64,522
List<Field> (@Nullable YAMLMapping existingMapping) { return ContainerUtil.filter(myFeatures, Field::isEditable); }
computeKeyCompletions
64,523
List<Field> () { return myFeaturesRO; }
getFeatures
64,524
Field (@NotNull String name) { return addFeature(new Field(name, YamlStringType.getInstance())); }
addStringFeature
64,525
Field (@NotNull String name) { return addScalarFeature(name, YamlBooleanType.getSharedInstance()); }
addBooleanFeature
64,526
Field (@NotNull YamlScalarType type) { return addScalarFeature(type.getTypeName(), type); }
addScalarFeature
64,527
Field (@NotNull String name, @NotNull YamlScalarType type) { return addFeature(new Field(name, type)); }
addScalarFeature
64,528
Field (@NotNull YamlMetaClass metaClass) { return addFeature(new Field(metaClass.getTypeName(), metaClass)); }
addObjectFeature
64,529
void (@NotNull YamlInsertionMarkup markup, @NotNull Field.Relation relation, @NotNull ForcedCompletionPath.Iteration iteration) { switch (relation) { case SCALAR_VALUE -> throw new IllegalArgumentException("Default relation " + relation + " requested for complex type: " + this); case OBJECT_CONTENTS -> doBuildInsertion...
buildInsertionSuffixMarkup
64,530
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { super.validateValue(value, problemsHolder); if (value instanceof YAMLScalar && !YamlMetaUtil.isNull(value)) { problemsHolder.registerProblem(value, YAMLBundle.message("YamlMetaClass.error.scalar.value", ArrayUtil.EMPTY_OBJECT_ARRAY)); } }
validateValue
64,531
void (@NotNull YamlInsertionMarkup markup, boolean manyNotOne, @NotNull ForcedCompletionPath.Iteration iteration) { markup.append(":"); markup.doTabbedBlock(manyNotOne ? 2 : 1, () -> { markup.newLineAndTabs(manyNotOne); List<Field> allRequired = ContainerUtil.filter(myFeatures, field -> field.isRequired() || iteration....
doBuildInsertionSuffixMarkup
64,532
String () { return myTypeName; }
getTypeName
64,533
String () { return myDisplayName == null ? myTypeName : myDisplayName; }
getDisplayName
64,534
Icon () { return AllIcons.Json.Object; }
getIcon
64,535
void (@NonNls @NotNull String displayName) { if (myDisplayName != null) { Logger.getInstance(YamlMetaType.class) .error("reinitialising 'myDisplayName' with value '" + displayName + "', previous value: '" + myDisplayName + "'. " + "Please avoid calling the `setDisplayName` method out of initialisation step, or better s...
setDisplayName
64,536
void (@NotNull YAMLKeyValue keyValue, @NotNull ProblemsHolder problemsHolder) { // }
validateKey
64,537
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { // }
validateValue
64,538
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { validateValue(value, problemsHolder); // TODO a case for sequence if (value instanceof YAMLMapping mapping) { Collection<YAMLKeyValue> keyValues = mapping.getKeyValues(); // check for missing keys // TODO reuse with YamlMissingKeysInspectionBase ...
validateDeep
64,539
void (@NotNull YamlInsertionMarkup markup, @NotNull Field feature, @NotNull ForcedCompletionPath.Iteration iteration) { markup.append(feature.getName()); Field.Relation defaultRelation = feature.getDefaultRelation(); YamlMetaType defaultType = feature.getType(defaultRelation); defaultType.buildInsertionSuffixMarkup(mar...
buildCompleteKeyMarkup
64,540
String () { return getClass().getSimpleName() + ":" + myTypeName + "@" + Integer.toHexString(hashCode()); }
toString
64,541
void (@NotNull String text) { myOutput.append(text); }
append
64,542
void () { newLineAndTabs(false); }
newLineAndTabs
64,543
void (boolean withSequenceItemMark) { if (withSequenceItemMark) { assert myLevel > 0; } append(CRLF_MARKUP); if (withSequenceItemMark) { append(tabs(myLevel - 1)); append(sequenceItemPrefix()); } else { append(tabs(myLevel)); } }
newLineAndTabs
64,544
String () { String result = SEQUENCE_ITEM_MARKUP; if (myTabSymbol.length() > result.length()) { result += myTabSymbol.substring(result.length()); } return result; }
sequenceItemPrefix
64,545
void (Runnable doWhenTabbed) { var indent = mySettings.INDENT_SEQUENCE_VALUE ? 2 : 1; doTabbedBlock(indent, () -> { newLineAndTabs(true); doWhenTabbed.run(); }); }
doTabbedBlockForSequenceItem
64,546
void () { doTabbedBlockForSequenceItem(() -> { }); }
doTabbedBlockForSequenceItem
64,547
void () { if (!myCaretAppended) { append(CARET_MARKUP); } myCaretAppended = true; }
appendCaret
64,548
String () { return myOutput.toString(); }
getMarkup
64,549
void (final int indent) { assert indent > 0; myLevel += indent; }
increaseTabs
64,550
void (final int indent, @NotNull final Runnable doWhenTabbed) { increaseTabs(indent); try { doWhenTabbed.run(); } finally { decreaseTabs(indent); } }
doTabbedBlock
64,551
String () { return myTabSymbol; }
getTabSymbol
64,552
void (int indent) { assert indent <= myLevel; myLevel -= indent; }
decreaseTabs
64,553
String (int level) { return StringUtil.repeat(myTabSymbol, level); }
tabs
64,554
String (@NotNull InsertionContext context) { return StringUtil.repeatSymbol(' ', CodeStyle.getIndentSize(context.getFile())); }
getTabSymbol
64,555
void (Editor editor, String commonPadding) { String insertionMarkup = getMarkup(); String suffixWithCaret = insertionMarkup.replace(CRLF_MARKUP, "\n" + commonPadding); int caretIndex = suffixWithCaret.indexOf(CARET_MARKUP); String suffix = suffixWithCaret.replace(CARET_MARKUP, ""); EditorModificationUtil.insertStringAt...
insertStringAndCaret
64,556
ForcedCompletionPath (@NotNull final List<Field> completionPath) { return new ForcedCompletionPath(completionPath); }
forDeepCompletion
64,557
ForcedCompletionPath () { return NULL_PATH; }
nullPath
64,558
String () { if (myCompletionPath == null) { return "<null>"; } return myCompletionPath.stream().map(Field::getName).collect(Collectors.joining(".")); }
getName
64,559
YamlMetaType () { if (myCompletionPath == null || myCompletionPath.size() < 2) { return null; } return myCompletionPath.get(myCompletionPath.size() - 2).getDefaultType(); }
getFinalizingType
64,560
Field () { if (myCompletionPath == null || myCompletionPath.isEmpty()) { return null; } return myCompletionPath.get(myCompletionPath.size() - 1); }
getFinalizingField
64,561
Iteration () { return myCompletionPath != null ? new OnPathIteration(1) : NULL_ITERATION; }
start
64,562
String () { return getClass().getSimpleName() + "(" + getName() + ")"; }
toString
64,563
boolean (@NotNull Field field) { return false; }
isNextOnPath
64,564
boolean () { return false; }
isEndOfPathReached
64,565
Iteration (@NotNull Field field) { return this; }
nextIterationFor
64,566
boolean (@NotNull Field field) { return false; }
isNextOnPath
64,567
boolean () { return true; }
isEndOfPathReached
64,568
Iteration (@NotNull Field field) { return this; }
nextIterationFor
64,569
boolean (@NotNull Field field) { assert myCompletionPath != null; return !isEndOfPathReached() && field.equals(myCompletionPath.get(myPosition)); }
isNextOnPath
64,570
boolean () { assert myCompletionPath != null; return myPosition >= myCompletionPath.size(); }
isEndOfPathReached
64,571
Iteration (@NotNull Field field) { assert myCompletionPath != null; return isEndOfPathReached() || field.equals(myCompletionPath.get(myPosition)) ? new OnPathIteration(myPosition + 1) : OFF_PATH_ITERATION; }
nextIterationFor
64,572
List<String> (@NotNull Set<String> existingFields) { return Collections.emptyList(); }
computeMissingFields
64,573
List<Field> (@Nullable YAMLMapping existingMapping) { return Collections.emptyList(); }
computeKeyCompletions
64,574
void (@NotNull YamlInsertionMarkup markup, Field.@NotNull Relation relation, ForcedCompletionPath.@NotNull Iteration iteration) { markup.append(": "); if (iteration.isEndOfPathReached()) { markup.appendCaret(); } }
buildInsertionSuffixMarkup
64,575
YamlMetaType () { return ourInstance; }
getInstance
64,576
YamlMetaType (YamlMetaType... types) { return anyOf(null, types); }
anyOf
64,577
YamlMetaType (@Nullable String complexTypeDisplayNameHint, YamlMetaType... types) { if (types.length == 0) { throw new IllegalArgumentException(); } if (types.length == 1) { return types[0]; } String name = "AnyOf[" + Stream.of(types).map(YamlMetaType::getDisplayName).collect(Collectors.joining()) + "]"; return new Yam...
anyOf
64,578
YamlMetaType (YamlMetaType... types) { return anyOf(types); }
composeTypes
64,579
void (@NotNull YAMLKeyValue keyValue, @NotNull ProblemsHolder problemsHolder) { List<ProblemsHolder> allProblems = allProblemsOrEmpty(problemsHolder, listNonScalarSubTypes(), (nextType, nextHolder) -> nextType.validateKey(keyValue, nextHolder)); allProblems.stream() .flatMap(h -> h.getResults().stream()) .forEach(probl...
validateKey
64,580
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { List<YamlMetaType> types; if (value instanceof YAMLScalar) { types = listScalarSubTypes(); if (types.isEmpty()) { // value kind does not match, let some scalar component to report it types = Collections.singletonList(listNonScalarSubTypes().get(0...
validateValue
64,581
List<ProblemsHolder> (@NotNull ProblemsHolder problemsHolder, @NotNull List<YamlMetaType> types, @NotNull BiConsumer<YamlMetaType, ProblemsHolder> oneValidation) { List<ProblemsHolder> problems = new SmartList<>(); for (YamlMetaType nextType : types) { ProblemsHolder nextHolder = makeCopy(problemsHolder); oneValidation...
allProblemsOrEmpty
64,582
YamlAnyScalarType () { return SHARED_INSTANCE; }
getInstance
64,583
void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { if(!(value instanceof YAMLSequence)) problemsHolder.registerProblem(value, YAMLBundle.message("YamlUnknownValuesInspectionBase.error.array.is.required")); }
validateValue
64,584
YamlMetaType () { return myElementType; }
getElementType
64,585
List<String> (@NotNull Set<String> existingFields) { return Collections.emptyList(); }
computeMissingFields
64,586
List<Field> (@Nullable YAMLMapping existingMapping) { return Collections.emptyList(); }
computeKeyCompletions
64,587
void (@NotNull YamlInsertionMarkup markup, Field.@NotNull Relation relation, ForcedCompletionPath.@NotNull Iteration iteration) { }
buildInsertionSuffixMarkup
64,588
YamlStringType () { return SHARED_INSTANCE; }
getInstance
64,589
YamlMetaClass () { if(ourInstance != null) return ourInstance; synchronized(ourLock) { if (ourInstance == null) { ourInstance = new YamlUnstructuredClass(); addUnstructuredFeature(ourInstance); } } return ourInstance; }
getInstance
64,590
Field (@NotNull YamlMetaClass metaClass) { return metaClass.addFeature(new Field("anything:<any-key>", getInstance())) .withAnyName() .withRelationSpecificType(Field.Relation.SEQUENCE_ITEM, getInstance()) .withRelationSpecificType(Field.Relation.SCALAR_VALUE, YamlAnyScalarType.getInstance()) .withEmptyValueAllowed(true...
addUnstructuredFeature
64,591
Field (@NotNull Relation relation) { myOverriddenDefaultRelation = relation; return this; }
withDefaultRelation
64,592
Field (@NotNull Relation relation, @NotNull YamlMetaType specificType) { myPerRelationTypes.put(relation, specificType); return this; }
withRelationSpecificType
64,593
Field () { return withMultiplicityManyNotOne(true); }
withMultiplicityMany
64,594
Field (boolean manyNotOne) { myIsMany = manyNotOne; return this; }
withMultiplicityManyNotOne
64,595
boolean () { return myIsMany; }
isMany
64,596
Field () { myIsRequired = true; return this; }
setRequired
64,597
Field () { myDeprecated = true; return this; }
setDeprecated
64,598
Field () { myEditable = false; return this; }
setNonEditable
64,599
boolean () { return myIsRequired; }
isRequired