Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
303,900
|
String () { return ACTION_ID; }
|
getName
|
303,901
|
ActionPresentation () { return new ActionPresentationData(XmlPsiBundle.message("html5.outline.mode"), null, AllIcons.Xml.Html5); }
|
getPresentation
|
303,902
|
String () { return XmlPsiBundle.message("html5.outline.mode"); }
|
getCheckBoxText
|
303,903
|
String () { return "FileStructurePopup"; }
|
getActionIdForShortcut
|
303,904
|
String () { return HTML5_OUTLINE_PROVIDER_PROPERTY; }
|
getPropertyName
|
303,905
|
Collection<Html5SectionTreeElement> (@NotNull final TreeElement node) { if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList(); final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement(); final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument(); if (document == null) return Collections.emptyList(); final List<XmlTag> rootTags = new ArrayList<>(); document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document); final Collection<Html5SectionTreeElement> result = new ArrayList<>(); for (XmlTag tag : rootTags) { result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag)); } return result; }
|
provideNodes
|
303,906
|
Collection<StructureViewTreeElement> () { return myChildrenComputable.compute(); }
|
getChildrenBase
|
303,907
|
String () { if (myHeader != null) { return HtmlTagTreeElement.normalizeSpacesAndShortenIfLong(myHeader); } final XmlTag tag = getElement(); return tag == null ? null : HtmlTagTreeElement.normalizeSpacesAndShortenIfLong(tag.getValue().getTrimmedText()); }
|
getPresentableText
|
303,908
|
String () { return HtmlUtil.getTagPresentation(getElement()); }
|
getLocationString
|
303,909
|
boolean () { return true; }
|
isSearchInLocationString
|
303,910
|
Comparator () { return new Comparator() { @Override public int compare(Object o1, Object o2) { String s1 = SorterUtil.getStringPresentation(o1); String s2 = SorterUtil.getStringPresentation(o2); if (isTagPresentation(s1, "head") && isTagPresentation(s2, "body")) return -1; if (isTagPresentation(s1, "body") && isTagPresentation(s2, "head")) return 1; return s1.compareToIgnoreCase(s2); } private static boolean isTagPresentation(final String presentation, final String tagName) { // "head", "head#id", "head.cls" final String lowerCased = StringUtil.toLowerCase(presentation); return lowerCased.startsWith(tagName) && (lowerCased.length() == tagName.length() || !Character.isLetter(lowerCased.charAt(tagName.length()))); } }; }
|
getComparator
|
303,911
|
int (Object o1, Object o2) { String s1 = SorterUtil.getStringPresentation(o1); String s2 = SorterUtil.getStringPresentation(o2); if (isTagPresentation(s1, "head") && isTagPresentation(s2, "body")) return -1; if (isTagPresentation(s1, "body") && isTagPresentation(s2, "head")) return 1; return s1.compareToIgnoreCase(s2); }
|
compare
|
303,912
|
boolean (final String presentation, final String tagName) { // "head", "head#id", "head.cls" final String lowerCased = StringUtil.toLowerCase(presentation); return lowerCased.startsWith(tagName) && (lowerCased.length() == tagName.length() || !Character.isLetter(lowerCased.charAt(tagName.length()))); }
|
isTagPresentation
|
303,913
|
boolean () { return true; }
|
isVisible
|
303,914
|
String () { return getName(); }
|
toString
|
303,915
|
ActionPresentation () { return new ActionPresentationData(PlatformEditorBundle.message("action.sort.alphabetically"), PlatformEditorBundle.message("action.sort.alphabetically"), AllIcons.ObjectBrowser.Sorted); }
|
getPresentation
|
303,916
|
String () { return ALPHA_SORTER_ID; }
|
getName
|
303,917
|
void (final @NotNull String place) { myStructureViewPlace = place; }
|
setPlace
|
303,918
|
String () { return myStructureViewPlace; }
|
getPlace
|
303,919
|
StructureViewTreeElement () { return new HtmlFileTreeElement(TreeStructureUtil.isInStructureViewPopup(this), getPsiFile()); }
|
getRoot
|
303,920
|
void (final Section section) { myChildren.add(section); }
|
addChildSection
|
303,921
|
LinkedList<Section> () { return myChildren; }
|
getChildren
|
303,922
|
XmlTag () { return myTag; }
|
getTag
|
303,923
|
void (final Section section) { section.myParent = this; super.addChildSection(section); }
|
addChildSection
|
303,924
|
XmlTag () { return myHeader; }
|
getHeader
|
303,925
|
void (final XmlTag header) { myHeader = header; }
|
setHeader
|
303,926
|
Section () { return myParent; }
|
getParent
|
303,927
|
Collection<Html5SectionTreeElement> (final XmlTag rootTag) { final Html5SectionsProcessor processor = new Html5SectionsProcessor(); processRecursively(rootTag, processor); return processor.getRootSections(); }
|
processAndGetRootSections
|
303,928
|
void (final XmlTag tag, final Html5SectionsProcessor processor) { if (tag.getAttribute("hidden") != null) return; processor.tagEntered(tag); if (!isHeader(tag)) { for (final XmlTag subTag : tag.getSubTags()) { processRecursively(subTag, processor); } } processor.tagExited(tag); }
|
processRecursively
|
303,929
|
void (final XmlTag tag) { if (isSectioningContentElement(tag) || isSectioningRootElement(tag)) { if (myCurrentOutlinee != null) { myStack.push(myCurrentOutlinee); } myCurrentOutlinee = new SectionHolder(tag); myCurrentSection = new Section(tag); myCurrentOutlinee.addChildSection(myCurrentSection); } else if (myCurrentOutlinee == null) { // do nothing } else if (isHeader(tag)) { if (myCurrentSection.getHeader() == null) { myCurrentSection.setHeader(tag); } else if (myCurrentOutlinee.getChildren().getLast().getHeader() == null || compareHeaderRanks(tag, myCurrentOutlinee.getChildren().getLast().getHeader()) >= 0) { myCurrentSection = new Section(tag); myCurrentSection.setHeader(tag); myCurrentOutlinee.addChildSection(myCurrentSection); } else { Section candidateSection = myCurrentSection; do { if (compareHeaderRanks(tag, candidateSection.getHeader()) < 0) { myCurrentSection = new Section(tag); myCurrentSection.setHeader(tag); candidateSection.addChildSection(myCurrentSection); break; } candidateSection = candidateSection.getParent(); } while (true); } //myStack.push(); not needed, because our iterator doesn't enter hidden elements } }
|
tagEntered
|
303,930
|
void (final XmlTag tag) { if (!myStack.isEmpty() && myStack.peek().getTag() == tag) { assert false; } else if (!myStack.isEmpty() && isHeader(tag)) { // do nothing } else if (!myStack.isEmpty() && isSectioningContentElement(tag)) { final SectionHolder exitedSectioningContent = myCurrentOutlinee; assert exitedSectioningContent.getTag() == tag; myCurrentOutlinee = myStack.pop(); myCurrentSection = myCurrentOutlinee.getChildren().getLast(); for (Section section : exitedSectioningContent.getChildren()) { myCurrentSection.addChildSection(section); } } else if (!myStack.isEmpty() && isSectioningRootElement(tag)) { final SectionHolder exitedSectioningRoot = myCurrentOutlinee; assert exitedSectioningRoot.getTag() == tag; myRootSectionHolders.add(exitedSectioningRoot); myCurrentOutlinee = myStack.pop(); myCurrentSection = myCurrentOutlinee.getChildren().getLast(); while (!myCurrentSection.getChildren().isEmpty()) { myCurrentSection = myCurrentSection.getChildren().getLast(); } } else if (isSectioningContentElement(tag) || isSectioningRootElement(tag)) { assert myStack.isEmpty(); assert myCurrentOutlinee.getTag() == tag; myRootSectionHolders.add(myCurrentOutlinee); // reset algorithm myCurrentOutlinee = null; myCurrentSection = null; } }
|
tagExited
|
303,931
|
Collection<Html5SectionTreeElement> () { final Collection<Html5SectionTreeElement> result = new ArrayList<>(); for (SectionHolder sectionHolder : myRootSectionHolders) { for (Section section : sectionHolder.getChildren()) { if ("td".equalsIgnoreCase(section.getTag().getName()) && section.getHeader() == null && section.getChildren().isEmpty()) { continue; } result.add(createHtml5SectionTreeElement(section)); } } return result; }
|
getRootSections
|
303,932
|
Html5SectionTreeElement (final Section section) { return new Html5SectionTreeElement(section.getTag(), createChildrenComputable(section.getChildren()), getHeaderText(section.getHeader())); }
|
createHtml5SectionTreeElement
|
303,933
|
Computable<Collection<StructureViewTreeElement>> (final Collection<Section> children) { return () -> { final Collection<StructureViewTreeElement> result = new ArrayList<>(); for (Section section : children) { result.add(createHtml5SectionTreeElement(section)); } return result; }; }
|
createChildrenComputable
|
303,934
|
String (final @Nullable XmlTag header) { if (header == null) return null; final StringBuilder buf = new StringBuilder(); if (HGROUP_ELEMENT.equalsIgnoreCase(header.getLocalName())) { for (XmlTag subTag : header.getSubTags()) { if (ArrayUtil.contains(StringUtil.toLowerCase(subTag.getLocalName()), HEADER_ELEMENTS)) { if (buf.length() > 0) { buf.append(" "); } appendTextRecursively(subTag, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2); } } } else { appendTextRecursively(header, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2); } return buf.toString(); }
|
getHeaderText
|
303,935
|
void (final XmlTag tag, final StringBuilder buf, final int maximumTextLength) { if (buf.length() >= maximumTextLength) return; final String text = tag.getValue().getTrimmedText(); if (!text.isEmpty()) { buf.append(text); } else { for (XmlTag subTag : tag.getSubTags()) { appendTextRecursively(subTag, buf, maximumTextLength); } } }
|
appendTextRecursively
|
303,936
|
boolean (final XmlTag tag) { return ArrayUtil.contains(StringUtil.toLowerCase(tag.getLocalName()), SECTIONING_ROOT_ELEMENTS); }
|
isSectioningRootElement
|
303,937
|
boolean (final XmlTag tag) { return ArrayUtil.contains(StringUtil.toLowerCase(tag.getLocalName()), SECTIONING_CONTENT_ELEMENTS); }
|
isSectioningContentElement
|
303,938
|
boolean (final XmlTag tag) { return ArrayUtil.contains(StringUtil.toLowerCase(tag.getLocalName()), HEADER_ELEMENTS) || HGROUP_ELEMENT.equalsIgnoreCase(tag.getLocalName()); }
|
isHeader
|
303,939
|
int (final @NotNull XmlTag header1, final @NotNull XmlTag header2) { return getHeaderRank(header2) - getHeaderRank(header1); }
|
compareHeaderRanks
|
303,940
|
int (final XmlTag header) { if (HGROUP_ELEMENT.equalsIgnoreCase(header.getLocalName())) { int minIndex = HEADER_ELEMENTS.length; for (XmlTag subTag : header.getSubTags()) { int index = ArrayUtilRt.indexOf(HEADER_ELEMENTS, StringUtil.toLowerCase(subTag.getLocalName()), 0, HEADER_ELEMENTS.length); if (index < minIndex) { minIndex = index; if (minIndex == 0) break; } } if (minIndex == HEADER_ELEMENTS.length) { // no headers is equivalent to <h1> minIndex = 0; } return minIndex + 1; } int index = ArrayUtilRt.indexOf(HEADER_ELEMENTS, StringUtil.toLowerCase(header.getLocalName()), 0, HEADER_ELEMENTS.length); if (index < 0) throw new IllegalArgumentException(header.getName()); return index + 1; }
|
getHeaderRank
|
303,941
|
Collection<StructureViewTreeElement> () { if (isHtml5SectionsMode()) { return Collections.emptyList(); // Html5SectionsNodeProvider will return its structure } final XmlFile xmlFile = getElement(); final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument(); if (document == null) { return Collections.emptyList(); } final List<XmlTag> rootTags = new SmartList<>(); document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document); if (rootTags.isEmpty()) { return Collections.emptyList(); } else if (rootTags.size() == 1) { final XmlTag rootTag = rootTags.get(0); if ("html".equalsIgnoreCase(rootTag.getLocalName())) { final XmlTag[] subTags = rootTag.getSubTags(); if (subTags.length == 1 && ("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) { return new HtmlTagTreeElement(subTags[0]).getChildrenBase(); } return new HtmlTagTreeElement(rootTag).getChildrenBase(); } return Collections.singletonList(new HtmlTagTreeElement(rootTag)); } else { final Collection<StructureViewTreeElement> result = new ArrayList<>(rootTags.size()); for (XmlTag tag : rootTags) { result.add(new HtmlTagTreeElement(tag)); } return result; } }
|
getChildrenBase
|
303,942
|
boolean () { final XmlFile xmlFile = getElement(); if (xmlFile == null) return false; if (myInStructureViewPopup) { final String propertyName = TreeStructureUtil.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY); if (PropertiesComponent.getInstance().getBoolean(propertyName)) { return true; } } else if (StructureViewFactoryEx.getInstanceEx(xmlFile.getProject()).isActionActive(Html5SectionsNodeProvider.ACTION_ID)) { return true; } return false; }
|
isHtml5SectionsMode
|
303,943
|
String () { return toString(); // root element is not visible }
|
getPresentableText
|
303,944
|
Collection<StructureViewTreeElement> () { final XmlTag tag = getElement(); if (tag == null || !tag.isValid()) return Collections.emptyList(); return ContainerUtil.map(tag.getSubTags(), HtmlTagTreeElement::new); }
|
getChildrenBase
|
303,945
|
String () { final XmlTag tag = getElement(); if (tag == null) { return StructureViewBundle.message("node.structureview.invalid"); } return HtmlUtil.getTagPresentation(tag); }
|
getPresentableText
|
303,946
|
String () { final XmlTag tag = getElement(); if (tag == null) { return null; } if (tag.getName().equalsIgnoreCase("img") || HtmlUtil.isScriptTag(tag)) { return getPathDescription(tag.getAttributeValue("src")); } else if (tag.getName().equalsIgnoreCase("link")) { return getPathDescription(tag.getAttributeValue("href")); } else { return StringUtil.nullize(normalizeSpacesAndShortenIfLong(tag.getValue().getTrimmedText())); } }
|
getLocationString
|
303,947
|
String (String src) { if (StringUtil.isEmpty(src)) { return null; } else { return StringUtil.shortenPathWithEllipsis(src, MAX_TEXT_LENGTH, true); } }
|
getPathDescription
|
303,948
|
boolean () { return true; }
|
isSearchInLocationString
|
303,949
|
String (final @NotNull String text) { StringBuilder builder = normalizeSpaces(text); return builder == null ? null : shortenTextIfLong(builder); }
|
normalizeSpacesAndShortenIfLong
|
303,950
|
StringBuilder (@NotNull String text) { if (text.isEmpty()) { return null; } final StringBuilder buf = new StringBuilder(text.length()); for (int i = 0, length = text.length(); i < length; i++) { char c = text.charAt(i); if (c <= ' ' || Character.isSpaceChar(c)) { if (buf.length() == 0 || buf.charAt(buf.length() - 1) != ' ') { buf.append(' '); } } else { buf.append(c); } } return buf; }
|
normalizeSpaces
|
303,951
|
String (@NotNull StringBuilder text) { if (text.length() <= MAX_TEXT_LENGTH) { return text.toString(); } int index; for (index = MAX_TEXT_LENGTH; index > MAX_TEXT_LENGTH - 20; index--) { if (!Character.isLetter(text.charAt(index))) { break; } } text.setLength(Character.isLetter(index) ? MAX_TEXT_LENGTH : index); return text.append("\u2026").toString(); }
|
shortenTextIfLong
|
303,952
|
String () { return " "; }
|
getLocationPrefix
|
303,953
|
String () { return ""; }
|
getLocationSuffix
|
303,954
|
StructureViewBuilder (@NotNull final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @Override @NotNull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new XmlStructureViewTreeModel((XmlFile)psiFile, editor); } }; }
|
getStructureViewBuilder
|
303,955
|
StructureViewModel (@Nullable Editor editor) { return new XmlStructureViewTreeModel((XmlFile)psiFile, editor); }
|
createStructureViewModel
|
303,956
|
StructureViewBuilder (@NotNull final PsiFile psiFile) { if (!(psiFile instanceof XmlFile)) { return null; } StructureViewBuilder builder = getStructureViewBuilderForExtensions(psiFile); if (builder != null) { return builder; } for (XmlStructureViewBuilderProvider xmlStructureViewBuilderProvider : getStructureViewBuilderProviders()) { final StructureViewBuilder structureViewBuilder = xmlStructureViewBuilderProvider.createStructureViewBuilder((XmlFile)psiFile); if (structureViewBuilder != null) { return structureViewBuilder; } } return new TreeBasedStructureViewBuilder() { @Override @NotNull public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new XmlStructureViewTreeModel((XmlFile)psiFile, editor); } }; }
|
getStructureViewBuilder
|
303,957
|
StructureViewModel (@Nullable Editor editor) { return new XmlStructureViewTreeModel((XmlFile)psiFile, editor); }
|
createStructureViewModel
|
303,958
|
XmlStructureViewBuilderProvider[] () { return (XmlStructureViewBuilderProvider[])Extensions.getRootArea() .getExtensionPoint(XmlStructureViewBuilderProvider.EP_NAME).getExtensions(); }
|
getStructureViewBuilderProviders
|
303,959
|
StructureViewBuilder (@NotNull PsiFile psiFile) { for (Language language : XMLLanguage.INSTANCE.getLanguageExtensionsForFile(psiFile)) { PsiStructureViewFactory factory = LanguageStructureViewBuilder.INSTANCE.forLanguage(language); if (factory == null) continue; final StructureViewBuilder builder = factory.getStructureViewBuilder(psiFile); if (builder != null) { return builder; } } return null; }
|
getStructureViewBuilderForExtensions
|
303,960
|
VcsSelection (@NotNull DataContext context) { final Editor editor = context.getData(CommonDataKeys.EDITOR); if (editor == null) return null; PsiElement psiElement = TargetElementUtil.findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED); if (psiElement == null || !psiElement.isValid()) { return null; } final String actionName; if (psiElement instanceof XmlTag) { actionName = XmlBundle.message("action.name.show.history.for.tag"); } else if (psiElement instanceof XmlText) { actionName = XmlBundle.message("action.name.show.history.for.text"); } else { return null; } TextRange textRange = psiElement.getTextRange(); if (textRange == null) { return null; } VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile(); if (virtualFile == null) { return null; } if (!virtualFile.isValid()) { return null; } Document document = FileDocumentManager.getInstance().getDocument(virtualFile); if (document == null) { return null; } return new VcsSelection(document, textRange, actionName); }
|
getSelection
|
303,961
|
boolean (@NotNull PsiFile psiFile) { for (PsiFile file : psiFile.getViewProvider().getAllFiles()) { Language language = file.getLanguage(); if (language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE)) { return true; } } return false; }
|
isAvailable
|
303,962
|
void (final @NotNull XmlFile xmlFile, final @NotNull Set<? super PsiFile> resultSet) { HtmlLinkUtil.processLinks(xmlFile, tag -> { final XmlAttribute attribute = tag.getAttribute("href"); if (attribute == null) { return true; } final XmlAttributeValue link = attribute.getValueElement(); if (link == null) { return true; } for (PsiReference reference : link.getReferences()) { if (reference instanceof PsiPolyVariantReference) { final ResolveResult[] results = ((PsiPolyVariantReference)reference).multiResolve(false); for (ResolveResult result : results) { final PsiElement resolvedElement = result.getElement(); if (resolvedElement instanceof PsiFile) { resultSet.add((PsiFile)resolvedElement); } } } else { final PsiElement resolvedElement = reference.resolve(); if (resolvedElement instanceof PsiFile) { resultSet.add((PsiFile)resolvedElement); } } } return true; }); }
|
fillRelatedFiles
|
303,963
|
String () { return XmlBundle.message("html.related.linked.files.group"); }
|
getGroupName
|
303,964
|
void (final @NotNull List<? extends PsiElement> elements, final @NotNull Collection<? super LineMarkerInfo<?>> result) { Map<LineMarkerProvider, List<PsiElement>> embeddedLineMarkersWorkItems = null; for(PsiElement element:elements) { if(element instanceof PsiWhiteSpace) continue; final Language language = element.getLanguage(); if (!(language instanceof XMLLanguage)) { List<LineMarkerProvider> lineMarkerProviders = LineMarkerProviders.getInstance().allForLanguage(language); for (LineMarkerProvider provider : lineMarkerProviders) { if (provider instanceof HtmlLineMarkerProvider) continue; if (embeddedLineMarkersWorkItems == null) { embeddedLineMarkersWorkItems = new HashMap<>(); } embeddedLineMarkersWorkItems.computeIfAbsent(provider, k -> new ArrayList<>(5)).add(element); } } } if (embeddedLineMarkersWorkItems != null) { for(Map.Entry<LineMarkerProvider, List<PsiElement>> entry:embeddedLineMarkersWorkItems.entrySet()) { entry.getKey().collectSlowLineMarkers(entry.getValue(), result); } } }
|
collectSlowLineMarkers
|
303,965
|
KeyDescriptor<String> () { return EnumeratorStringDescriptor.INSTANCE; }
|
getKeyDescriptor
|
303,966
|
boolean (final @NotNull VirtualFile file) { return file.isInLocalFileSystem(); }
|
acceptInput
|
303,967
|
boolean () { return true; }
|
dependsOnFileContent
|
303,968
|
int () { return 1; }
|
getVersion
|
303,969
|
XmlAttributeDescriptor[] (XmlTag tag) { if (tag == null || !HtmlUtil.isHtml5Context(tag)) { return XmlAttributeDescriptor.EMPTY; } final List<String> currentAttrs = new ArrayList<>(); for (XmlAttribute attribute : tag.getAttributes()) { currentAttrs.add(attribute.getName()); } final Project project = tag.getProject(); final Collection<String> keys = CachedValuesManager.getManager(project).getCachedValue(project, () -> { final Collection<String> keys1 = FileBasedIndex.getInstance().getAllKeys(Html5CustomAttributesIndex.INDEX_ID, project); final GlobalSearchScope scope = GlobalSearchScope.allScope(project); return CachedValueProvider.Result.<Collection<String>>create(ContainerUtil.filter(keys1, key -> !FileBasedIndex.getInstance().processValues( Html5CustomAttributesIndex.INDEX_ID, key, null, (file, value) -> false, scope)), PsiModificationTracker.MODIFICATION_COUNT); }); if (keys.isEmpty()) return XmlAttributeDescriptor.EMPTY; boolean inCompletion = tag.getContainingFile().getVirtualFile() == null; final List<XmlAttributeDescriptor> result = new ArrayList<>(); for (String key : keys) { boolean add = true; if (inCompletion) { for (String attr : currentAttrs) { if (attr.equals(key + CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) { add = false; break; } } } if (add) result.add(new AnyXmlAttributeDescriptor(key)); } return result.toArray(XmlAttributeDescriptor.EMPTY); }
|
getAttributeDescriptors
|
303,970
|
XmlAttributeDescriptor (String attributeName, XmlTag context) { if (context != null && HtmlUtil.isCustomHtml5Attribute(attributeName) && (HtmlUtil.isHtml5Context(context) || HtmlUtil.tagHasHtml5Schema(context))) { return new AnyXmlAttributeDescriptor(attributeName); } return null; }
|
getAttributeDescriptor
|
303,971
|
FeatureDescriptor[] () { return new FeatureDescriptor[]{new FeatureDescriptor(XmlCompletionContributor.TAG_NAME_COMPLETION_FEATURE, "completion", "TagNameCompletion", XmlBundle.message("tag.name.completion.display.name"), 0, 1, Collections.emptySet(), 3, this)}; }
|
getFeatureDescriptors
|
303,972
|
Tokenizer (PsiElement element) { if (element instanceof XmlText) { return myXmlTextTokenizer; } if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS && !isXmlDataCharactersParentHandledByItsStrategy(element.getParent())) { // Special case for all other XML_DATA_CHARACTERS, which are not handled through parent PSI if (isInTemplateLanguageFile(element)) return EMPTY_TOKENIZER; return TEXT_TOKENIZER; } if (element instanceof XmlAttributeValue) { return myXmlAttributeTokenizer; } return super.getTokenizer(element); }
|
getTokenizer
|
303,973
|
boolean (@NotNull PsiElement element, @NotNull String name) { DomElement domElement = DomUtil.getDomElement(element); if (domElement != null) { if (domElement.getAnnotation(NoSpellchecking.class) != null) { return true; } } return false; }
|
isSuppressedFor
|
303,974
|
SuppressQuickFix[] (@NotNull PsiElement element, @NotNull String name) { return SuppressQuickFix.EMPTY_ARRAY; }
|
getSuppressActions
|
303,975
|
boolean (@Nullable PsiElement parent) { if (parent == null) return false; var strategy = ContainerUtil.findInstance( LanguageSpellchecking.INSTANCE.allForLanguage(parent.getLanguage()), XmlSpellcheckingStrategy.class); return strategy != null ? strategy.isXmlDataCharactersParentHandled(parent) : isXmlDataCharactersParentHandled(parent); }
|
isXmlDataCharactersParentHandledByItsStrategy
|
303,976
|
boolean (@NotNull PsiElement parent) { return parent instanceof XmlText || parent.getNode().getElementType() == XmlElementType.XML_CDATA; }
|
isXmlDataCharactersParentHandled
|
303,977
|
boolean (PsiElement element) { PsiFile file = element.getContainingFile(); return file == null || file.getLanguage() instanceof TemplateLanguage; }
|
isInTemplateLanguageFile
|
303,978
|
void (@NotNull PsiElement element) { if (element.getNode().getElementType() == XmlElementType.XML_CDATA) { element.acceptChildren(this); } else if (!(element instanceof LeafPsiElement) || !isContentToken(element.getNode().getElementType())) { result.add(element.getTextRangeInParent()); } }
|
visitElement
|
303,979
|
boolean (IElementType tokenType) { return tokenType == XmlTokenType.XML_DATA_CHARACTERS || tokenType == XmlTokenType.XML_CDATA_START || tokenType == XmlTokenType.XML_CDATA_END || XmlTokenType.WHITESPACES.contains(tokenType); }
|
isContentToken
|
303,980
|
boolean (IElementType tokenType) { return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER || XmlTokenType.WHITESPACES.contains(tokenType); }
|
isContentToken
|
303,981
|
void (@NotNull XmlAttributeValue element, @NotNull TokenConsumer consumer) { PsiReference[] references = element.getReferences(); for (PsiReference reference : references) { if (reference instanceof XmlEnumeratedValueReference) { if (reference.resolve() != null) { // this is probably valid enumeration value from XSD/RNG schema, such as SVG return; } } } final String valueTextTrimmed = element.getValue().trim(); // do not inspect colors like #00aaFF if (valueTextTrimmed.startsWith("#") && valueTextTrimmed.length() <= 9 && isHexString(valueTextTrimmed.substring(1))) { return; } super.tokenize(element, consumer); }
|
tokenize
|
303,982
|
boolean (final String s) { for (int i = 0; i < s.length(); i++) { if (!StringUtil.isHexDigit(s.charAt(i))) { return false; } } return true; }
|
isHexString
|
303,983
|
Tokenizer (PsiElement element) { if (element instanceof HtmlDocumentImpl) { return myDocumentTextTokenizer; } if (element instanceof XmlAttributeValue) { if (URLUtil.isDataUri(ElementManipulators.getValueText(element))) { return EMPTY_TOKENIZER; } PsiElement parent = element.getParent(); if (parent instanceof XmlAttribute) { if (HtmlCompletionContributor.hasHtmlAttributesCompletion(element) && HtmlCompletionContributor.addSpecificCompletions((XmlAttribute)parent).length > 0) { return EMPTY_TOKENIZER; } XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor(); if (descriptor != null && (descriptor.isEnumerated() || descriptor.isFixed())) { return EMPTY_TOKENIZER; } } } return super.getTokenizer(element); }
|
getTokenizer
|
303,984
|
boolean (@NotNull PsiElement parent) { return super.isXmlDataCharactersParentHandled(parent) || parent instanceof HtmlDocumentImpl; }
|
isXmlDataCharactersParentHandled
|
303,985
|
void (@NotNull XmlToken token) { if (token.getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) { var text = token.getText(); result.add(new SpellcheckRange(text, false, token.getStartOffsetInParent(), TextRange.allOf(text))); } }
|
visitXmlToken
|
303,986
|
void (@NotNull PsiElement element) { if (!isContentElement(element)) { result.add(element.getTextRangeInParent()); } }
|
visitElement
|
303,987
|
boolean (@NotNull PsiElement element) { var tokenType = element.getNode().getElementType(); if (tokenType == XmlTokenType.XML_DATA_CHARACTERS || XmlTokenType.WHITESPACES.contains(tokenType)) { return true; } if (tokenType == XmlTokenType.XML_ENTITY_REF_TOKEN || tokenType == XmlTokenType.XML_CHAR_ENTITY_REF) { return false; } return element instanceof XmlTag || element instanceof XmlComment || element instanceof XmlProlog || element instanceof XmlProcessingInstruction; }
|
isContentElement
|
303,988
|
String () { return "XmlTokenizerBase(splitter=" + mySplitter + ")"; }
|
toString
|
303,989
|
void (@NotNull T element, @NotNull TokenConsumer consumer) { List<TextRange> excludeRanges = getSpellcheckOuterContentRanges(element); for (var spellcheckRange : getSpellcheckRanges(element)) { consumer.consumeToken( element, spellcheckRange.text, spellcheckRange.useRename, spellcheckRange.offset, spellcheckRange.rangeToCheck, createExclusionAwareSplitter(excludeRanges, spellcheckRange.offset) ); } }
|
tokenize
|
303,990
|
Splitter (List<TextRange> excludeRanges, int offset) { return new Splitter() { @Override public void split(@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { mySplitter.split(text, range, tokenRange -> { if (ContainerUtil.all(excludeRanges, excludeRange -> !excludeRange.intersects(tokenRange.shiftRight(offset)))) { consumer.consume(tokenRange); } }); } }; }
|
createExclusionAwareSplitter
|
303,991
|
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { mySplitter.split(text, range, tokenRange -> { if (ContainerUtil.all(excludeRanges, excludeRange -> !excludeRange.intersects(tokenRange.shiftRight(offset)))) { consumer.consume(tokenRange); } }); }
|
split
|
303,992
|
boolean (char ch) { return Character.isLetterOrDigit(ch) || Character.isWhitespace(ch); }
|
isLetterDigitOrWhitespace
|
303,993
|
record (String text, boolean useRename, int offset, TextRange rangeToCheck) { SpellcheckRange(String text) { this(text, false); } SpellcheckRange(String text, boolean useRename) { this(text, useRename, 0, TextRange.allOf(text)); } }
|
SpellcheckRange
|
303,994
|
String () { return DEFAULT_HTML_TEMPLATE_PROPERTY; }
|
getDefaultTemplateProperty
|
303,995
|
void (@NotNull Project project, @NotNull PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) { builder .setTitle(XmlBundle.message("html.action.new.file.dialog.title")) .addKind(XmlBundle.message("html.action.new.file.item.html5.file"), HtmlFileType.INSTANCE.getIcon(), FileTemplateManager.INTERNAL_HTML5_TEMPLATE_NAME); }
|
buildDialog
|
303,996
|
String (PsiDirectory directory, @NotNull String newName, String templateName) { return XmlBundle.message("html.action.new.file.name"); }
|
getActionName
|
303,997
|
FormattingModel (@NotNull FormattingContext formattingContext) { final PsiFile psiFile = formattingContext.getContainingFile(); final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile); return new XmlFormattingModel( psiFile, new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile), null, null, new HtmlPolicy(formattingContext.getCodeStyleSettings(), documentModel), null, null, false), documentModel); }
|
createModel
|
303,998
|
TextRange (@NotNull ASTNode node, @NotNull TextRange range) { PsiElement psiElement = node.getPsi(); if (psiElement != null && psiElement.isValid() && psiElement.getLanguage().isKindOf(HTMLLanguage.INSTANCE)) { PsiFile file = psiElement.getContainingFile(); PsiElement fileContext = file.getContext(); String contextQuote = fileContext != null ? Character.toString(fileContext.getText().charAt(0)) : null; CodeStyleSettings rootSettings = CodeStyle.getSettings(file); HtmlCodeStyleSettings htmlSettings = rootSettings.getCustomSettings(HtmlCodeStyleSettings.class); CodeStyleSettings.QuoteStyle quoteStyle = htmlSettings.HTML_QUOTE_STYLE; if (quoteStyle != CodeStyleSettings.QuoteStyle.None && htmlSettings.HTML_ENFORCE_QUOTES && !StringUtil.equals(quoteStyle.quote, contextQuote)) { PostFormatProcessorHelper postFormatProcessorHelper = new PostFormatProcessorHelper(rootSettings.getCommonSettings(HTMLLanguage.INSTANCE)); postFormatProcessorHelper.setResultTextRange(range); HtmlQuotesConverter converter = new HtmlQuotesConverter(quoteStyle, psiElement, postFormatProcessorHelper); Document document = converter.getDocument(); if (document != null) { DocumentUtil.executeInBulk(document, converter); } return postFormatProcessorHelper.getResultTextRange(); } } return range; }
|
process
|
303,999
|
Document () { return myDocument; }
|
getDocument
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.