Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
301,600
void (@NotNull final PsiElement element) { PsiElement parent = element.getParent(); if (parent instanceof XmlText) { parent = parent.getParent(); } myDoNotValidateParentsList.add(parent); }
registerOuterLanguageElement
301,601
boolean (String prefix) { return myUsedPrefixes.contains(prefix); }
isInUse
301,602
boolean (String ns) { return myUsedNamespaces.contains(ns); }
isUsedNamespace
301,603
void (@NotNull final PsiElement element) { if (element instanceof OuterLanguageElement) { visitOuterLanguageElement(element); } super.visitElement(element); }
visitElement
301,604
void (@NotNull final PsiElement element) { myHolder.registerOuterLanguageElement(element); PsiReference[] references = element.getReferences(); for (PsiReference reference : references) { if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) { PsiElement resolve = reference.resolve(); if (resolve instanceof SchemaPrefix) { myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName()); } } } }
visitOuterLanguageElement
301,605
void (@NotNull final PsiComment comment) { doVisitAnyComment(comment); super.visitComment(comment); }
visitComment
301,606
void (final @NotNull XmlComment comment) { doVisitAnyComment(comment); super.visitXmlComment(comment); }
visitXmlComment
301,607
void (final PsiComment comment) { final String id = XmlDeclareIdInCommentAction.getImplicitlyDeclaredId(comment); if (id != null) { myHolder.registerAdditionalId(id); } }
doVisitAnyComment
301,608
void (@NotNull XmlTag tag) { myHolder.addUsedPrefix(tag.getNamespacePrefix()); myHolder.addUsedNamespace(tag.getNamespace()); String text = tag.getValue().getTrimmedText(); detectPrefix(text, tag); super.visitXmlTag(tag); }
visitXmlTag
301,609
void (@NotNull XmlAttribute attribute) { if (!attribute.isNamespaceDeclaration()) { myHolder.addUsedPrefix(attribute.getNamespacePrefix()); } myHolder.addUsedNamespace(attribute.getNamespace()); super.visitXmlAttribute(attribute); }
visitXmlAttribute
301,610
void (final @NotNull XmlAttributeValue value) { final PsiElement element = value.getParent(); if (!(element instanceof XmlAttribute attribute)) return; final XmlTag tag = attribute.getParent(); if (tag == null) return; final XmlElementDescriptor descriptor = tag.getDescriptor(); if (descriptor == null) return; final XmlAttributeDescriptor attributeDescriptor = attribute.getDescriptor(); if (attributeDescriptor != null) { if (attributeDescriptor.hasIdType()) { updateMap(attribute, value, false); } else { final PsiReference[] references = value.getReferences(); for (PsiReference r : references) { if (r instanceof IdReferenceProvider.GlobalAttributeValueSelfReference /*&& !r.isSoft()*/) { updateMap(attribute, value, r.isSoft()); } else if (r instanceof SchemaPrefixReference) { SchemaPrefix prefix = ((SchemaPrefixReference)r).resolve(); if (prefix != null) { myHolder.addUsedPrefix(prefix.getName()); } } } } if (attributeDescriptor.hasIdRefType() && PsiTreeUtil.getChildOfType(value, OuterLanguageElement.class) == null) { myHolder.registerIdReference(value); } } String s = value.getValue(); detectPrefix(s, tag); super.visitXmlAttributeValue(value); }
visitXmlAttributeValue
301,611
void (String s, XmlTag tag) { if (s != null && !(tag instanceof HtmlTag) && s.length() < 1000) { Matcher matcher = PREFIX_PATTERN.matcher(s); while (matcher.find()) { String group = matcher.group(); myHolder.addUsedPrefix(group.substring(0, group.length() - 1)); } } }
detectPrefix
301,612
void (@NotNull final XmlAttribute attribute, @NotNull final XmlAttributeValue value, final boolean soft) { final String id = XmlHighlightVisitor.getUnquotedValue(value, attribute.getParent()); if (XmlUtil.isSimpleValue(id, value) && PsiTreeUtil.getChildOfType(value, OuterLanguageElement.class) == null) { myHolder.registerId(id, value, soft); } }
updateMap
301,613
void (String prefix) { myUsedPrefixes.add(prefix); }
addUsedPrefix
301,614
void (String ns) { myUsedNamespaces.add(ns); }
addUsedNamespace
301,615
PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttributeValue(final @NotNull XmlAttributeValue value) { if (value.getTextRange().isEmpty()) { return; } final PsiFile file = value.getContainingFile(); if (!(file instanceof XmlFile)) { return; } PsiFile baseFile = PsiUtilCore.getTemplateLanguageFile(file); if (baseFile != file && !(baseFile instanceof XmlFile)) { return; } final XmlRefCountHolder refHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file); if (refHolder == null) return; final PsiElement parent = value.getParent(); if (!(parent instanceof XmlAttribute)) return; final XmlTag tag = (XmlTag)parent.getParent(); if (tag == null) return; checkValue(value, (XmlFile)file, refHolder, tag, holder); } }; }
buildVisitor
301,616
void (final @NotNull XmlAttributeValue value) { if (value.getTextRange().isEmpty()) { return; } final PsiFile file = value.getContainingFile(); if (!(file instanceof XmlFile)) { return; } PsiFile baseFile = PsiUtilCore.getTemplateLanguageFile(file); if (baseFile != file && !(baseFile instanceof XmlFile)) { return; } final XmlRefCountHolder refHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file); if (refHolder == null) return; final PsiElement parent = value.getParent(); if (!(parent instanceof XmlAttribute)) return; final XmlTag tag = (XmlTag)parent.getParent(); if (tag == null) return; checkValue(value, (XmlFile)file, refHolder, tag, holder); }
visitXmlAttributeValue
301,617
void (XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) { if (refHolder.isValidatable(tag.getParent()) && refHolder.isDuplicateIdAttributeValue(value)) { holder.registerProblem(value, XmlAnalysisBundle.message("xml.inspections.duplicate.id.reference"), ProblemHighlightType.GENERIC_ERROR, ElementManipulators.getValueTextRange(value)); } }
checkValue
301,618
String () { return XmlAnalysisBundle.message("xml.quickfix.declare.id.in.comment"); }
getFamilyName
301,619
String (@NotNull final PsiComment comment) { final String text = getUncommentedText(comment); if (text == null) return null; if (text.startsWith("@declare id=\"")) { final String result = text.substring("@declare id=\"".length() - 1); return StringUtil.unquoteString(result); } return null; }
getImplicitlyDeclaredId
301,620
String (@NotNull final PsiComment comment) { final PsiFile psiFile = comment.getContainingFile(); final Language language = psiFile.getViewProvider().getBaseLanguage(); final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(language); if (commenter != null) { String text = comment.getText(); final String prefix = commenter.getBlockCommentPrefix(); if (prefix != null && text.startsWith(prefix)) { text = text.substring(prefix.length()); final String suffix = commenter.getBlockCommentSuffix(); if (suffix != null && text.length() > suffix.length()) { return text.substring(0, text.length() - suffix.length()).trim(); } } } return null; }
getUncommentedText
301,621
void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { final PsiElement psiElement = descriptor.getPsiElement(); final PsiFile psiFile = psiElement.getContainingFile(); WriteCommandAction.writeCommandAction(project, psiFile).run(() -> { final XmlTag tag = PsiTreeUtil.getParentOfType(psiElement, XmlTag.class); if (tag == null) return; final Language language = psiFile.getViewProvider().getBaseLanguage(); final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(language); if (commenter == null) return; String commentText = commenter.getBlockCommentPrefix() + "@declare id=\"" + myId + "\"" + commenter.getBlockCommentSuffix(); XmlTag parent = tag.getParentTag(); if (parent != null) { Document document = Objects.requireNonNull(psiFile.getViewProvider().getDocument()); document.insertString(parent.getSubTags()[0].getTextRange().getStartOffset(), commentText); } }); }
applyFix
301,622
boolean () { return true; }
isEnabledByDefault
301,623
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { if (tag instanceof HtmlTag) { return; } final ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()); if (child == null) { return; } final ASTNode node = child.getTreeNext(); if (node != null && node.getElementType() == XmlTokenType.XML_END_TAG_START) { holder.registerProblem( tag, XmlAnalysisBundle.message("xml.inspections.tag.empty.body"), LocalQuickFix.notNullElements(isCollapsibleTag(tag) ? new CollapseTagIntention() : null) ); } } }; }
buildVisitor
301,624
boolean (final XmlTag tag) { final String name = StringUtil.toLowerCase(tag.getName()); return tag.getLanguage() == XMLLanguage.INSTANCE || "link".equals(name) || "br".equals(name) || "meta".equals(name) || "img".equals(name) || "input".equals(name) || "hr".equals(name) || XmlExtension.isCollapsible(tag); }
isCollapsibleTag
301,625
String () { return "CheckTagEmptyBody"; }
getShortName
301,626
boolean () { return true; }
isEnabledByDefault
301,627
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { if (XmlExtension.shouldIgnoreSelfClosingTag(tag) || !isTagWithEmptyEndNotAllowed(tag)) { return; } if (XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag.getNode()) == null || !tagIsWellFormed(tag)) { return; } ProblemHighlightType type = isNotInjectedOrCustomHtmlFile(tag.getContainingFile()) ? ProblemHighlightType.GENERIC_ERROR_OR_WARNING : ProblemHighlightType.INFORMATION; // should not report INFORMATION in batch mode if (isOnTheFly || type != ProblemHighlightType.INFORMATION) { holder.registerProblem(tag, XmlAnalysisBundle.message("html.inspections.check.empty.script.message"), type, new MyLocalQuickFix()); } } }; }
buildVisitor
301,628
void (final @NotNull XmlTag tag) { if (XmlExtension.shouldIgnoreSelfClosingTag(tag) || !isTagWithEmptyEndNotAllowed(tag)) { return; } if (XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag.getNode()) == null || !tagIsWellFormed(tag)) { return; } ProblemHighlightType type = isNotInjectedOrCustomHtmlFile(tag.getContainingFile()) ? ProblemHighlightType.GENERIC_ERROR_OR_WARNING : ProblemHighlightType.INFORMATION; // should not report INFORMATION in batch mode if (isOnTheFly || type != ProblemHighlightType.INFORMATION) { holder.registerProblem(tag, XmlAnalysisBundle.message("html.inspections.check.empty.script.message"), type, new MyLocalQuickFix()); } }
visitXmlTag
301,629
boolean (final XmlTag tag) { String tagName = tag.getName(); if (tag instanceof HtmlTag) tagName = StringUtil.toLowerCase(tagName); Language language = tag.getLanguage(); return ourTagsWithEmptyEndsNotAllowed.contains(tagName) && (language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE)) || (language.isKindOf(HTMLLanguage.INSTANCE) && !HtmlUtil.isSingleHtmlTag(tag, false) && tagName.indexOf(':') == -1 && !XmlExtension.isCollapsible(tag)); }
isTagWithEmptyEndNotAllowed
301,630
String () { return "CheckEmptyScriptTag"; }
getShortName
301,631
boolean (XmlTag tag) { boolean ok = false; final PsiElement[] children = tag.getChildren(); for (PsiElement child : children) { if (child instanceof XmlToken) { final IElementType tokenType = ((XmlToken)child).getTokenType(); if (tokenType.equals(XmlTokenType.XML_EMPTY_ELEMENT_END) && "/>".equals(child.getText())) { ok = true; } else if (tokenType.equals(XmlTokenType.XML_END_TAG_START)) { ok = true; } } else if (child instanceof OuterLanguageElement) { return false; } } return ok; }
tagIsWellFormed
301,632
String () { return XmlAnalysisBundle.message("html.inspections.check.empty.script.tag.fix.message"); }
getFamilyName
301,633
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final XmlTag tag = (XmlTag)descriptor.getPsiElement(); if (tag == null) return; XmlUtil.expandTag(tag); }
applyFix
301,634
String () { return XmlAnalysisBundle.message("xml.intention.replace.tag.empty.body.with.empty.end"); }
getFamilyName
301,635
String () { return getName(); }
getText
301,636
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { applyFix(project, descriptor.getPsiElement()); }
applyFix
301,637
boolean (@NotNull Project project, Editor editor, PsiFile file) { return isAvailable(getTag(editor, file)); }
isAvailable
301,638
boolean (XmlTag tag) { return tag != null && !tag.isEmpty() && tag.getValue().getChildren().length == tag.getValue().getTextElements().length && tag.getValue().getTrimmedText().isEmpty() && CheckTagEmptyBodyInspection.isCollapsibleTag(tag); }
isAvailable
301,639
XmlTag (Editor editor, PsiFile file) { int offset = editor.getCaretModel().getOffset(); FileViewProvider provider = file.getViewProvider(); for (Language language : provider.getLanguages()) { PsiElement element = provider.findElementAt(offset, language); XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); if (tag != null && XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()) != null) { return tag; } } return null; }
getTag
301,640
boolean () { return true; }
startInWriteAction
301,641
void (@NotNull final Project project, @NotNull final PsiElement tag) { final ASTNode child = XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()); if (child == null) return; final int offset = child.getTextRange().getStartOffset(); final Document document = tag.getContainingFile().getViewProvider().getDocument(); assert document != null; document.replaceString(offset, tag.getTextRange().getEndOffset(), "/>"); SmartPsiElementPointer<PsiElement> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(tag); PsiDocumentManager.getInstance(project).commitDocument(document); PsiElement restored = pointer.getElement(); if (restored != null) { CodeStyleManager.getInstance(project).reformat(restored); } }
applyFix
301,642
RequireAttributeOneOf (String ... attributeNames) { return new RequireAttributeOneOf(attributeNames); }
requireAttr
301,643
ShouldHaveParams () { return new ShouldHaveParams(); }
shouldHaveParams
301,644
Rule (String attrPresent, String ... attrUnused) { Effect[] effects = new Effect[attrUnused.length]; for (int i = 0; i < effects.length; i++) { effects[i] = unused( attrUnused[i], XmlAnalysisBundle.message("xml.inspections.attribute.unused.because.other.attribute.present", attrUnused[i], attrPresent)); } return new ConditionRule(ifAttrPresent(attrPresent), effects); }
unusedIfPresent
301,645
Rule (String attrPresent, String ... attrUnused) { return new ConditionRule(ifAttrPresent(attrPresent), new InvalidAllExpectSome( XmlAnalysisBundle.message("xml.inspections.all.attributes.unused.because.an.attribute.present", attrPresent), ProblemHighlightType.LIKE_UNUSED_SYMBOL, ArrayUtil.append(attrUnused, attrPresent))); }
unusedAllIfPresent
301,646
Effect (String attrName, @InspectionMessage String text) { return new InvalidAttrEffect(attrName, text, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); }
invalid
301,647
Effect (String attrName) { return new InvalidAttrEffect(attrName, XmlAnalysisBundle.message("xml.inspections.attribute.unused", attrName), ProblemHighlightType.LIKE_UNUSED_SYMBOL); }
unused
301,648
Effect (String attrName, @InspectionMessage String text) { return new InvalidAttrEffect(attrName, text, ProblemHighlightType.LIKE_UNUSED_SYMBOL); }
unused
301,649
Effect (@InspectionMessage String text, String... attrNames) { return new InvalidAllExpectSome(text, ProblemHighlightType.LIKE_UNUSED_SYMBOL, attrNames); }
unusedAll
301,650
Rule (Condition<? super XmlTag> condition, Effect ... effect) { return new ConditionRule(condition, effect); }
rule
301,651
PsiElement (RoleFinder roleFinder, XmlElement tag) { ASTNode tagNode = tag.getNode(); if (tagNode == null) return null; ASTNode nameElement = roleFinder.findChild(tagNode); if (nameElement == null) return null; return nameElement.getPsi(); }
getXmlElement
301,652
PsiElement (XmlTag tag) { return getXmlElement(XmlChildRole.START_TAG_NAME_FINDER, tag); }
getTagNameElement
301,653
PsiElement (XmlAttribute attribute) { return getXmlElement(XmlChildRole.ATTRIBUTE_NAME_FINDER, attribute); }
getAttributeNameElement
301,654
boolean (XmlTag tag) { return getXmlElement(XmlChildRole.EMPTY_TAG_END_FINDER, tag) != null || getXmlElement(XmlChildRole.CLOSING_TAG_START_FINDER, tag) != null; }
isClosedTag
301,655
Condition<XmlTag> (final String attrName) { return tag -> tag.getAttribute(attrName) != null; }
ifAttrPresent
301,656
void (@NotNull XmlTag tag, @NotNull ProblemsHolder holder) { XmlAttribute attribute = tag.getAttribute(myAttrName); if (attribute != null) { PsiElement attributeNameElement = getAttributeNameElement(attribute); if (attributeNameElement != null) { holder.registerProblem(attributeNameElement, myText, myType, new RemoveAttributeIntentionFix(myAttrName)); } } }
annotate
301,657
void (@NotNull XmlTag tag, @NotNull ProblemsHolder holder) { for (XmlAttribute xmlAttribute : tag.getAttributes()) { String attrName = xmlAttribute.getName(); if (!ArrayUtil.contains(attrName, myAttrNames)) { PsiElement attributeNameElement = getAttributeNameElement(xmlAttribute); if (attributeNameElement != null) { holder.registerProblem(attributeNameElement, myText, myType, new RemoveAttributeIntentionFix(attrName)); } } } }
annotate
301,658
void (@NotNull XmlTag tag, @NotNull ProblemsHolder holder) { if (myCondition.value(tag)) { for (Effect effect : myEffect) { effect.annotate(tag, holder); } } }
annotate
301,659
boolean (@NotNull XmlTag tag) { return true; }
needAtLeastOneAttribute
301,660
String[] () { return myAttributeNames; }
getAttributeNames
301,661
void (@NotNull XmlTag tag, @NotNull ProblemsHolder holder) { for (String attributeName : myAttributeNames) { if (tag.getAttribute(attributeName) != null) { return; } } if (!isClosedTag(tag)) return; PsiElement tagNameElement = getTagNameElement(tag); if (tagNameElement == null) return; LocalQuickFix[] fixes = LocalQuickFix.EMPTY_ARRAY; if (holder.isOnTheFly()) { fixes = new LocalQuickFix[myAttributeNames.length]; for (int i = 0; i < myAttributeNames.length; i++) { fixes[i] = XmlQuickFixFactory.getInstance().insertRequiredAttributeFix(tag, myAttributeNames[i]); } } holder.registerProblem(tagNameElement, XmlAnalysisBundle.message("xml.inspections.tag.should.have.one.of.following.attributes.0", StringUtil.join(myAttributeNames, ", ")), myProblemHighlightType, fixes); }
annotate
301,662
boolean () { return true; }
isEnabledByDefault
301,663
HighlightDisplayLevel () { return HighlightDisplayLevel.ERROR; }
getDefaultLevel
301,664
String () { return ExternalDocumentValidator.INSPECTION_SHORT_NAME; }
getShortName
301,665
void (String tagName, Rule ... rules) { assert rules.length > 0; Rule[] oldValue = put(tagName, rules); assert oldValue == null; }
add
301,666
void (XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) { String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag); if (tag instanceof HtmlTag) { idRef = StringUtil.toLowerCase(idRef); } if (XmlUtil.isSimpleValue(idRef, value) && refHolder.isIdReferenceValue(value)) { boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef); if (!hasIdDeclaration && tag instanceof HtmlTag) { hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue()); } if (!hasIdDeclaration) { for(XmlIdContributor contributor: XmlIdContributor.EP_NAME.getExtensionList()) { if (contributor.suppressExistingIdValidation(file)) { return; } } final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) { holder.registerProblem(value, XmlAnalysisBundle.message("xml.inspections.invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, new XmlDeclareIdInCommentAction(idRef)); } else { holder.registerProblem(value, XmlAnalysisBundle.message("xml.inspections.invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } }
checkValue
301,667
boolean () { return true; }
isEnabledByDefault
301,668
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { if (HtmlUtil.isHtmlTag(tag)) return; if (HtmlUtil.SCRIPT_TAG_NAME.equals(tag.getName()) || tag instanceof HtmlTag && HtmlUtil.SCRIPT_TAG_NAME.equalsIgnoreCase(tag.getName())) { final PsiFile psiFile = tag.getContainingFile(); final FileType fileType = psiFile.getFileType(); if (fileType instanceof XmlLikeFileType) { synchronized(CheckValidXmlInScriptBodyInspectionBase.class) { if (myXmlLexer == null) myXmlLexer = new XmlLexer(); final XmlTagValue tagValue = tag.getValue(); final String tagBodyText = tagValue.getText(); if (!tagBodyText.isEmpty()) { myXmlLexer.start(tagBodyText); while(myXmlLexer.getTokenType() != null) { IElementType tokenType = myXmlLexer.getTokenType(); if (tokenType == XmlTokenType.XML_CDATA_START) { while(tokenType != null && tokenType != XmlTokenType.XML_CDATA_END) { myXmlLexer.advance(); tokenType = myXmlLexer.getTokenType(); } if (tokenType == null) break; } if (tokenType == XmlTokenType.XML_BAD_CHARACTER && "&".equals(TreeUtil.getTokenText(myXmlLexer)) || tokenType == XmlTokenType.XML_START_TAG_START ) { final int valueStart = tagValue.getTextRange().getStartOffset(); final int offset = valueStart + myXmlLexer.getTokenStart(); final PsiElement psiElement = psiFile.findElementAt(offset); final TextRange elementRange = psiElement.getTextRange(); final int offsetInElement = offset - elementRange.getStartOffset(); holder.registerProblem( psiElement, XmlAnalysisBundle.message("xml.inspections.unescaped.xml.character"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, createFix(psiElement, offsetInElement) ); int endOfElementInScriptTag = elementRange.getEndOffset() - valueStart; while(myXmlLexer.getTokenEnd() < endOfElementInScriptTag) { myXmlLexer.advance(); if (myXmlLexer.getTokenType() == null) break; } } myXmlLexer.advance(); } } } } } } }; }
buildVisitor
301,669
LocalQuickFix (PsiElement psiElement, int offsetInElement) { return null; }
createFix
301,670
String () { return "CheckValidXmlInScriptTagBody"; }
getShortName
301,671
HighlightDisplayLevel () { return HighlightDisplayLevel.ERROR; }
getDefaultLevel
301,672
boolean () { return true; }
isEnabledByDefault
301,673
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlElement(final @NotNull XmlElement element) { if (element instanceof XmlElementContentSpec || element instanceof XmlEntityRef ) { doCheckRefs(element, holder); } } }; }
buildVisitor
301,674
void (final @NotNull XmlElement element) { if (element instanceof XmlElementContentSpec || element instanceof XmlEntityRef ) { doCheckRefs(element, holder); } }
visitXmlElement
301,675
void (final XmlElement element, final ProblemsHolder holder) { for (PsiReference ref : element.getReferences()) { ProgressManager.checkCanceled(); if (XmlHighlightVisitor.hasBadResolve(ref, true)) { if (ref.getElement() instanceof XmlElementContentSpec) { final String image = ref.getCanonicalText(); if (image.equals("-") || image.equals("O")) continue; } holder.registerProblem(ref); } } }
doCheckRefs
301,676
HighlightDisplayLevel () { return HighlightDisplayLevel.ERROR; }
getDefaultLevel
301,677
boolean (@NotNull Language language) { Set<String> langs = LANGS.getValue(); while (language != null) { if (langs.contains(language.getID())) return true; language = language.getBaseLanguage(); } return false; }
matchesLanguage
301,678
String (@NotNull ComponentManager componentManager, @NotNull PluginDescriptor pluginDescriptor) { return language; }
createInstance
301,679
ExternalResourceManager () { return ApplicationManager.getApplication().getService(ExternalResourceManager.class); }
getInstance
301,680
VirtualFile (String uri, VirtualFile base) { return VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(uri), base); }
findRelativeFile
301,681
VirtualFile (String uri, @NotNull PsiFileSystemItem base) { String location = ExternalResourceManager.getInstance().getResourceLocation(uri, base.getProject()); VirtualFile file = base.getVirtualFile(); return VfsUtilCore.findRelativeFile(location, file != null && file.isValid() ? file : null); }
findRelative
301,682
String (@NotNull String path) { return StringUtil.trimStart(StringUtil.trimEnd(path, "/"), "/"); }
trimSlashFrom
301,683
boolean (@NotNull PsiFile file) { return true; }
isProviderAvailable
301,684
boolean (@NotNull PsiElement element, @NotNull String inspectionId) { final XmlTag tag = element instanceof XmlFile ? ((XmlFile)element).getRootTag() : PsiTreeUtil.getContextOfType(element, XmlTag.class, false); return tag != null && findSuppression(tag, inspectionId, element) != null; }
isSuppressedFor
301,685
void (@NotNull PsiElement element, @NotNull String inspectionId) { final PsiFile file = element.getContainingFile(); if (!(file instanceof XmlFile)) return; final XmlDocument document = ((XmlFile)file).getDocument(); final PsiElement anchor = document != null ? document.getRootTag() : file.findElementAt(0); assert anchor != null; suppress(file, findFileSuppression(anchor, null, element), inspectionId, anchor.getTextRange().getStartOffset()); }
suppressForFile
301,686
void (@NotNull PsiElement element, @NotNull String inspectionId) { final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); assert tag != null; suppress(element.getContainingFile(), findSuppressionLeaf(tag, null, 0), inspectionId, tag.getTextRange().getStartOffset()); }
suppressForTag
301,687
PsiElement (final PsiElement anchor, final String id, PsiElement originalElement) { final PsiElement element = findSuppressionLeaf(anchor, id, 0); if (element != null) return element; return findFileSuppression(anchor, id, originalElement); }
findSuppression
301,688
PsiElement (PsiElement anchor, String id, PsiElement originalElement) { final PsiFile file = anchor.getContainingFile(); if (file instanceof XmlFile) { final XmlDocument document = ((XmlFile)file).getDocument(); final XmlTag rootTag = document != null ? document.getRootTag() : null; PsiElement leaf = rootTag != null ? rootTag.getPrevSibling() : file.findElementAt(0); return findSuppressionLeaf(leaf, id, 0); } return null; }
findFileSuppression
301,689
PsiElement (PsiElement leaf, @Nullable final String id, int offset) { while (leaf != null && leaf.getTextOffset() >= offset) { if (isSuppressedInComment(leaf, id)) { return leaf; } else if (leaf instanceof XmlText || leaf instanceof XmlProlog) { for (PsiElement child : leaf.getChildren()) { if (isSuppressedInComment(child, id)) { return leaf; } } } leaf = leaf.getPrevSibling(); if (leaf instanceof XmlTag) { return null; } } return null; }
findSuppressionLeaf
301,690
boolean (@NotNull PsiElement element, @Nullable String id) { if (!(element instanceof PsiComment)) return false; String text = element.getText(); if (!text.contains(getPrefix())) { return false; } if (id == null) { return true; } @NonNls final HashSet<String> parts = new HashSet<>(StringUtil.getWordsIn(text)); return parts.contains(id) || parts.contains(XmlSuppressableInspectionTool.ALL); }
isSuppressedInComment
301,691
void (PsiFile file, final PsiElement suppressionElement, String inspectionId, final int offset) { final Project project = file.getProject(); //final Document doc = PsiDocumentManager.getInstance(project).getDocument(file); final Document doc = file.getViewProvider().getDocument(); assert doc != null; if (suppressionElement != null) { final TextRange textRange = suppressionElement.getTextRange(); String text = suppressionElement.getText(); final String suppressionText = getSuppressionText(inspectionId, text); doc.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), suppressionText); } else { final String suppressionText = getSuppressionText(inspectionId, null); doc.insertString(offset, suppressionText); CodeStyleManager.getInstance(project).adjustLineIndent(doc, offset + suppressionText.length()); UndoUtil.markPsiFileForUndo(file); } }
suppress
301,692
String (String inspectionId, @Nullable String originalText) { if (originalText == null) { return getPrefix() + inspectionId + getSuffix() + "\n"; } else if (inspectionId.equals(XmlSuppressableInspectionTool.ALL)) { final int pos = originalText.indexOf(getPrefix()); return originalText.substring(0, pos) + getPrefix() + inspectionId + getSuffix() + "\n"; } return StringUtil.replace(originalText, getSuffix(), ", " + inspectionId + getSuffix()); }
getSuppressionText
301,693
String () { return "<!--" + SUPPRESS_MARK + " "; }
getPrefix
301,694
String () { return " -->"; }
getSuffix
301,695
boolean (@NotNull PsiElement element, @NotNull String inspectionId) { return EP_NAME.getExtensionList().stream().anyMatch(provider -> provider.isProviderAvailable(element.getContainingFile()) && provider.isSuppressedFor(element, inspectionId)); }
isSuppressed
301,696
boolean (@NotNull PsiElement element, @NotNull String toolId) { return XmlSuppressionProvider.isSuppressed(element, toolId); }
isSuppressedFor
301,697
boolean (@NotNull Project project, @NotNull PsiElement context) { return context.isValid() && getContainer(context) != null; }
isAvailable
301,698
String () { return getName(); }
getFamilyName
301,699
PsiElement (@Nullable PsiElement context) { return null; }
getContainer