Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
301,400
|
String (String toAppend, String text) { if (!toAppend.isEmpty()) { toAppend += "," + text; } else { toAppend = text; } return toAppend; }
|
appendName
|
301,401
|
String () { return REQUIRED_ATTRIBUTES_SHORT_NAME; }
|
getShortName
|
301,402
|
String () { return myAdditionalRequiredHtmlAttributes; }
|
getAdditionalEntries
|
301,403
|
void (String text) { myAdditionalRequiredHtmlAttributes = appendName(getAdditionalEntries(), text); }
|
addEntry
|
301,404
|
LocalQuickFix (String name) { return new AddHtmlTagOrAttributeToCustomsIntention(SHORT_NAME_KEY, name, XmlAnalysisBundle.message( "html.quickfix.add.optional.html.attribute", name)); }
|
getIntentionAction
|
301,405
|
void (@NotNull XmlTag tag, @NotNull ProblemsHolder holder, boolean isOnTheFly) { String name = tag.getName(); XmlElementDescriptor elementDescriptor = XmlUtil.getDescriptorFromContext(tag); if (elementDescriptor instanceof AnyXmlElementDescriptor || elementDescriptor == null) { elementDescriptor = tag.getDescriptor(); } if (elementDescriptor == null) return; if ((elementDescriptor instanceof XmlHighlightingAwareElementDescriptor) && !((XmlHighlightingAwareElementDescriptor)elementDescriptor).shouldCheckRequiredAttributes()) { return; } XmlAttributeDescriptor[] attributeDescriptors = elementDescriptor.getAttributesDescriptors(tag); Set<String> requiredAttributes = null; for (XmlAttributeDescriptor attribute : attributeDescriptors) { if (attribute != null && attribute.isRequired()) { if (requiredAttributes == null) { requiredAttributes = new HashSet<>(); } requiredAttributes.add(attribute.getName(tag)); } } if (requiredAttributes != null) { for (final String attrName : requiredAttributes) { if (!hasAttribute(tag, attrName) && !XmlExtension.getExtension(tag.getContainingFile()).isRequiredAttributeImplicitlyPresent(tag, attrName)) { LocalQuickFix insertRequiredAttributeIntention = isOnTheFly ? XmlQuickFixFactory.getInstance().insertRequiredAttributeFix(tag, attrName) : null; final String localizedMessage = XmlAnalysisBundle.message("xml.inspections.element.doesnt.have.required.attribute", name, attrName); reportOneTagProblem( tag, attrName, localizedMessage, insertRequiredAttributeIntention, holder, getIntentionAction(attrName), isOnTheFly ); } } } }
|
checkTag
|
301,406
|
boolean (XmlTag tag, String attrName) { if (JBIterable.from(HtmlAttributeValueProvider.EP_NAME.getExtensionList()) .filterMap(it -> it.getCustomAttributeValue(tag, attrName)).first() != null) { return true; } final XmlAttribute attribute = tag.getAttribute(attrName); if (attribute == null) return false; if (attribute.getValueElement() != null) return true; if (!(tag instanceof HtmlTag)) return false; final XmlAttributeDescriptor descriptor = attribute.getDescriptor(); return descriptor != null && HtmlUtil.isBooleanAttribute(descriptor, tag); }
|
hasAttribute
|
301,407
|
void (final XmlTag tag, final String name, @NotNull @InspectionMessage String localizedMessage, final LocalQuickFix basicIntention, ProblemsHolder holder, @NotNull LocalQuickFix addAttributeFix, boolean isOnTheFly) { boolean htmlTag = false; if (tag instanceof HtmlTag) { htmlTag = true; if (isAdditionallyDeclared(getAdditionalEntries(), name)) return; } LocalQuickFix[] fixes; ProblemHighlightType highlightType; if (htmlTag) { fixes = basicIntention == null ? new LocalQuickFix[]{addAttributeFix} : new LocalQuickFix[]{addAttributeFix, basicIntention}; highlightType = isInjectedWithoutValidation(tag) ? ProblemHighlightType.INFORMATION : ProblemHighlightType.GENERIC_ERROR_OR_WARNING; } else { fixes = basicIntention == null ? LocalQuickFix.EMPTY_ARRAY : new LocalQuickFix[]{basicIntention}; highlightType = ProblemHighlightType.ERROR; } if (isOnTheFly || highlightType != ProblemHighlightType.INFORMATION) { addElementsForTag(tag, localizedMessage, highlightType, holder, isOnTheFly, fixes); } }
|
reportOneTagProblem
|
301,408
|
void (XmlTag tag, @InspectionMessage String message, ProblemHighlightType error, ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalQuickFix @NotNull ... fixes) { registerProblem(message, error, holder, XmlTagUtil.getStartTagNameElement(tag), fixes); if (isOnTheFly) { registerProblem(message, error, holder, XmlTagUtil.getEndTagNameElement(tag), fixes); } }
|
addElementsForTag
|
301,409
|
void (@InspectionMessage String message, ProblemHighlightType error, ProblemsHolder holder, XmlToken start, LocalQuickFix[] fixes) { if (start != null) { holder.registerProblem(start, message, error, fixes); } }
|
registerProblem
|
301,410
|
boolean (final String additional, String name) { name = StringUtil.toLowerCase(name); if (!additional.contains(name)) return false; StringTokenizer tokenizer = new StringTokenizer(additional, ", "); while (tokenizer.hasMoreTokens()) { if (name.equals(tokenizer.nextToken())) { return true; } } return false; }
|
isAdditionallyDeclared
|
301,411
|
WebEditorOptions () { return ApplicationManager.getApplication().getService(WebEditorOptions.class); }
|
getInstance
|
301,412
|
boolean () { return myShowCssInlineColorPreview; }
|
isShowCssInlineColorPreview
|
301,413
|
void (final boolean showCssInlineColorPreview) { myShowCssInlineColorPreview = showCssInlineColorPreview; }
|
setShowCssInlineColorPreview
|
301,414
|
boolean () { return myShowCssColorPreviewInGutter; }
|
isShowCssColorPreviewInGutter
|
301,415
|
boolean () { return myAutomaticallyInsertClosingTag; }
|
isAutomaticallyInsertClosingTag
|
301,416
|
void (final boolean automaticallyInsertClosingTag) { myAutomaticallyInsertClosingTag = automaticallyInsertClosingTag; }
|
setAutomaticallyInsertClosingTag
|
301,417
|
boolean () { return myAutomaticallyInsertRequiredAttributes; }
|
isAutomaticallyInsertRequiredAttributes
|
301,418
|
void (final boolean automaticallyInsertRequiredAttributes) { myAutomaticallyInsertRequiredAttributes = automaticallyInsertRequiredAttributes; }
|
setAutomaticallyInsertRequiredAttributes
|
301,419
|
boolean () { return myAutomaticallyStartAttribute; }
|
isAutomaticallyStartAttribute
|
301,420
|
void (final boolean automaticallyStartAttribute) { myAutomaticallyStartAttribute = automaticallyStartAttribute; }
|
setAutomaticallyStartAttribute
|
301,421
|
boolean () { return myAutomaticallyInsertRequiredSubTags; }
|
isAutomaticallyInsertRequiredSubTags
|
301,422
|
void (boolean automaticallyInsertRequiredSubTags) { myAutomaticallyInsertRequiredSubTags = automaticallyInsertRequiredSubTags; }
|
setAutomaticallyInsertRequiredSubTags
|
301,423
|
int () { return myTagTreeHighlightingLevelCount; }
|
getTagTreeHighlightingLevelCount
|
301,424
|
void (int tagTreeHighlightingLevelCount) { myTagTreeHighlightingLevelCount = tagTreeHighlightingLevelCount; }
|
setTagTreeHighlightingLevelCount
|
301,425
|
int () { return myTagTreeHighlightingOpacity; }
|
getTagTreeHighlightingOpacity
|
301,426
|
void (int tagTreeHighlightingOpacity) { myTagTreeHighlightingOpacity = tagTreeHighlightingOpacity; }
|
setTagTreeHighlightingOpacity
|
301,427
|
boolean () { return myTagTreeHighlightingEnabled; }
|
isTagTreeHighlightingEnabled
|
301,428
|
void (boolean tagTreeHighlightingEnabled) { myTagTreeHighlightingEnabled = tagTreeHighlightingEnabled; }
|
setTagTreeHighlightingEnabled
|
301,429
|
WebEditorOptions () { return this; }
|
getState
|
301,430
|
void (final @NotNull WebEditorOptions state) { XmlSerializerUtil.copyBean(state, this); }
|
loadState
|
301,431
|
boolean () { return mySelectWholeCssIdentifierOnDoubleClick; }
|
isSelectWholeCssIdentifierOnDoubleClick
|
301,432
|
void (boolean selectWholeCssIdentifiersOnDoubleClick) { mySelectWholeCssIdentifierOnDoubleClick = selectWholeCssIdentifiersOnDoubleClick; }
|
setSelectWholeCssIdentifierOnDoubleClick
|
301,433
|
boolean () { return myInsertQuotesForAttributeValue; }
|
isInsertQuotesForAttributeValue
|
301,434
|
void (boolean insertQuotesForAttributeValue) { myInsertQuotesForAttributeValue = insertQuotesForAttributeValue; }
|
setInsertQuotesForAttributeValue
|
301,435
|
boolean () { return myAutoCloseTag; }
|
isAutoCloseTag
|
301,436
|
void (boolean autoCloseTag) { myAutoCloseTag = autoCloseTag; }
|
setAutoCloseTag
|
301,437
|
boolean () { return mySyncTagEditing; }
|
isSyncTagEditing
|
301,438
|
void (boolean syncTagEditing) { mySyncTagEditing = syncTagEditing; }
|
setSyncTagEditing
|
301,439
|
boolean (@NotNull final PsiErrorElement element) { final PsiFile containingFile = element.getContainingFile(); if (containingFile.getLanguage() == HTMLLanguage.INSTANCE && containingFile.getContext() != null) { return false; } return true; }
|
shouldHighlightErrorElement
|
301,440
|
boolean (@NotNull final PsiErrorElement element) { final PsiFile psiFile = element.getContainingFile(); if (psiFile == null || psiFile.getViewProvider().getBaseLanguage() != HTMLLanguage.INSTANCE && HTMLLanguage.INSTANCE != element.getLanguage()) return true; return !skip(element); }
|
shouldHighlightErrorElement
|
301,441
|
boolean (@NotNull PsiErrorElement element) { final PsiElement[] children = element.getChildren(); if (children.length > 0) { if (children[0] instanceof XmlToken && XmlTokenType.XML_END_TAG_START == ((XmlToken)children[0]).getTokenType()) { if (XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing").equals(element.getErrorDescription())) { return true; } } } return false; }
|
skip
|
301,442
|
boolean (PsiElement[] elements) { final Set<String> names = new HashSet<>(); for (PsiElement element : elements) { if (element instanceof XmlTag) { final String name = ((XmlTag)element).getName(); if (!names.add(name)) { return true; } } } return false; }
|
containsTagsWithSameName
|
301,443
|
boolean (PsiFile file) { if (ApplicationManager.getApplication().isUnitTestMode()) { return false; } if (!hasXmlViewProvider(file) && !HtmlUtil.supportsXmlTypedHandlers(file)) { return false; } if (!WebEditorOptions.getInstance().isTagTreeHighlightingEnabled()) { return false; } return true; }
|
isTagTreeHighlightingActive
|
301,444
|
boolean (@NotNull PsiFile file) { for (PsiFile f : file.getViewProvider().getAllFiles()) { if (f instanceof XmlFile) { return true; } } return false; }
|
hasXmlViewProvider
|
301,445
|
Color[] () { final ColorKey[] colorKeys = XmlTagTreeHighlightingColors.getColorKeys(); final Color[] colors = new Color[colorKeys.length]; final EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme(); for (int i = 0; i < colors.length; i++) { colors[i] = colorsScheme.getColor(colorKeys[i]); } return colors; }
|
getBaseColors
|
301,446
|
PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttributeValue(@NotNull XmlAttributeValue value) { PsiElement parent = value.getParent(); if (!(parent instanceof XmlAttribute)) { return; } if (parent.getParent() instanceof HtmlTag || HtmlUtil.isHtmlFile(parent.getParent())) return; XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor(); if (descriptor == null || descriptor.isRequired()) { return; } String defaultValue = descriptor.getDefaultValue(); if (defaultValue != null && defaultValue.equals(value.getValue()) && !value.getTextRange().isEmpty()) { holder.registerProblem(value, XmlAnalysisBundle.message("xml.inspections.redundant.default.attribute.value.assignment"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveAttributeIntentionFix(((XmlAttribute)parent).getLocalName())); } } }; }
|
buildVisitor
|
301,447
|
void (@NotNull XmlAttributeValue value) { PsiElement parent = value.getParent(); if (!(parent instanceof XmlAttribute)) { return; } if (parent.getParent() instanceof HtmlTag || HtmlUtil.isHtmlFile(parent.getParent())) return; XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor(); if (descriptor == null || descriptor.isRequired()) { return; } String defaultValue = descriptor.getDefaultValue(); if (defaultValue != null && defaultValue.equals(value.getValue()) && !value.getTextRange().isEmpty()) { holder.registerProblem(value, XmlAnalysisBundle.message("xml.inspections.redundant.default.attribute.value.assignment"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveAttributeIntentionFix(((XmlAttribute)parent).getLocalName())); } }
|
visitXmlAttributeValue
|
301,448
|
String () { return XmlAnalysisBundle.message("xml.quickfix.remove.attribute.text", myLocalName); }
|
getName
|
301,449
|
String () { return myLocalName != null ? getName() : getFamilyName(); }
|
getText
|
301,450
|
String () { return XmlAnalysisBundle.message("xml.quickfix.remove.attribute.family"); }
|
getFamilyName
|
301,451
|
boolean (@NotNull Project project, Editor editor, @NotNull PsiElement element) { return getAttribute(element, editor) != null; }
|
isAvailable
|
301,452
|
void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { PsiElement e = descriptor.getPsiElement(); removeAttribute(e, null); }
|
applyFix
|
301,453
|
void (PsiElement e, Editor editor) { final XmlAttribute myAttribute = PsiTreeUtil.getParentOfType(e, XmlAttribute.class, false); if (myAttribute == null) return; PsiElement next = findNextAttribute(myAttribute); myAttribute.delete(); if (next != null && editor != null) { editor.getCaretModel().moveToOffset(next.getTextRange().getStartOffset()); } }
|
removeAttribute
|
301,454
|
PsiElement (final XmlAttribute attribute) { PsiElement nextSibling = attribute.getNextSibling(); while (nextSibling != null) { if (nextSibling instanceof XmlAttribute) return nextSibling; nextSibling = nextSibling.getNextSibling(); } return null; }
|
findNextAttribute
|
301,455
|
XmlAttribute (PsiElement element, Editor editor) { var result = PsiTreeUtil.getParentOfType(element, XmlAttribute.class); if (result != null) return result; if (element.getTextRange().getStartOffset() == editor.getCaretModel().getOffset()) { return PsiTreeUtil.getParentOfType(PsiTreeUtil.prevLeaf(element), XmlAttribute.class); } return null; }
|
getAttribute
|
301,456
|
void (@NotNull final PsiErrorElement element, @NotNull final HighlightInfo.Builder highlightInfo) { if (PsiTreeUtil.getParentOfType(element, XmlTag.class) == null) { return; } final String text = element.getErrorDescription(); if (text.equals(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference"))) { final int textOffset = element.getTextOffset(); highlightInfo.registerFix(new IntentionAction() { @Override @NotNull public String getText() { return XmlAnalysisBundle.message("xml.quickfix.escape.ampersand"); } @Override @NotNull public String getFamilyName() { return getText(); } @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { return true; } @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) { PsiFile topLevelFile = InjectedLanguageManager.getInstance(project).getTopLevelFile(file); Document document = topLevelFile.getViewProvider().getDocument(); assert document != null; document.replaceString(textOffset, textOffset + 1, AMP_ENTITY); } @Override public boolean startInWriteAction() { return true; } }, null, null, null, null); } }
|
registerErrorQuickFix
|
301,457
|
String () { return XmlAnalysisBundle.message("xml.quickfix.escape.ampersand"); }
|
getText
|
301,458
|
String () { return getText(); }
|
getFamilyName
|
301,459
|
boolean (@NotNull Project project, Editor editor, PsiFile file) { return true; }
|
isAvailable
|
301,460
|
void (@NotNull Project project, Editor editor, PsiFile file) { PsiFile topLevelFile = InjectedLanguageManager.getInstance(project).getTopLevelFile(file); Document document = topLevelFile.getViewProvider().getDocument(); assert document != null; document.replaceString(textOffset, textOffset + 1, AMP_ENTITY); }
|
invoke
|
301,461
|
boolean () { return true; }
|
startInWriteAction
|
301,462
|
String () { return XmlAnalysisBundle.message("xml.quickfix.change.attribute.value", myNewAttributeValue); }
|
getName
|
301,463
|
String () { return myNewAttributeValue != null ? getName() : getFamilyName(); }
|
getText
|
301,464
|
String () { return XmlAnalysisBundle.message("xml.quickfix.change.attribute.value.family"); }
|
getFamilyName
|
301,465
|
boolean (@NotNull Project project, Editor editor, @NotNull PsiElement element) { return getAttribute(element, editor) != null; }
|
isAvailable
|
301,466
|
void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { PsiElement e = descriptor.getPsiElement(); changeAttributeValue(e, null); }
|
applyFix
|
301,467
|
void (PsiElement e, Editor editor) { final XmlAttribute attr = PsiTreeUtil.getParentOfType(e, XmlAttribute.class, false); if (attr == null) return; attr.setValue(myNewAttributeValue); XmlAttributeValue valueElement = attr.getValueElement(); if (editor != null && valueElement != null) { editor.getCaretModel().moveToOffset(valueElement.getValueTextRange().getStartOffset()); } }
|
changeAttributeValue
|
301,468
|
void (Priority value) { myPriority = value; }
|
setPriority
|
301,469
|
Priority () { return myPriority; }
|
getPriority
|
301,470
|
XmlAttribute (@NotNull PsiElement element, Editor editor) { var result = PsiTreeUtil.getParentOfType(element, XmlAttribute.class); if (result != null) return result; if (element.getTextRange().getStartOffset() == editor.getCaretModel().getOffset()) { return PsiTreeUtil.getParentOfType(PsiTreeUtil.prevLeaf(element), XmlAttribute.class); } return null; }
|
getAttribute
|
301,471
|
void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (element instanceof XmlTag tag) { String namespace = tag.getNamespace(); for (XmlNSColorProvider provider : XmlNSColorProvider.EP_NAME.getExtensionList()) { TextAttributesKey key = provider.getKeyForNamespace(namespace, tag); if (key != null) { TextRange range = XmlTagUtil.getStartTagRange(tag); if (range != null) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(range).textAttributes(key).create(); } TextRange endTagRange = XmlTagUtil.getEndTagRange(tag); if (endTagRange != null) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(endTagRange).textAttributes(key).create(); } return; } } } }
|
annotate
|
301,472
|
String () { return "HtmlUnknownAnchorTarget"; }
|
getShortName
|
301,473
|
boolean () { return true; }
|
isForHtml
|
301,474
|
boolean (PsiReference reference) { return reference instanceof AnchorReference && HtmlUnknownTargetInspection.notRemoteBase(reference); }
|
needToCheckRef
|
301,475
|
Collection<PsiFileSystemItem> (@NotNull Project project, @NotNull VirtualFile vFile) { final PsiFile file = PsiManager.getInstance(project).findFile(vFile); final Module module = file != null ? ModuleUtilCore.findModuleForPsiElement(file) : null; if (module == null || !(file instanceof XmlFile)) return Collections.emptyList(); final String basePath = HtmlUtil.getHrefBase((XmlFile)file); if (basePath != null && !HtmlUtil.hasHtmlPrefix(basePath)) { for (VirtualFile virtualFile : getBaseRoots(module)) { final VirtualFile base = virtualFile.findFileByRelativePath(basePath); final PsiDirectory result = base != null ? PsiManager.getInstance(project).findDirectory(base) : null; if (result != null) { return Collections.singletonList(result); } } } return Collections.emptyList(); }
|
getContexts
|
301,476
|
Collection<VirtualFile> (final Module module) { return Arrays.asList(ModuleRootManager.getInstance(module).getContentRoots()); }
|
getBaseRoots
|
301,477
|
boolean (@NotNull Project project, @NotNull VirtualFile file) { if (!ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) return false; final FileType fileType = file.getFileType(); return fileType == HtmlFileType.INSTANCE || fileType == XHtmlFileType.INSTANCE; }
|
isMine
|
301,478
|
void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (PsiUtilCore.getElementType(element) != XmlTokenType.XML_NAME) return; PsiElement parent = element.getParent(); if (!(parent instanceof XmlTag) && !(parent instanceof XmlAttribute)) return; TextRange elementRange = element.getTextRange(); List<SchemaPrefixReference> references = ContainerUtil.findAll(parent.getReferences(), SchemaPrefixReference.class); for (SchemaPrefixReference ref : references) { TextRange rangeInElement = ref.getRangeInElement(); if (rangeInElement.isEmpty()) continue; TextRange range = rangeInElement.shiftRight(ref.getElement().getTextRange().getStartOffset()); if (!range.intersects(elementRange)) continue; holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(range).textAttributes(XmlHighlighterColors.XML_NS_PREFIX).create(); } }
|
annotate
|
301,479
|
PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttributeValue(@NotNull XmlAttributeValue value) { checkRefs(value, holder); } @Override public void visitXmlDoctype(@NotNull XmlDoctype xmlDoctype) { checkRefs(xmlDoctype, holder); } @Override public void visitXmlTag(@NotNull XmlTag tag) { checkRefs(tag, holder); } }; }
|
buildVisitor
|
301,480
|
void (@NotNull XmlAttributeValue value) { checkRefs(value, holder); }
|
visitXmlAttributeValue
|
301,481
|
void (@NotNull XmlDoctype xmlDoctype) { checkRefs(xmlDoctype, holder); }
|
visitXmlDoctype
|
301,482
|
void (@NotNull XmlTag tag) { checkRefs(tag, holder); }
|
visitXmlTag
|
301,483
|
void (@NotNull XmlElement element, @NotNull ProblemsHolder holder) { PsiReference[] references = element.getReferences(); if (references.length == 0) { return; } if (XmlHighlightVisitor.isInjectedWithoutValidation(element)) { return; } boolean isHtml = HtmlUtil.isHtmlTagContainingFile(element); if (isHtml ^ isForHtml()) { return; } if (!isHtml && XmlHighlightVisitor.skipValidation(element)) { return; } Collection<PsiReference> unresolved = getUnresolvedReferencesToAnnotate(references); for (PsiReference reference : unresolved) { holder.registerProblem(reference, ProblemsHolder.unresolvedReferenceMessage(reference), isHtml ? ProblemHighlightType.GENERIC_ERROR_OR_WARNING : ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } }
|
checkRefs
|
301,484
|
Collection<PsiReference> (PsiReference[] references) { Map<TextRange, PsiReference> unresolvedReferences = new HashMap<>(); for (PsiReference reference : references) { if (!XmlHighlightVisitor.isUrlReference(reference) || !needToCheckRef(reference)) { continue; } TextRange elementRange = reference.getElement().getTextRange(); if (elementRange == null || elementRange.isEmpty()) { continue; } TextRange rangeInElement = reference.getRangeInElement(); if (unresolvedReferences.containsKey(rangeInElement) && unresolvedReferences.get(rangeInElement) == null) { continue; } if (XmlHighlightVisitor.hasBadResolve(reference, true)) { if (!reference.isSoft()) { unresolvedReferences.putIfAbsent(rangeInElement, reference); } } else { // the specific range has at least one resolved reference // no need to check any other references from that range unresolvedReferences.put(rangeInElement, null); } } return ContainerUtil.skipNulls(unresolvedReferences.values()); }
|
getUnresolvedReferencesToAnnotate
|
301,485
|
boolean (PsiReference reference) { return true; }
|
needToCheckRef
|
301,486
|
boolean () { return false; }
|
isForHtml
|
301,487
|
String () { return XmlAnalysisBundle.message("xml.quickfix.remove.tag.text", myTagName); }
|
getText
|
301,488
|
String () { return XmlAnalysisBundle.message("xml.quickfix.remove.tag.family"); }
|
getFamilyName
|
301,489
|
void (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final XmlTag next = editor != null ? PsiTreeUtil.getNextSiblingOfType(startElement, XmlTag.class) : null; final XmlTag prev = editor != null ? PsiTreeUtil.getPrevSiblingOfType(startElement, XmlTag.class) : null; startElement.delete(); if (editor != null) { if (next != null) { editor.getCaretModel().moveToOffset(next.getTextRange().getStartOffset()); } else if (prev != null) { editor.getCaretModel().moveToOffset(prev.getTextRange().getEndOffset()); } } }
|
invoke
|
301,490
|
boolean () { return false; }
|
isEmpty
|
301,491
|
void (XmlTag tag, @NotNull @InspectionMessage String localizedMessage, HighlightInfoType type, IntentionAction... quickFixActions) { XmlToken childByRole = XmlTagUtil.getStartTagNameElement(tag); bindMessageToAstNode(childByRole, type, localizedMessage, quickFixActions); childByRole = XmlTagUtil.getEndTagNameElement(tag); bindMessageToAstNode(childByRole, type, localizedMessage, quickFixActions); }
|
addElementsForTagWithManyQuickFixes
|
301,492
|
void (@NotNull XmlTag tag) { if (ourDoJaxpTesting) return; if (!myHolder.hasErrorResults()) { checkTagByDescriptor(tag); } if (!myHolder.hasErrorResults()) { if (!skipValidation(tag)) { final XmlElementDescriptor descriptor = tag.getDescriptor(); if (tag instanceof HtmlTag && ( descriptor instanceof AnyXmlElementDescriptor || descriptor == null ) ) { return; } checkReferences(tag); } } }
|
checkTag
|
301,493
|
void (@NotNull XmlProcessingInstruction processingInstruction) { super.visitXmlProcessingInstruction(processingInstruction); PsiElement parent = processingInstruction.getParent(); if (parent instanceof XmlProlog && processingInstruction.getText().startsWith("<?xml ")) { for(PsiElement e = PsiTreeUtil.prevLeaf(processingInstruction); e != null; e = PsiTreeUtil.prevLeaf(e)) { if (e instanceof PsiWhiteSpace && PsiTreeUtil.prevLeaf(e) != null || e instanceof OuterLanguageElement) { continue; } PsiElement eParent = e.getParent(); if (eParent instanceof PsiComment) e = eParent; if (eParent instanceof XmlProcessingInstruction) break; String description = XmlAnalysisBundle.message("xml.inspections.xml.declaration.should.precede.all.document.content"); final HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(e).descriptionAndTooltip(description).create(); myHolder.add(info); } } checkReferences(processingInstruction); }
|
visitXmlProcessingInstruction
|
301,494
|
void (final PsiElement childByRole, final HighlightInfoType warning, @NotNull @InspectionMessage String localizedMessage, IntentionAction... quickFixActions) { if(childByRole != null) { final TextRange textRange = childByRole.getTextRange(); int length = textRange.getLength(); final int startOffset = textRange.getStartOffset(); HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(warning).range(childByRole, startOffset, startOffset + length) .descriptionAndTooltip(localizedMessage); for (final IntentionAction quickFixAction : quickFixActions) { builder.registerFix(quickFixAction, null, null, textRange, null); } HighlightInfo highlightInfo = builder.create(); if (highlightInfo == null) { builder = HighlightInfo.newHighlightInfo(warning).range(new TextRange(startOffset, startOffset + length)) .textAttributes(Holder.NONEMPTY_TEXT_ATTRIBUTES); for (final IntentionAction quickFixAction : quickFixActions) { builder.registerFix(quickFixAction, null, null, textRange, null); } highlightInfo = builder.descriptionAndTooltip(localizedMessage).create(); } myHolder.add(highlightInfo); } }
|
bindMessageToAstNode
|
301,495
|
void (final XmlTag tag) { String name = tag.getName(); XmlElementDescriptor elementDescriptor; final PsiElement parent = tag.getParent(); if (parent instanceof XmlTag parentTag) { elementDescriptor = XmlUtil.getDescriptorFromContext(tag); final XmlElementDescriptor parentDescriptor = parentTag.getDescriptor(); if (parentDescriptor != null && elementDescriptor == null && shouldBeValidated(tag)) { if (tag instanceof HtmlTag) { //XmlEntitiesInspection inspection = getInspectionProfile(tag, HtmlStyleLocalInspection.SHORT_NAME); //if (inspection != null /*&& isAdditionallyDeclared(inspection.getAdditionalEntries(XmlEntitiesInspection.UNKNOWN_TAG), name)*/) { return; //} } HighlightInfoType type = getTagProblemInfoType(tag); addElementsForTagWithManyQuickFixes(tag, XmlAnalysisBundle.message("xml.inspections.element.is.not.allowed.here", name), type); return; } if (elementDescriptor instanceof AnyXmlElementDescriptor || elementDescriptor == null ) { elementDescriptor = tag.getDescriptor(); } if (elementDescriptor == null) return; } else { //root tag elementDescriptor = tag.getDescriptor(); if (elementDescriptor == null) { addElementsForTagWithManyQuickFixes(tag, XmlAnalysisBundle.message("xml.inspections.element.must.be.declared", name), HighlightInfoType.WRONG_REF); return; } } if (elementDescriptor instanceof Validator) { //noinspection unchecked ((Validator<XmlTag>)elementDescriptor).validate(tag,this); } }
|
checkTagByDescriptor
|
301,496
|
HighlightInfoType (XmlTag tag) { if (tag instanceof HtmlTag && XmlUtil.HTML_URI.equals(tag.getNamespace())) { if (isInjectedWithoutValidation(tag)) return HighlightInfoType.INFORMATION; return HighlightInfoType.WARNING; } return HighlightInfoType.WRONG_REF; }
|
getTagProblemInfoType
|
301,497
|
boolean (PsiElement element) { return InjectedLanguageManager.FRANKENSTEIN_INJECTION.get(element.getContainingFile()) == Boolean.TRUE; }
|
isInjectedWithoutValidation
|
301,498
|
boolean (PsiElement context) { return context instanceof XmlElement && ((XmlElement)context).skipValidation(); }
|
skipValidation
|
301,499
|
void (@NotNull PsiElement element) { element.putUserData(XmlElement.DO_NOT_VALIDATE, Boolean.TRUE); }
|
setSkipValidation
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.