Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
64,400
int () { return getNavigationElement().getNode().getStartOffset(); }
getTextOffset
64,401
YAMLValue () { PsiElement parent = getParent(); if (parent instanceof YAMLValue) { return (YAMLValue)parent; } return null; }
getMarkedValue
64,402
String () { return "YAML anchor"; }
toString
64,403
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitAnchor(this); } else { super.accept(visitor); } }
accept
64,404
List<TextRange> () { final ASTNode firstContentNode = myHost.getFirstContentNode(); if (firstContentNode == null) { return Collections.emptyList(); } List<TextRange> result = new ArrayList<>(); TextRange contentRange = TextRange.create(firstContentNode.getStartOffset(), myHost.getTextRange().getEndOffset()) .shiftRight...
getContentRanges
64,405
String (@NotNull CharSequence text, @NotNull List<TextRange> contentRanges, int indexBefore) { final TextRange leftRange = contentRanges.get(indexBefore); if (leftRange.isEmpty() || !myHost.isSingleQuote() && text.charAt(leftRange.getEndOffset() - 1) == '\\') { return "\n"; } else if (contentRanges.get(indexBefore + 1)...
getRangesJoiner
64,406
void (@NotNull YAMLKeyValue key) { PsiElement anchor = null; for (PsiElement child = getLastChild(); child != null; child = child.getPrevSibling()) { final IElementType type = child.getNode().getElementType(); if (type == YAMLTokenTypes.COMMA || type == YAMLTokenTypes.LBRACE) { anchor = child; } } addAfter(key, anchor)...
addNewKey
64,407
String () { return "YAML hash"; }
toString
64,408
String () { return "YAML key value"; }
toString
64,409
PsiElement () { PsiElement colon = findChildByType(YAMLTokenTypes.COLON); if (colon == null) { return null; } ASTNode node = colon.getNode(); do { node = node.getTreePrev(); } while(YAMLElementTypes.BLANK_ELEMENTS.contains(PsiUtilCore.getElementType(node))); if (node == null || PsiUtilCore.getElementType(node) == YAMLT...
getKey
64,410
YAMLMapping () { return ObjectUtils.tryCast(super.getParent(), YAMLMapping.class); }
getParentMapping
64,411
String () { return getKeyText(); }
getName
64,412
String () { final PsiElement keyElement = getKey(); if (keyElement == null) { return ""; } if (keyElement instanceof YAMLScalar) { return ((YAMLScalar)keyElement).getTextValue(); } if (keyElement instanceof YAMLCompoundValue) { return ((YAMLCompoundValue)keyElement).getTextValue(); } final String text = keyElement.getT...
getKeyText
64,413
YAMLValue () { for (PsiElement child = getLastChild(); child != null; child = child.getPrevSibling()) { if (PsiUtilCore.getElementType(child) == YAMLTokenTypes.COLON) { return null; } if (child instanceof YAMLValue) { return ((YAMLValue)child); } } return null; }
getValue
64,414
String () { final YAMLValue value = getValue(); if (value instanceof YAMLScalar){ return ((YAMLScalar)value).getTextValue(); } else if (value instanceof YAMLCompoundValue) { return ((YAMLCompoundValue)value).getTextValue(); } return ""; }
getValueText
64,415
void (@NotNull YAMLValue value) { adjustWhitespaceToContentType(value instanceof YAMLScalar); if (getValue() != null) { getValue().replace(value); return; } final YAMLElementGenerator generator = YAMLElementGenerator.getInstance(getProject()); if (isExplicit()) { if (findChildByType(YAMLTokenTypes.COLON) == null) { add...
setValue
64,416
void (boolean isScalar) { assert getKey() != null; PsiElement key = getKey(); if (key.getNextSibling() != null && key.getNextSibling().getNode().getElementType() == YAMLTokenTypes.COLON) { key = key.getNextSibling(); } while (key.getNextSibling() != null && !(key.getNextSibling() instanceof YAMLValue)) { key.getNextSib...
adjustWhitespaceToContentType
64,417
Icon (@IconFlags int flags) { return YAML_KEY_ICON; }
getElementIcon
64,418
ItemPresentation () { ItemPresentation custom = ItemPresentationProviders.getItemPresentation(this); if (custom != null) { return custom; } final YAMLFile yamlFile = (YAMLFile)getContainingFile(); final PsiElement value = getValue(); return new ItemPresentation() { @Override public String getPresentableText() { if (val...
getPresentation
64,419
String () { if (value instanceof YAMLScalar){ ItemPresentation presentation = ((YAMLScalar)value).getPresentation(); return presentation != null ? presentation.getPresentableText() : getValueText(); } return getName(); }
getPresentableText
64,420
String () { return yamlFile.getName(); }
getLocationString
64,421
Icon (boolean open) { return YAMLKeyValueImpl.this.getIcon(0); }
getIcon
64,422
boolean () { final ASTNode child = getNode().getFirstChildNode(); return child != null && child.getElementType() == YAMLTokenTypes.QUESTION; }
isExplicit
64,423
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitKeyValue(this); } else { super.accept(visitor); } }
accept
64,424
String () { return "YAML array"; }
toString
64,425
PsiElement () { final PsiElement firstChild = getFirstChild(); if (firstChild.getNode().getElementType() == YAMLTokenTypes.TAG) { return firstChild; } else { return null; } }
getTag
64,426
String () { return "YAML value"; }
toString
64,427
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitValue(this); } else { super.accept(visitor); } }
accept
64,428
Collection<YAMLKeyValue> () { return PsiTreeUtil.getChildrenOfTypeAsList(this, YAMLKeyValue.class); }
getKeyValues
64,429
YAMLKeyValue (@NotNull String keyText) { for (YAMLKeyValue keyValue : getKeyValues()) { if (keyText.equals(keyValue.getKeyText())) { return keyValue; } } return null; }
getKeyValueByKey
64,430
void (@NotNull YAMLKeyValue keyValueToAdd) { final YAMLKeyValue existingKey = getKeyValueByKey(keyValueToAdd.getKeyText()); if (existingKey == null) { addNewKey(keyValueToAdd); } else { existingKey.replace(keyValueToAdd); } }
putKeyValue
64,431
void (@NotNull YAMLKeyValue keyValueToDelete) { if (keyValueToDelete.getParent() != this) { throw new IllegalArgumentException("KeyValue should be the child of this"); } YAMLUtil.deleteSurroundingWhitespace(keyValueToDelete); keyValueToDelete.delete(); }
deleteKeyValue
64,432
String () { return "YAML mapping"; }
toString
64,433
String () { return "<mapping:" + Integer.toHexString(getText().hashCode()) + ">"; }
getTextValue
64,434
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitMapping(this); } else { super.accept(visitor); } }
accept
64,435
List<YAMLSequenceItem> () { return PsiTreeUtil.getChildrenOfTypeAsList(this, YAMLSequenceItem.class); }
getItems
64,436
String () { return "<sequence:" + Integer.toHexString(getText().hashCode()) + ">"; }
getTextValue
64,437
String () { return "YAML sequence"; }
toString
64,438
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitSequence(this); } else { super.accept(visitor); } }
accept
64,439
IElementType () { return YAMLTokenTypes.SCALAR_LIST; }
getContentType
64,440
YamlScalarTextEvaluator<YAMLScalarListImpl> () { return new YAMLBlockScalarTextEvaluator<>(this) { @Override protected @NotNull String getRangesJoiner(@NotNull CharSequence text, @NotNull List<TextRange> contentRanges, int indexBefore) { return ""; } @Override public @NotNull String getTextValue(@Nullable TextRange ran...
getTextEvaluator
64,441
String (@NotNull CharSequence text, @NotNull List<TextRange> contentRanges, int indexBefore) { return ""; }
getRangesJoiner
64,442
String (@Nullable TextRange rangeInHost) { String value = super.getTextValue(rangeInHost); if (!StringUtil.isEmptyOrSpaces(value) && getChompingIndicator() == ChompingIndicator.KEEP && isEnding(rangeInHost)) { value += "\n"; } return value; }
getTextValue
64,443
boolean (ASTNode child) { if (getChompingIndicator() == ChompingIndicator.KEEP) return true; if (isEol(child) && isEolOrNull(child.getTreeNext()) && !(YAMLTokenTypes.INDENT.equals(ObjectUtils.doIfNotNull(child.getTreePrev(), ASTNode::getElementType)) && myHost.getLinesNodes().size() <= 2)) { return false; } ASTNode nex...
shouldIncludeEolInRange
64,444
PsiLanguageInjectionHost (@NotNull String text) { String original = getNode().getText(); int commonPrefixLength = StringUtil.commonPrefixLength(original, text); int commonSuffixLength = StringUtil.commonSuffixLength(original, text); int indent = locateIndent(); ASTNode scalarEol = getNode().findChildByType(YAMLTokenTyp...
updateText
64,445
String () { return "YAML scalar list"; }
toString
64,446
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitScalarList(this); } else { super.accept(visitor); } }
accept
64,447
YAMLKeyValue () { YAMLKeyValue firstKeyValue = findChildByType(YAMLElementTypes.KEY_VALUE_PAIR); if (firstKeyValue == null) { throw new IllegalStateException(EMPTY_MAP_MESSAGE); } return firstKeyValue; }
getFirstKeyValue
64,448
void (@NotNull YAMLKeyValue key) { final int indent = YAMLUtil.getIndentToThisElement(this); final YAMLElementGenerator generator = YAMLElementGenerator.getInstance(getProject()); IElementType lastChildType = PsiUtilCore.getElementType(getLastChild()); if (indent == 0) { if (lastChildType != YAMLTokenTypes.EOL) { add(g...
addNewKeyToTheEnd
64,449
void (@NotNull YAMLKeyValue key) { final int indent = YAMLUtil.getIndentToThisElement(this); ASTNode node = getNode(); ASTNode place = node.getLastChildNode(); ASTNode whereInsert = null; while(place != null) { if(place.getElementType() == YAMLTokenTypes.INDENT && place.getTextLength() == indent) { whereInsert = place;...
addNewKey
64,450
void (@NotNull YAMLKeyValue keyValue, int offset) { int indent = YAMLUtil.getIndentToThisElement(this); if (offset < getTextRange().getStartOffset()) { offset = getTextRange().getStartOffset(); } YAMLElementGenerator generator = YAMLElementGenerator.getInstance(getProject()); if (offset == getTextRange().getStartOffset...
insertKeyValueAtOffset
64,451
YAMLKeyValue (@NotNull List<String> keyComponents, int preferableOffset) { if (keyComponents.isEmpty()) { return null; } String head = keyComponents.iterator().next(); List<String> tail = ContainerUtil.subList(keyComponents, 1); YAMLKeyValue keyValue = getKeyValueByKey(head); if (keyValue == null) { int indent = YAMLUt...
getOrCreateKeySequence
64,452
List<TextRange> () { final ASTNode firstContentNode = getFirstContentNode(); if (firstContentNode == null) { return Collections.emptyList(); } List<TextRange> result = new ArrayList<>(); TextRange contentRange = TextRange.create(firstContentNode.getStartOffset(), getTextRange().getEndOffset()) .shiftRight(-getTextRange...
getContentRanges
64,453
YamlScalarTextEvaluator () { return new YAMLQuotedTextTextEvaluator(this); }
getTextEvaluator
64,454
boolean () { return textContains('\n'); }
isMultiline
64,455
boolean () { return myIsSingleQuoted; }
isSingleQuote
64,456
String () { return "YAML quoted text"; }
toString
64,457
int (@NotNull CharSequence text, int pos) { if (pos + 1 >= text.length() || text.charAt(pos) != '\\') { throw new IllegalArgumentException("This is not an escapement start"); } final char c = text.charAt(pos + 1); if (c == 'x') { return 3; } else if (c == 'u') { return 5; } else if (c == 'U') { return 9; } else { retur...
findEscapementLength
64,458
int (@NotNull CharSequence text, int pos, int length) { if (length > 1) { CharSequence s = text.subSequence(pos + 2, Math.min(text.length(), pos + length + 1)); try { return Integer.parseInt(s.toString(), 16); } catch (NumberFormatException e) { return '?'; } } else { final Integer result = ESC_TO_CODE.getValue().get(t...
toUnicodeChar
64,459
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitQuotedText(this); } else { super.accept(visitor); } }
accept
64,460
TextRange (@NotNull YAMLScalarImpl element) { final List<TextRange> ranges = element.getContentRanges(); if (ranges.isEmpty()) { return TextRange.EMPTY_RANGE; } return TextRange.create(ranges.get(0).getStartOffset(), ranges.get(ranges.size() - 1).getEndOffset()); }
getRangeInElement
64,461
String (@NotNull PsiElement element, @NotNull ElementDescriptionLocation location) { if (location instanceof UsageViewTypeLocation) { if (element instanceof YAMLAnchor) { return YAMLBundle.message("YAMLElementDescriptionProvider.type.anchor"); } } return null; }
getElementDescription
64,462
String () { return "YAML document"; }
toString
64,463
YAMLValue () { return PsiTreeUtil.findChildOfType(this, YAMLValue.class); }
getTopLevelValue
64,464
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitDocument(this); } else { super.accept(visitor); } }
accept
64,465
ItemPresentation () { return new ItemPresentation() { @Override public @NotNull String getPresentableText() { return YAMLBundle.message("element.presentation.document.type"); } @Override public @NotNull String getLocationString() { return getContainingFile().getName(); } @Override public @NotNull Icon getIcon(boolean u...
getPresentation
64,466
String () { return YAMLBundle.message("element.presentation.document.type"); }
getPresentableText
64,467
String () { return getContainingFile().getName(); }
getLocationString
64,468
Icon (boolean unused) { return AllIcons.Json.Object; }
getIcon
64,469
String () { return getTextEvaluator().getTextValue(null); }
getTextValue
64,470
String (@Nullable TextRange rangeInHost) { return getTextEvaluator().getTextValue(rangeInHost); }
getTextValue
64,471
PsiReference () { final PsiReference[] references = getReferences(); return references.length == 1 ? references[0] : null; }
getReference
64,472
boolean () { return true; }
isValidHost
64,473
PsiLanguageInjectionHost (@NotNull String text) { return ElementManipulators.handleContentChange(this, text); }
updateText
64,474
boolean (CharSequence text, int pos) { return (pos - 1 < 0 || !YAMLGrammarCharUtil.isSpaceLike(text.charAt(pos - 1))) && (pos + 1 >= text.length() || !YAMLGrammarCharUtil.isSpaceLike(text.charAt(pos + 1))); }
isSurroundedByNoSpace
64,475
ASTNode () { ASTNode node = getNode().getFirstChildNode(); while (node != null && ( node.getElementType() == YAMLTokenTypes.TAG || YAMLElementTypes.BLANK_ELEMENTS.contains(node.getElementType()))) { node = node.getTreeNext(); } return node; }
getFirstContentNode
64,476
boolean (@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) { text = myHost.getText(); contentRanges = myHost.getContentRanges(); boolean decoded = false; for (TextRange range : contentRanges) { TextRange intersection = range.intersection(rangeInsideHost); if (intersection == null) continue; decoded =...
decode
64,477
TextRange () { if (contentRanges == null) { contentRanges = myHost.getContentRanges(); } if (contentRanges.isEmpty()) return TextRange.EMPTY_RANGE; return TextRange.create(contentRanges.get(0).getStartOffset(), contentRanges.get(contentRanges.size() - 1).getEndOffset()); }
getRelevantTextRange
64,478
int (int offsetInDecoded, @NotNull TextRange rangeInsideHost) { int currentOffsetInDecoded = 0; TextRange last = null; for (int i = 0; i < contentRanges.size(); i++) { final TextRange range = rangeInsideHost.intersection(contentRanges.get(i)); if (range == null) continue; last = range; String curString = range.subSeque...
getOffsetInHost
64,479
boolean () { return !myHost.isMultiline(); }
isOneLine
64,480
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof YamlPsiElementVisitor) { ((YamlPsiElementVisitor)visitor).visitScalar(this); } else { super.accept(visitor); } }
accept
64,481
ItemPresentation () { return new ItemPresentation() { @Override public @NotNull String getPresentableText() { return StringUtil.shortenTextWithEllipsis(getTextValue(), 20, 0, true); } @Override public @NotNull String getLocationString() { return getContainingFile().getName(); } @Override public @NotNull Icon getIcon(bo...
getPresentation
64,482
String () { return StringUtil.shortenTextWithEllipsis(getTextValue(), 20, 0, true); }
getPresentableText
64,483
String () { return getContainingFile().getName(); }
getLocationString
64,484
Icon (boolean unused) { return AllIcons.Nodes.Variable; }
getIcon
64,485
String (@NotNull final String newName, @NotNull final Project project) { return IDENTIFIER_PATTERN.matcher(newName).matches() ? null : YAMLBundle.message("rename.invalid.name", newName); }
getErrorMessage
64,486
boolean (@NotNull final String newName, @NotNull final PsiElement element, @NotNull final ProcessingContext context) { return true; }
isInputValid
64,487
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new YamlPsiElementVisitor() { @Override public void visitAnchor(@NotNull YAMLAnchor anchor) { Collection<PsiReference> references = ReferencesSearch.search(anchor, GlobalSearchScope.fileScope(anchor.getContainingFile())).findAll(); if...
buildVisitor
64,488
void (@NotNull YAMLAnchor anchor) { Collection<PsiReference> references = ReferencesSearch.search(anchor, GlobalSearchScope.fileScope(anchor.getContainingFile())).findAll(); if (references.isEmpty()) { holder.registerProblem( anchor, YAMLBundle.message("inspections.unused.anchor.message", anchor.getName()), ProblemHigh...
visitAnchor
64,489
String () { return YAMLBundle.message("inspections.unused.anchor.quickfix.name"); }
getFamilyName
64,490
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { YAMLAnchor anchor = (YAMLAnchor)descriptor.getPsiElement(); if (anchor == null) { return; } PostprocessReformattingAspect.getInstance(project).disablePostprocessFormattingInside(() -> { ASTNode node = TreeUtil.prevLeaf(anchor.getNode()); while (YA...
applyFix
64,491
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new YamlPsiElementVisitor() { @Override public void visitAlias(@NotNull YAMLAlias alias) { PsiReference reference = alias.getReference(); if (reference != null && reference.resolve() == null) { holder.registerProblem( reference, YAMLB...
buildVisitor
64,492
void (@NotNull YAMLAlias alias) { PsiReference reference = alias.getReference(); if (reference != null && reference.resolve() == null) { holder.registerProblem( reference, YAMLBundle.message("inspections.unresolved.alias.message", alias.getAliasName()), ProblemHighlightType.GENERIC_ERROR_OR_WARNING ); } }
visitAlias
64,493
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new YamlPsiElementVisitor() { @Override public void visitAlias(@NotNull YAMLAlias alias) { YAMLAliasReference reference = alias.getReference(); YAMLAnchor anchor = reference == null ? null: reference.resolve(); YAMLValue value = ancho...
buildVisitor
64,494
void (@NotNull YAMLAlias alias) { YAMLAliasReference reference = alias.getReference(); YAMLAnchor anchor = reference == null ? null: reference.resolve(); YAMLValue value = anchor == null ? null : anchor.getMarkedValue(); if (value == null) { return; } if (PsiTreeUtil.isAncestor(value, alias.getParent(), false)) { holde...
visitAlias
64,495
PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new YamlPsiElementVisitor() { @Override public void visitMapping(@NotNull YAMLMapping mapping) { MultiMap<String, YAMLKeyValue> occurrences = new MultiMap<>(); for (YAMLKeyValue keyValue : mapping.getKeyValues()) { final String keyName = ke...
buildVisitor
64,496
void (@NotNull YAMLMapping mapping) { MultiMap<String, YAMLKeyValue> occurrences = new MultiMap<>(); for (YAMLKeyValue keyValue : mapping.getKeyValues()) { final String keyName = keyValue.getKeyText().trim(); // http://yaml.org/type/merge.html if (keyName.equals("<<")) { continue; } if (!keyName.isEmpty()) { occurrence...
visitMapping
64,497
String () { return YAMLBundle.message("YAMLDuplicatedKeysInspection.remove.key.quickfix.name"); }
getFamilyName
64,498
boolean () { //IDEA-185914: quick fix is disabled in batch mode cause of ambiguity which item should stay return false; }
availableInBatchMode
64,499
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { YAMLKeyValue keyVal = (YAMLKeyValue)descriptor.getPsiElement().getParent(); if (keyVal == null || keyVal.getParentMapping() == null) { return; } keyVal.getParentMapping().deleteKeyValue(keyVal); }
applyFix