Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
299,200
void () { myDefaultDescriptorsCacheStrict.clear(); myDefaultDescriptorsCacheNotStrict.clear(); myRootTag = null; myProlog = null; super.clearCaches(); }
clearCaches
299,201
CompositePsiElement () { HashMap<String, CachedValue<XmlNSDescriptor>> cacheStrict = new HashMap<>( myDefaultDescriptorsCacheStrict ); HashMap<String, CachedValue<XmlNSDescriptor>> cacheNotStrict = new HashMap<>( myDefaultDescriptorsCacheNotStrict ); final XmlDocumentImpl copy = (XmlDocumentImpl) super.clone(); updateSelfDependentDtdDescriptors(copy, cacheStrict, cacheNotStrict); return copy; }
clone
299,202
PsiElement () { HashMap<String, CachedValue<XmlNSDescriptor>> cacheStrict = new HashMap<>( myDefaultDescriptorsCacheStrict ); HashMap<String, CachedValue<XmlNSDescriptor>> cacheNotStrict = new HashMap<>( myDefaultDescriptorsCacheNotStrict ); final XmlDocumentImpl copy = (XmlDocumentImpl)super.copy(); updateSelfDependentDtdDescriptors(copy, cacheStrict, cacheNotStrict); return copy; }
copy
299,203
void (XmlDocumentImpl copy, HashMap<String, CachedValue<XmlNSDescriptor>> cacheStrict, HashMap<String, CachedValue<XmlNSDescriptor>> cacheNotStrict) { copy.myDefaultDescriptorsCacheNotStrict = new ConcurrentHashMap<>(); copy.myDefaultDescriptorsCacheStrict = new ConcurrentHashMap<>(); for(Map.Entry<String, CachedValue<XmlNSDescriptor>> e:cacheStrict.entrySet()) { if (e.getValue().hasUpToDateValue()) { final XmlNSDescriptor nsDescriptor = e.getValue().getValue(); if (!isGeneratedFromDtd(this, nsDescriptor)) copy.myDefaultDescriptorsCacheStrict.put(e.getKey(), e.getValue()); } } for(Map.Entry<String, CachedValue<XmlNSDescriptor>> e:cacheNotStrict.entrySet()) { if (e.getValue().hasUpToDateValue()) { final XmlNSDescriptor nsDescriptor = e.getValue().getValue(); if (!isGeneratedFromDtd(this, nsDescriptor)) copy.myDefaultDescriptorsCacheNotStrict.put(e.getKey(), e.getValue()); } } }
updateSelfDependentDtdDescriptors
299,204
PsiMetaData () { return MetaRegistry.getMeta(this); }
getMetaData
299,205
void (PsiFile file, XmlEntityDecl decl) { synchronized(LOCK) { final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file); final String name = decl.getName(); if (cachingMap.containsKey(name)) return; final SmartPsiElementPointer declPointer = SmartPointerManager.getInstance(file.getProject()).createSmartPsiElementPointer(decl); cachingMap.put( name, CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { PsiElement declElement = declPointer.getElement(); if (declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl)declElement).getName())) return new CachedValueProvider.Result<>((XmlEntityDecl)declElement, declElement); cachingMap.put(name,null); return new CachedValueProvider.Result<>(null, ModificationTracker.NEVER_CHANGED); }, false )); } }
cacheParticularEntity
299,206
void (final PsiFile file, final PsiFile context) { synchronized (LOCK) { final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file); cachingMap.putAll(getCachingMap(context)); } }
copyEntityCaches
299,207
XmlEntityDecl (PsiFile file, String name) { CachedValue<XmlEntityDecl> cachedValue; synchronized(LOCK) { final Map<String, CachedValue<XmlEntityDecl>> cachingMap = getCachingMap(file); cachedValue = cachingMap.get(name); } return cachedValue != null ? cachedValue.getValue():null; }
getCachedEntity
299,208
XmlElementContentSpec () { ASTNode child = getNode().findChildByType(XML_ELEMENT_CONTENT_SPEC); return child != null ? child.getPsi(XmlElementContentSpec.class) : null; }
getContentSpecElement
299,209
Type () { return findElementByTokenType(XML_BAR) == null ? Type.SEQUENCE : Type.CHOICE; }
getType
299,210
Quantifier () { return XmlContentParticleImpl.getQuantifierImpl(this); }
getQuantifier
299,211
XmlContentParticle[] () { return myParticles.getValue(); }
getSubParticles
299,212
XmlElementDescriptor () { return null; }
getElementDescriptor
299,213
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlAttributeValue(this); } else { visitor.visitElement(this); } }
accept
299,214
String () { // it is more correct way to strip quotes since injected xml may have quotes encoded String text = getText(); ASTNode startQuote = findChildByType(XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER); if (startQuote != null) { text = StringUtil.trimStart(text, startQuote.getText()); } ASTNode endQuote = findChildByType(XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER); if (endQuote != null) { text = StringUtil.trimEnd(text, endQuote.getText()); } return text; }
getValue
299,215
TextRange () { final TextRange range = getTextRange(); final String value = getValue(); if (value.isEmpty()) { return range; } final int start = range.getStartOffset() + getText().indexOf(value); final int end = start + value.length(); return new TextRange(start, end); }
getValueTextRange
299,216
boolean (PsiReferenceService.@NotNull Hints hints) { return false; }
shouldAskParentForReferences
299,217
PsiReference () { final PsiReference[] refs = getReferences(); if (refs.length > 0) return refs[0]; return null; }
getReference
299,218
int () { return getTextRange().getStartOffset() + 1; }
getTextOffset
299,219
boolean () { return getParent() instanceof XmlAttribute; }
isValidHost
299,220
PsiLanguageInjectionHost (@NotNull String text) { try { final String quoteChar = getTextLength() > 0 ? getText().substring(0, 1) : ""; String contents = StringUtil.containsAnyChar(quoteChar, "'\"") ? StringUtil.trimEnd(StringUtil.trimStart(text, quoteChar), quoteChar) : text; XmlAttribute newAttribute = XmlElementFactory.getInstance(getProject()).createAttribute( StringUtil.defaultIfEmpty((getParent() instanceof XmlAttribute) ? ((XmlAttribute)getParent()).getName() : null, "q"), contents, this); XmlAttributeValue newValue = newAttribute.getValueElement(); CheckUtil.checkWritable(this); replaceAllChildrenToChildrenOf(newValue.getNode()); } catch (IncorrectOperationException e) { LOG.error(e); } return this; }
updateText
299,221
LiteralTextEscaper<XmlAttributeValueImpl> () { return new XmlAttributeLiteralEscaper(this); }
createLiteralTextEscaper
299,222
PsiMetaData () { return this; }
getMetaData
299,223
PsiElement () { return this; }
getDeclaration
299,224
String (final PsiElement context) { return getValue(); }
getName
299,225
String () { return getValue(); }
getName
299,226
void (final PsiElement element) { }
init
299,227
ItemPresentation () { return new ItemPresentationWithSeparator() { @Override public String getPresentableText() { return getText(); } @Override public String getLocationString() { return SymbolPresentationUtil.getFilePathPresentation(getContainingFile()); } @Override public Icon getIcon(boolean open) { return null; } }; }
getPresentation
299,228
String () { return getText(); }
getPresentableText
299,229
String () { return SymbolPresentationUtil.getFilePathPresentation(getContainingFile()); }
getLocationString
299,230
Icon (boolean open) { return null; }
getIcon
299,231
boolean (char c, boolean isInClass) { return c == ']' || c == '}
characterNeedsEscaping
299,232
boolean () { return false; }
supportsPerl5EmbeddedComments
299,233
boolean () { return true; }
supportsPossessiveQuantifiers
299,234
boolean () { return false; }
supportsPythonConditionalRefs
299,235
boolean (RegExpGroup group) { return true; }
supportsNamedGroupSyntax
299,236
boolean (RegExpNamedGroupRef ref) { return true; }
supportsNamedGroupRefSyntax
299,237
boolean (RegExpChar regExpChar) { return false; }
supportsExtendedHexCharacter
299,238
boolean (@NotNull String category) { if (category.startsWith("Is")) { try { return Character.UnicodeBlock.forName(category.substring(2)) != null; } catch (IllegalArgumentException ignore) {} } for (String[] name : DefaultRegExpPropertiesProvider.getInstance().getAllKnownProperties()) { if (name[0].equals(category)) { return true; } } return false; }
isValidCategory
299,239
int () { return myHC; }
hashCode
299,240
XmlAttributeDelegate () { XmlAttributeDelegate impl = myImpl; if (impl != null) return impl; impl = createDelegate(); myImpl = impl; return impl; }
getImpl
299,241
XmlAttributeDelegate () { return new XmlAttributeImplDelegate(); }
createDelegate
299,242
XmlAttributeValue () { return (XmlAttributeValue)XmlChildRole.ATTRIBUTE_VALUE_FINDER.findChild(this); }
getValueElement
299,243
String () { return getImpl().getNamespace(); }
getNamespace
299,244
String () { return XmlUtil.findLocalNameByQualifiedName(getName()); }
getLocalName
299,245
void (@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlAttribute(this); } else { visitor.visitElement(this); } }
accept
299,246
String () { final XmlAttributeValue valueElement = getValueElement(); return valueElement != null ? valueElement.getValue() : null; }
getValue
299,247
int (int physicalIndex) { return getImpl().physicalToDisplay(physicalIndex); }
physicalToDisplay
299,248
int (int displayIndex) { return getImpl().displayToPhysical(displayIndex); }
displayToPhysical
299,249
TextRange () { final XmlAttributeDelegate.VolatileState state = getImpl().getFreshState(); return state == null ? TextRange.EMPTY_RANGE : state.myValueTextRange; }
getValueTextRange
299,250
void () { super.clearCaches(); myImpl = null; }
clearCaches
299,251
String () { XmlElement element = getNameElement(); return element != null ? element.getText() : ""; }
getName
299,252
boolean () { final @NonNls String name = getName(); return name.startsWith("xmlns:") || name.equals("xmlns"); }
isNamespaceDeclaration
299,253
PsiReference () { return ArrayUtil.getFirstElement(getReferences(PsiReferenceService.Hints.NO_HINTS)); }
getReference
299,254
boolean (@NotNull PsiReferenceService.Hints hints) { return false; }
shouldAskParentForReferences
299,255
String (@NotNull XmlAttribute attribute) { final String name = attribute.getLocalName(); return name.endsWith(DUMMY_IDENTIFIER_TRIMMED) ? name.substring(0, name.length() - DUMMY_IDENTIFIER_TRIMMED.length()) : name; }
getRealName
299,256
XmlStubBasedTag (@NotNull XmlTagStubImpl stub) { return new XmlStubBasedTag(stub, this); }
createPsi
299,257
XmlStubBasedTag (@NotNull ASTNode node) { return new XmlStubBasedTag(node); }
createPsi
299,258
XmlTagStubImpl (@NotNull XmlStubBasedTag psi, StubElement parentStub) { return new XmlTagStubImpl(psi, parentStub, this); }
createStub
299,259
String () { if (externalId == null) { externalId = (getLanguage() == XMLLanguage.INSTANCE ? "" : getLanguage().getID().toUpperCase(Locale.ENGLISH) + ":") + getDebugName(); } return externalId; }
getExternalId
299,260
String () { return getExternalId(); }
toString
299,261
void (@NotNull StubT stub, @NotNull IndexSink sink) { }
indexStub
299,262
ASTNode () { return new CompositeElement(this); }
createCompositeNode
299,263
String () { return name; }
getName
299,264
String () { return name; }
getName
299,265
XmlStubBasedAttribute (@NotNull XmlAttributeStubImpl stub) { return new XmlStubBasedAttribute(stub, this); }
createPsi
299,266
XmlStubBasedAttribute (@NotNull ASTNode node) { return new XmlStubBasedAttribute(node); }
createPsi
299,267
XmlAttributeStubImpl (@NotNull XmlStubBasedAttribute psi, StubElement parentStub) { return new XmlAttributeStubImpl(psi, parentStub, this); }
createStub
299,268
String (PsiElement text, String displayText) { if (text instanceof XmlText) { XmlTag tag = ((XmlText)text).getParentTag(); if (tag != null) { return "<" + tag.getName() + " " + StringUtil.join(ContainerUtil.map(tag.getAttributes(), PsiElement::getText), " ") + ">" + displayText + "</" + tag.getName() + ">"; } } return super.buildTagForText(text, displayText); }
buildTagForText
299,269
ASTNode (String displayText, PsiElement text) { final ASTNode firstChild = text.getNode().getFirstChildNode(); boolean textAlreadyHasCDATA = firstChild != null && firstChild.getElementType() == XmlElementType.XML_CDATA; if ((textAlreadyHasCDATA || XmlUtil.toCode(displayText)) && !displayText.isEmpty()) { final FileElement dummyParent = createCDATAElement(text.getManager(), SharedImplUtil.findCharTableByTree(text.getNode()), displayText); return dummyParent.getFirstChildNode(); } else { return super.encodeXmlTextContents(displayText, text); } }
encodeXmlTextContents
299,270
FileElement (final PsiManager manager, final CharTable charTableByTree, final String displayText) { final FileElement dummyParent = DummyHolderFactory.createHolder(manager, null, charTableByTree).getTreeElement(); final CompositeElement cdata = ASTFactory.composite(XmlElementType.XML_CDATA); dummyParent.rawAddChildren(cdata); cdata.rawAddChildren(ASTFactory.leaf(XmlTokenType.XML_CDATA_START, CDATA_START)); cdata.rawAddChildren(ASTFactory.leaf(XmlTokenType.XML_DATA_CHARACTERS, dummyParent.getCharTable().intern(displayText))); cdata.rawAddChildren(ASTFactory.leaf(XmlTokenType.XML_CDATA_END, CDATA_END)); dummyParent.acceptTree(new GeneratedMarkerVisitor()); return dummyParent; }
createCDATAElement
299,271
ASTNode (String displayText, PsiElement text) { if (displayText.isEmpty()) { return null; } CharTable charTable = SharedImplUtil.findCharTableByTree(text.getNode()); final FileElement dummyParent = DummyHolderFactory.createHolder(text.getManager(), null, charTable).getTreeElement(); final XmlTag rootTag = ((XmlFile)PsiFileFactory.getInstance(text.getProject()) .createFileFromText("a.xml", text.getLanguage(), buildTagForText(text, displayText), false, true)).getRootTag(); assert rootTag != null; final XmlTagChild[] tagChildren = rootTag.getValue().getChildren(); final XmlTagChild child = tagChildren.length > 0 ? tagChildren[0]:null; LOG.assertTrue(child != null, "Child is null for tag: " + rootTag.getText()); final TreeElement element = (TreeElement)child.getNode(); DebugUtil.performPsiModification(getClass().getName(), () -> { ((TreeElement)tagChildren[tagChildren.length - 1].getNode().getTreeNext()).rawRemoveUpToLast(); dummyParent.rawAddChildren(element); }); TreeUtil.clearCaches(dummyParent); return element.getFirstChildNode(); }
encodeXmlTextContents
299,272
String (PsiElement text, String displayText) { return "<a>" + displayText + "</a>"; }
buildTagForText
299,273
ASTNode (String displayText, PsiElement text) { if(!toCode(displayText)) return super.encodeXmlTextContents(displayText, text); final FileElement dummyParent = DummyHolderFactory.createHolder(text.getManager(), null, SharedImplUtil.findCharTableByTree(text.getNode())).getTreeElement(); int sectionStartOffset = 0; int offset = 0; while (offset < displayText.length()) { if (toCode(displayText.charAt(offset))) { final String plainSection = displayText.substring(sectionStartOffset, offset); if (!plainSection.isEmpty()) { dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text)); } dummyParent.rawAddChildren(createCharEntity(displayText.charAt(offset), dummyParent.getCharTable())); sectionStartOffset = offset + 1; } offset++; } final String plainSection = displayText.substring(sectionStartOffset, offset); if (!plainSection.isEmpty()) { dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text)); } dummyParent.acceptTree(new GeneratedMarkerVisitor()); return dummyParent.getFirstChildNode(); }
encodeXmlTextContents
299,274
TreeElement (char ch, CharTable charTable) { CharSequence entityText = switch (ch) { case '<' -> "&lt;"; case '\'' -> "&apos;"; case '"' -> "&quot;"; case '>' -> "&gt;"; case '&' -> "&amp;"; case '\u00a0' -> "&nbsp;"; default -> { final String charEncoding = "&#" + (int)ch + ";"; yield charTable.intern(charEncoding); } }; return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, entityText); }
createCharEntity
299,275
boolean (String str) { for (int i = 0; i < str.length(); i++) { final char ch = str.charAt(i); if ( toCode(ch)) return true; } return false; }
toCode
299,276
boolean (final char ch) { return "<&>\u00a0'\"".indexOf(ch) >= 0; }
toCode
299,277
void () { final IElementType tokenType = myDelegate.getTokenType(); if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false); advanceTodoItemCountsInToken(); } if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true, false); } else if (tokenType == XmlTokenType.XML_NAME || tokenType == XmlTokenType.XML_DATA_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, false, false); } else if (tokenType == XmlTokenType.XML_ENTITY_REF_TOKEN || tokenType == XmlTokenType.XML_CHAR_ENTITY_REF) { scanWordsInToken(UsageSearchContext.IN_CODE, false, false); } else if (tokenType == XmlElementType.XML_TEXT || tokenType == XmlElementType.HTML_RAW_TEXT) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, false, false); } else if (tokenType == XmlTokenType.XML_TAG_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, false, false); } else if (!NO_WORDS_TOKEN_SET.contains(tokenType)) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false); } myDelegate.advance(); }
advance
299,278
Lexer (@NotNull OccurrenceConsumer consumer) { return XHtmlIdIndexer.createIndexingLexer(consumer); }
createLexer
299,279
Lexer (@NotNull OccurrenceConsumer consumer) { return XmlIdIndexer.createIndexingLexer(consumer); }
createLexer
299,280
Lexer (final @NotNull OccurrenceConsumer consumer) { return createIndexingLexer(consumer); }
createLexer
299,281
XmlFilterLexer (OccurrenceConsumer consumer) { return new XmlFilterLexer(new XmlLexer(), consumer); }
createIndexingLexer
299,282
Lexer (@NotNull OccurrenceConsumer consumer) { return HtmlIdIndexer.createIndexingLexer(consumer); }
createLexer
299,283
Lexer (final @NotNull OccurrenceConsumer consumer) { return createIndexingLexer(consumer); }
createLexer
299,284
XHtmlFilterLexer (OccurrenceConsumer consumer) { return new XHtmlFilterLexer(new XHtmlLexer(true), consumer); }
createIndexingLexer
299,285
int () { return 2; }
getVersion
299,286
int (IElementType tokenType) { return tokenType == XmlTokenType.XML_COMMENT_START ? 4 : 0; }
getCommentStartDelta
299,287
int (IElementType tokenType) { return tokenType == XmlTokenType.XML_COMMENT_END ? 3 : 0; }
getCommentEndDelta
299,288
Lexer (final @NotNull OccurrenceConsumer consumer) { return createIndexingLexer(consumer); }
createLexer
299,289
XHtmlFilterLexer (OccurrenceConsumer consumer) { return new XHtmlFilterLexer(new HtmlLexer(true), consumer); }
createIndexingLexer
299,290
int () { return 2; }
getVersion
299,291
void () { final IElementType tokenType = myDelegate.getTokenType(); if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false); advanceTodoItemCountsInToken(); } else if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN || tokenType == XmlTokenType.XML_NAME || tokenType == XmlTokenType.XML_TAG_NAME || tokenType == XmlTokenType.XML_DATA_CHARACTERS ) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN, false); } else if (tokenType.getLanguage() != XMLLanguage.INSTANCE && tokenType.getLanguage() != Language.ANY ) { boolean inComments = CacheUtil.isInComments(tokenType); scanWordsInToken((inComments)?UsageSearchContext.IN_COMMENTS:UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true, false); if (inComments) advanceTodoItemCountsInToken(); } else if (!XmlFilterLexer.NO_WORDS_TOKEN_SET.contains(tokenType)) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false); } myDelegate.advance(); }
advance
299,292
ASTNode (@NotNull ASTNode parent) { final PsiElement element = XmlTagUtil.getStartTagNameElement((XmlTag)parent.getPsi()); return element == null ? null : element.getNode(); }
findChild
299,293
FlyweightCapableTreeStructure<LighterASTNode> (@NotNull LighterLazyParseableNode chameleon) { final PsiFile file = chameleon.getContainingFile(); assert file != null : chameleon; final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(file.getProject(), chameleon); new HTMLParser().parseWithoutBuildingTree(XmlElementType.HTML_FILE, builder); return builder.getLightTree(); }
parseContents
299,294
int () { return getHtmlStubVersion() + 3; }
getStubVersion
299,295
int () { int version = stubVersion; if (version != -1) return version; IElementType[] dataElementTypes = IElementType.enumerate( (elementType) -> elementType instanceof IStubFileElementType && isAcceptable(elementType)); int res = Arrays.stream(dataElementTypes).mapToInt((e) -> ((IStubFileElementType<?>)e).getStubVersion()).sum(); stubVersion = res; return res; }
getHtmlStubVersion
299,296
boolean (IElementType elementType) { String id = elementType.getLanguage().getID(); //hardcoded values as in BaseHtmlLexer //js and css dialect uses the same stub id as the parent language return id.equals("JavaScript") || id.equals("CSS"); }
isAcceptable
299,297
ASTNode (@NotNull CharSequence text, @NotNull CharTable table) { return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse(); }
parse
299,298
List<EmbeddedTokenTypesProvider> () { return EXTENSION_POINT_NAME.getExtensionList(); }
getProviders
299,299
IElementType () { IElementType tokenType = getDelegate().getTokenType(); if (tokenType == null) return null; tokenType = fixWrongTokenTypes(tokenType); return tokenType; }
getTokenType