Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
64,200
JsonValueAdapter (@NotNull PsiElement element) { return element instanceof YAMLValue ? YamlPropertyAdapter.createValueAdapterByType((YAMLValue)element) : (element instanceof YAMLDocument ? new YamlEmptyObjectAdapter(element) : null); }
createValueAdapter
64,201
boolean () { return true; }
allowsSingleQuotes
64,202
boolean (@NotNull PsiElement element) { return false; }
hasMissingCommaAfter
64,203
JsonPropertyAdapter (@NotNull PsiElement element) { YAMLMapping mapping = PsiTreeUtil.getParentOfType(element, YAMLMapping.class, true, YAMLKeyValue.class); if (mapping != null) { // if we reach a mapping without reaching any key-value, this is a case like: // - foo: bar // a // and we should create a property adapter ...
getParentPropertyAdapter
64,204
Set<String> (@NotNull PsiElement originalPosition, PsiElement computedPosition) { YAMLMapping object = PsiTreeUtil.getParentOfType(originalPosition, YAMLMapping.class, false); YAMLMapping otherObject = PsiTreeUtil.getParentOfType(computedPosition, YAMLMapping.class, false); // the original position can be either a soun...
getPropertyNamesOfParentObject
64,205
int (@NotNull PsiElement element) { return YAMLUtil.getIndentToThisElement(element); }
indentOf
64,206
int (@NotNull PsiFile file) { return CodeStyle.getSettings(file.getProject(), file.getVirtualFile()).getIndentOptionsByFile(file).INDENT_SIZE; }
indentOf
64,207
JsonPointerPosition (@NotNull PsiElement element, boolean forceLastTransition) { JsonPointerPosition pos = new JsonPointerPosition(); PsiElement current = element; while (!breakCondition(current)) { final PsiElement position = current; current = current.getParent(); if (current instanceof YAMLSequence array) { final Li...
findPosition
64,208
boolean (PsiElement current) { return current instanceof PsiFile || current instanceof YAMLDocument || current instanceof YAMLBlockMappingImpl && current.getParent() instanceof YAMLDocument; }
breakCondition
64,209
boolean () { return false; }
requiresValueQuotes
64,210
String () { return ""; }
getDefaultObjectValue
64,211
String () { return "- "; }
getDefaultArrayValue
64,212
boolean () { return true; }
hasWhitespaceDelimitedCodeBlocks
64,213
String (PsiElement element) { String text = element.getText(); if (!StringUtil.startsWith(text, "!!") && !StringUtil.startsWithChar(text, '&')) return text; // remove tags int spaceIndex = text.indexOf(' '); return spaceIndex > 0 ? text.substring(spaceIndex + 1) : text; }
getNodeTextForValidation
64,214
TextRange (@NotNull PsiElement element) { YAMLAnchor[] anchors = PsiTreeUtil.getChildrenOfType(element, YAMLAnchor.class); if (anchors != null && anchors.length > 0) { YAMLAnchor lastAnchor = anchors[anchors.length - 1]; PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(lastAnchor); return next == null ? ...
adjustErrorHighlightingRange
64,215
JsonLikeSyntaxAdapter (Project project) { return new JsonLikeSyntaxAdapter() { private final YAMLElementGenerator myGenerator = YAMLElementGenerator.getInstance(project); @Nullable @Override public PsiElement getPropertyValue(PsiElement property) { assert property instanceof YAMLKeyValue; YAMLValue value = ((YAMLKeyVal...
getSyntaxAdapter
64,216
PsiElement (PsiElement property) { assert property instanceof YAMLKeyValue; YAMLValue value = ((YAMLKeyValue)property).getValue(); if (value == null) return null; return adjustValue(value); }
getPropertyValue
64,217
PsiElement (@NotNull PsiElement value) { if (!(value instanceof YAMLValue)) return value; YAMLAnchor[] anchors = PsiTreeUtil.getChildrenOfType(value, YAMLAnchor.class); if (anchors == null || anchors.length == 0) return value; PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(anchors[anchors.length - 1]);...
adjustValue
64,218
String (PsiElement property) { assert property instanceof YAMLKeyValue; return ((YAMLKeyValue)property).getName(); }
getPropertyName
64,219
YAMLKeyValue (PsiElement element) { if (PsiUtilCore.getElementType(element) == YAMLTokenTypes.INDENT) { PsiElement prev = element.getPrevSibling(); prev = prev == null ? null : PsiTreeUtil.skipWhitespacesAndCommentsBackward(prev); if (prev instanceof YAMLKeyValue && ((YAMLKeyValue)prev).getValue() == null) { return (YA...
findPrecedingKeyValueWithNoValue
64,220
PsiElement (@NotNull String name, @NotNull String value, PsiElement element) { YAMLKeyValue keyValue = myGenerator.createYamlKeyValue(name, StringUtil.unquoteString(value)); return element instanceof YAMLDocument || findPrecedingKeyValueWithNoValue(element) != null ? myGenerator.createDummyYamlWithText(keyValue.getText...
createProperty
64,221
boolean (PsiElement self, PsiElement newElement) { if (newElement instanceof YAMLKeyValue && self instanceof YAMLKeyValue) { self.getParent().addAfter(myGenerator.createEol(), self); } return false; }
ensureComma
64,222
void (PsiElement forward) { if (forward instanceof LeafPsiElement && ((LeafPsiElement)forward).getElementType() == YAMLTokenTypes.EOL) { PsiElement nextSibling; while ((nextSibling = forward.getNextSibling()) instanceof LeafPsiElement && ((LeafPsiElement)nextSibling).getElementType() == YAMLTokenTypes.INDENT) { nextSib...
removeIfComma
64,223
boolean (PsiElement initialElement, PsiElement element) { return initialElement instanceof YAMLValue && initialElement != element; }
fixWhitespaceBefore
64,224
String (@Nullable JsonSchemaType type) { if (type == null) return ""; if (type == JsonSchemaType._object) return " "; if (type == JsonSchemaType._array) return " - "; return type.getDefaultValue(); }
getDefaultValueFromType
64,225
PsiElement (PsiElement element) { if (element instanceof YAMLMapping) return element.getFirstChild(); return element; }
adjustNewProperty
64,226
PsiElement (LeafPsiElement element) { YAMLKeyValue keyValue = findPrecedingKeyValueWithNoValue(element); assert keyValue != null : "Should come here only for YAMLKeyValue with no value and a following indent"; PsiComment nextComment = ObjectUtils.tryCast(skipNonNewlineSpaces(keyValue), PsiComment.class); if (nextCommen...
adjustPropertyAnchor
64,227
PsiElement (YAMLKeyValue keyValue) { PsiElement sibling = keyValue.getNextSibling(); while (sibling instanceof PsiWhiteSpace && !sibling.getText().contains("\n")) { sibling = sibling.getNextSibling(); } return sibling; }
skipNonNewlineSpaces
64,228
PsiElement (PsiElement element) { return PsiTreeUtil.getParentOfType(PsiTreeUtil.getParentOfType(element, YAMLKeyValue.class), YAMLMapping.class, YAMLSequence.class); }
getParentContainer
64,229
Collection<PsiElement> (@NotNull PsiFile file) { if (!(file instanceof YAMLFile)) return ContainerUtil.emptyList(); Collection<PsiElement> roots = new HashSet<>(); for (YAMLDocument document : ((YAMLFile)file).getDocuments()) { YAMLValue topLevelValue = document.getTopLevelValue(); roots.add(topLevelValue == null ? doc...
getRoots
64,230
boolean () { return false; }
requiresReformatAfterArrayInsertion
64,231
PsiElement (PsiElement property) { return property instanceof YAMLKeyValue ? ((YAMLKeyValue)property).getKey() : null; }
getPropertyNameElement
64,232
boolean (@NotNull VirtualFile file, @Nullable Project project) { FileType type = file.getFileType(); if (type instanceof LanguageFileType && ((LanguageFileType)type).getLanguage() instanceof YAMLLanguage) return true; if (project == null || !ScratchUtil.isScratch(file)) return false; RootType rootType = ScratchFileServ...
isEnabledForFile
64,233
boolean (VirtualFile file) { return isEnabledForFile(file, null /*avoid checking scratches*/); }
canBeSchemaFile
64,234
PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { PsiFile file = holder.getFile(); if (!(file instanceof YAMLFile)) { return PsiElementVisitor.EMPTY_VISITOR; } Collection<PsiElement> roots = YamlJsonPsiWalker.INSTANCE.getRoots(file); if (roots.isEmpty(...
buildVisitor
64,235
boolean () { PsiElement tag = myObject.getTag(); return tag == null || "!!map".equals(tag.getText()); }
isObject
64,236
boolean () { return false; }
isArray
64,237
boolean () { return false; }
isStringLiteral
64,238
boolean () { return false; }
isNumberLiteral
64,239
boolean () { return false; }
isBooleanLiteral
64,240
PsiElement () { return myObject; }
getDelegate
64,241
JsonObjectValueAdapter () { return this; }
getAsObject
64,242
JsonArrayValueAdapter () { return null; }
getAsArray
64,243
List<JsonPropertyAdapter> () { return myChildAdapters.getValue(); }
getPropertyList
64,244
List<JsonPropertyAdapter> () { Collection<YAMLKeyValue> keyValues = myObject.getKeyValues(); List<JsonPropertyAdapter> adapters = new ArrayList<>(keyValues.size()); for (YAMLKeyValue value : keyValues) { if (addPropertiesFromReferencedObject(adapters, value)) continue; adapters.add(new YamlPropertyAdapter(value)); } re...
computeChildAdapters
64,245
boolean (List<JsonPropertyAdapter> adapters, YAMLKeyValue value) { String keyText = value.getKeyText(); if (!"<<".equals(keyText)) return false; YAMLValue yamlValue = value.getValue(); PsiElement resolved = resolveYamlAlias(yamlValue); if (resolved != null) { YAMLMapping mapping = ObjectUtils.tryCast(resolved, YAMLMapp...
addPropertiesFromReferencedObject
64,246
PsiElement (YAMLValue yamlValue) { PsiReference reference = yamlValue instanceof YAMLAlias ? yamlValue.getReference() : null; PsiElement resolved = reference == null ? null : reference.resolve(); resolved = resolved == null ? null : resolved.getParent(); return resolved; }
resolveYamlAlias
64,247
void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); final JsonSchemaService jsonSchemaService = JsonSchemaService.Impl.get(position.getProject()); JsonSchemaObject object = jsonSchemaService.getSchemaObject(parameters.getOriginalFi...
fillCompletionVariants
64,248
boolean () { return false; }
isObject
64,249
boolean () { return false; }
isArray
64,250
boolean () { return false; }
isStringLiteral
64,251
boolean () { return false; }
isNumberLiteral
64,252
boolean () { return false; }
isBooleanLiteral
64,253
boolean () { return true; }
isNull
64,254
PsiElement () { return myElement; }
getDelegate
64,255
JsonObjectValueAdapter () { return null; }
getAsObject
64,256
JsonArrayValueAdapter () { return null; }
getAsArray
64,257
boolean () { return false; }
isObject
64,258
boolean () { return false; }
isArray
64,259
boolean () { return true; }
isStringLiteral
64,260
boolean () { return false; }
isNumberLiteral
64,261
boolean () { return false; }
isBooleanLiteral
64,262
boolean () { return false; }
isNull
64,263
PsiElement () { return myDelegate; }
getDelegate
64,264
JsonObjectValueAdapter () { return null; }
getAsObject
64,265
JsonArrayValueAdapter () { return null; }
getAsArray
64,266
boolean () { return true; }
isObject
64,267
boolean () { return false; }
isArray
64,268
boolean () { return false; }
isStringLiteral
64,269
boolean () { return false; }
isNumberLiteral
64,270
boolean () { return false; }
isBooleanLiteral
64,271
List<JsonPropertyAdapter> () { return ContainerUtil.emptyList(); }
getPropertyList
64,272
PsiElement () { return myElement; }
getDelegate
64,273
JsonObjectValueAdapter () { return this; }
getAsObject
64,274
JsonArrayValueAdapter () { return null; }
getAsArray
64,275
JsonSchemaType (JsonSchemaType type) { return type == JsonSchemaType._object ? JsonSchemaType._null : type; }
getAlternateType
64,276
boolean () { return true; }
isShouldBeIgnored
64,277
boolean () { return false; }
isObject
64,278
boolean () { return false; }
isArray
64,279
boolean () { return !isNumberLiteral() && !isBooleanLiteral() && !isNull(); }
isStringLiteral
64,280
String () { YAMLAnchor[] anchors = PsiTreeUtil.getChildrenOfType(myValue, YAMLAnchor.class); if (anchors == null || anchors.length == 0) return myValue.getText(); int endOffset = anchors[anchors.length - 1].getTextRange().getEndOffset(); TextRange valueTextRange = myValue.getTextRange(); int offset = valueTextRange.get...
getTextWithoutRefs
64,281
boolean (@NotNull String text, @NotNull String tagName) { return StringUtil.startsWith(text, "!!" + tagName); }
hasTag
64,282
boolean () { String text = getTextWithoutRefs(); return isNumber(text); }
isNumberLiteral
64,283
boolean () { String text = getTextWithoutRefs(); return BOOLS.contains(text) || hasTag(text, "bool"); }
isBooleanLiteral
64,284
boolean () { String text = getTextWithoutRefs(); return NULLS.contains(text) || hasTag(text, "null"); }
isNull
64,285
PsiElement () { return myValue; }
getDelegate
64,286
JsonObjectValueAdapter () { return null; }
getAsObject
64,287
JsonArrayValueAdapter () { return null; }
getAsArray
64,288
boolean () { return false; }
shouldCheckIntegralRequirements
64,289
boolean (@Nullable String s) { if (s == null) return false; return isInteger(s) || isFloat(s); }
isNumber
64,290
boolean (@NotNull String s) { if (s.length() == 0) return false; if ("0".equals(s) || "-0".equals(s) || "+0".equals(s)) return true; if (hasTag(s, "int")) return true; if (matchesInt(s)) return true; return false; }
isInteger
64,291
boolean (@NotNull String s) { char charZero = s.charAt(0); int startIndex = (charZero == '-' || charZero == '+') ? 1 : 0; char baseSign = ' '; boolean expectBase = false; for (int i = startIndex; i < s.length(); ++i) { if (i == startIndex && s.charAt(i) == '0') { if (startIndex != 0) return false; expectBase = true; co...
matchesInt
64,292
boolean (@NotNull String s) { if (INFS.contains(trimSign(s)) || NANS.contains(s)) return true; if (hasTag(s, "float")) return true; return FLOAT_PATTERN.matcher(s).matches(); }
isFloat
64,293
String (@NotNull String s) { if (s.isEmpty()) return s; char c = s.charAt(0); return c == '+' || c == '-' ? s.substring(1) : s; }
trimSign
64,294
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session, Collection<PsiElement> roots, JsonSchemaObject schema) { PsiElement sampleElement = roots.iterator().next(); final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(sampleElement, schema); if (walker == null || schema =...
doBuildVisitor
64,295
void (@NotNull YAMLKeyValue keyValue) { annotate(keyValue); super.visitKeyValue(keyValue); }
visitKeyValue
64,296
void (@NotNull YAMLKeyValue keyValue) { PsiElement key = keyValue.getKey(); if (key == null) { return; } JsonPointerPosition position = walker.findPosition(keyValue, true); if (position == null) { return; } final MatchResult result = new JsonSchemaResolver(project, schema, position).detailedResolve(); for (JsonSchemaOb...
annotate
64,297
OptPane () { return pane( checkbox("myCaseInsensitiveEnum", JsonBundle.message("json.schema.inspection.case.insensitive.enum"))); }
getOptionsPane
64,298
PsiElementVisitor (@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session, Collection<PsiElement> roots, JsonSchemaObject object) { JsonComplianceCheckerOptions options = new JsonComplianceCheckerOptions(myCaseInsensitiveEnum); return new YamlPsiElementVisitor() { @Override public void visitElement...
doBuildVisitor
64,299
void (@NotNull PsiElement element) { if (!roots.contains(element)) return; final JsonLikePsiWalker walker = JsonLikePsiWalker.getWalker(element, object); if (walker == null) return; String prefix = YAMLBundle.message("inspections.schema.validation.prefix") + " "; new JsonSchemaComplianceChecker(object, holder, walker, ...
visitElement