Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
301,500 | void (XmlAttribute attribute) { XmlTag tag = attribute.getParent(); if (tag == null) return; final String name = attribute.getName(); PsiElement prevLeaf = PsiTreeUtil.prevLeaf(attribute); if (!(prevLeaf instanceof PsiWhiteSpace) && (!(tag instanceof HtmlTag) || !XmlUtil.hasNonEditableInjectionFragmentAt(attribute, attribute.getTextOffset()))) { TextRange textRange = attribute.getTextRange(); HighlightInfoType type = tag instanceof HtmlTag ? HighlightInfoType.WARNING : HighlightInfoType.ERROR; String description = XmlAnalysisBundle.message("xml.inspections.attribute.should.be.preceded.with.space"); HighlightInfo info = HighlightInfo.newHighlightInfo(type).range(textRange.getStartOffset(), textRange.getStartOffset()).descriptionAndTooltip(description).create(); myHolder.add(info); } if (attribute.isNamespaceDeclaration() || XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(attribute.getNamespace())) { //checkReferences(attribute.getValueElement()); return; } XmlElementDescriptor elementDescriptor = tag.getDescriptor(); if (elementDescriptor == null || elementDescriptor instanceof AnyXmlElementDescriptor || ourDoJaxpTesting) { return; } XmlAttributeDescriptor attributeDescriptor = attribute.getDescriptor(); if (attributeDescriptor == null) { if (!XmlUtil.attributeFromTemplateFramework(name, tag)) { final String localizedMessage = XmlAnalysisBundle.message("xml.inspections.attribute.is.not.allowed.here", name); reportAttributeProblem(tag, name, attribute, localizedMessage); } } else { checkDuplicateAttribute(tag, attribute); // we skip resolve of attribute references since there is separate check when taking attribute descriptors PsiReference[] attrRefs = attribute.getReferences(); doCheckRefs(attribute, attrRefs, !attribute.getNamespacePrefix().isEmpty() ? 2 : 1); } } | checkAttribute |
301,501 | void (final XmlTag tag, final String localName, final XmlAttribute attribute, @NotNull @InspectionMessage String localizedMessage) { final RemoveAttributeIntentionFix removeAttributeIntention = new RemoveAttributeIntentionFix(localName); if (tag instanceof HtmlTag) { return; } final HighlightInfoType tagProblemInfoType = HighlightInfoType.WRONG_REF; final ASTNode node = SourceTreeToPsiMap.psiElementToTree(attribute); assert node != null; final ASTNode child = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(node); assert child != null; HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(tagProblemInfoType) .range(child) .descriptionAndTooltip(localizedMessage) .registerFix(removeAttributeIntention, List.of(), null, null, null); PsiFile file = tag.getContainingFile(); if (file != null) { for (XmlUndefinedElementFixProvider fixProvider : XmlUndefinedElementFixProvider.EP_NAME.getExtensionList()) { IntentionAction[] fixes = fixProvider.createFixes(attribute); if (fixes != null) { for (IntentionAction action : fixes) { builder.registerFix(action, null, null, null, null); } break; } } } final HighlightInfo highlightInfo = builder.create(); myHolder.add(highlightInfo); } | reportAttributeProblem |
301,502 | void (XmlTag tag, final XmlAttribute attribute) { if (skipValidation(tag)) { return; } final XmlAttribute[] attributes = tag.getAttributes(); final PsiFile containingFile = tag.getContainingFile(); final XmlExtension extension = containingFile instanceof XmlFile ? XmlExtension.getExtension(containingFile) : DefaultXmlExtension.DEFAULT_EXTENSION; for (XmlAttribute tagAttribute : attributes) { ProgressManager.checkCanceled(); if (attribute != tagAttribute && Comparing.strEqual(attribute.getName(), tagAttribute.getName())) { final String localName = attribute.getLocalName(); if (extension.canBeDuplicated(tagAttribute)) continue; // multiple import attributes are allowed in jsp directive final ASTNode attributeNode = SourceTreeToPsiMap.psiElementToTree(attribute); assert attributeNode != null; final ASTNode attributeNameNode = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(attributeNode); assert attributeNameNode != null; IntentionAction intentionAction = new RemoveAttributeIntentionFix(localName); HighlightInfo highlightInfo = HighlightInfo.newHighlightInfo(getTagProblemInfoType(tag)) .range(attributeNameNode) .registerFix(intentionAction, List.of(), null, null, null) .descriptionAndTooltip(XmlAnalysisBundle.message("xml.inspections.duplicate.attribute", localName)).create(); myHolder.add(highlightInfo); } } } | checkDuplicateAttribute |
301,503 | void (PsiElement value) { if (value == null) return; doCheckRefs(value, value.getReferences(), 0); } | checkReferences |
301,504 | void (@NotNull PsiElement value, final PsiReference @NotNull [] references, int start) { for (int i = start; i < references.length; ++i) { PsiReference reference = references[i]; ProgressManager.checkCanceled(); if (isUrlReference(reference)) continue; if (!hasBadResolve(reference, false)) { continue; } String description = getErrorDescription(reference); final int startOffset = reference.getElement().getTextRange().getStartOffset(); final TextRange referenceRange = reference.getRangeInElement(); // logging for IDEADEV-29655 if (referenceRange.getStartOffset() > referenceRange.getEndOffset()) { LOG.error("Reference range start offset > end offset: " + reference + ", start offset: " + referenceRange.getStartOffset() + ", end offset: " + referenceRange.getEndOffset()); } HighlightInfoType type = getTagProblemInfoType(PsiTreeUtil.getParentOfType(value, XmlTag.class)); if (value instanceof XmlAttributeValue) { PsiElement parent = value.getParent(); if (parent instanceof XmlAttribute) { String name = StringUtil.toLowerCase(((XmlAttribute)parent).getName()); if (type.getSeverity(null).compareTo(HighlightInfoType.WARNING.getSeverity(null)) > 0 && name.endsWith("stylename")) { type = HighlightInfoType.WARNING; } } } HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(type) .range(startOffset + referenceRange.getStartOffset(), startOffset + referenceRange.getEndOffset()) .descriptionAndTooltip(description); if (reference instanceof LocalQuickFixProvider) { LocalQuickFix[] fixes = ((LocalQuickFixProvider)reference).getQuickFixes(); if (fixes != null) { InspectionManager manager = InspectionManager.getInstance(reference.getElement().getProject()); for (LocalQuickFix fix : fixes) { ProblemDescriptor descriptor = manager.createProblemDescriptor(value, description, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true); builder.registerFix(new LocalQuickFixAsIntentionAdapter(fix, descriptor), null, null, null, null); } } } UnresolvedReferenceQuickFixUpdater.getInstance(value.getProject()).registerQuickFixesLater(reference, builder); myHolder.add(builder.create()); } } | doCheckRefs |
301,505 | boolean (PsiReference reference) { return reference instanceof FileReferenceOwner || reference instanceof AnchorReference || reference instanceof PsiFileReference; } | isUrlReference |
301,506 | boolean (final PsiReference reference, boolean checkSoft) { if (!checkSoft && reference.isSoft()) return false; if (reference instanceof PsiPolyVariantReference) { return ((PsiPolyVariantReference)reference).multiResolve(false).length == 0; } return reference.resolve() == null; } | hasBadResolve |
301,507 | void (boolean doJaxpTesting) { ourDoJaxpTesting = doJaxpTesting; } | setDoJaxpTesting |
301,508 | void (PsiElement context, String message, @NotNull ErrorType type) { addMessageWithFixes(context, message, type); } | addMessage |
301,509 | void (final PsiElement context, final String message, @NotNull final ErrorType type, final IntentionAction @NotNull ... fixes) { if (message != null && !message.isEmpty()) { final PsiFile containingFile = context.getContainingFile(); final HighlightInfoType defaultInfoType = type == ErrorType.ERROR ? HighlightInfoType.ERROR : type == ErrorType.WARNING ? HighlightInfoType.WARNING : HighlightInfoType.WEAK_WARNING; if (context instanceof XmlTag && XmlExtension.getExtension(containingFile).shouldBeHighlightedAsTag((XmlTag)context)) { addElementsForTagWithManyQuickFixes((XmlTag)context, message, defaultInfoType, fixes); } else { final PsiElement contextOfFile = InjectedLanguageManager.getInstance(containingFile.getProject()).getInjectionHost(containingFile); HighlightInfo.Builder builder; if (contextOfFile != null) { TextRange range = InjectedLanguageManager.getInstance(context.getProject()).injectedToHost(context, context.getTextRange()); builder = HighlightInfo.newHighlightInfo(defaultInfoType).range(range).descriptionAndTooltip(message); } else { builder = HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(context).descriptionAndTooltip(message); } for (final IntentionAction quickFixAction : fixes) { if (quickFixAction == null) continue; builder.registerFix(quickFixAction, null, null, null, null); } myHolder.add(builder.create()); } } } | addMessageWithFixes |
301,510 | boolean (@NotNull final PsiFile file) { if (file instanceof XmlFile) return true; for (PsiFile psiFile : file.getViewProvider().getAllFiles()) { if (psiFile instanceof XmlFile) { return true; } } return false; } | suitableForFile |
301,511 | void (@NotNull final PsiElement element) { element.accept(this); } | visit |
301,512 | boolean (@NotNull final PsiFile file, final boolean updateWholeFile, @NotNull HighlightInfoHolder holder, @NotNull Runnable action) { myHolder = holder; try { action.run(); } finally { myHolder = null; } return true; } | analyze |
301,513 | HighlightVisitor () { return new XmlHighlightVisitor(); } | clone |
301,514 | String (XmlAttributeValue value, XmlTag tag) { String unquotedValue = value.getValue(); if (tag instanceof HtmlTag) { unquotedValue = StringUtil.toLowerCase(unquotedValue); } return unquotedValue; } | getUnquotedValue |
301,515 | boolean (@NotNull XmlTag tag) { PsiElement parent = tag.getParent(); if (parent instanceof XmlTag) { return !skipValidation(parent) && !XmlUtil.tagFromTemplateFramework(tag); } return true; } | shouldBeValidated |
301,516 | HighlightDisplayLevel () { return HighlightDisplayLevel.ERROR; } | getDefaultLevel |
301,517 | void (@NotNull final PsiFile file, @NotNull final InspectionManager manager, @NotNull ProblemsHolder problemsHolder, @NotNull final GlobalInspectionContext globalContext, @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) { HighlightInfoHolder myHolder = new HighlightInfoHolder(file) { @Override public boolean add(@Nullable HighlightInfo info) { if (info != null) { GlobalInspectionUtil.createProblem( file, info, new TextRange(info.startOffset, info.endOffset), null, manager, problemDescriptionsProcessor, globalContext ); } return true; } }; final XmlHighlightVisitor highlightVisitor = new XmlHighlightVisitor(); highlightVisitor.analyze(file, true, myHolder, new Runnable() { @Override public void run() { file.accept(new XmlRecursiveElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { highlightVisitor.visit(element); super.visitElement(element); } }); } }); } | checkFile |
301,518 | boolean (@Nullable HighlightInfo info) { if (info != null) { GlobalInspectionUtil.createProblem( file, info, new TextRange(info.startOffset, info.endOffset), null, manager, problemDescriptionsProcessor, globalContext ); } return true; } | add |
301,519 | void () { file.accept(new XmlRecursiveElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { highlightVisitor.visit(element); super.visitElement(element); } }); } | run |
301,520 | void (@NotNull PsiElement element) { highlightVisitor.visit(element); super.visitElement(element); } | visitElement |
301,521 | String () { return getGeneralGroupName(); } | getGroupDisplayName |
301,522 | String () { return "XmlHighlighting"; } | getShortName |
301,523 | String () { return "HtmlUnknownTarget"; } | getShortName |
301,524 | boolean () { return true; } | isForHtml |
301,525 | boolean (PsiReference reference) { return !(reference instanceof AnchorReference) && notRemoteBase(reference); } | needToCheckRef |
301,526 | boolean (PsiReference reference) { final PsiFile file = reference.getElement().getContainingFile(); final String basePath = file instanceof XmlFile ? HtmlUtil.getHrefBase((XmlFile)file) : null; return basePath == null || !HtmlUtil.hasHtmlPrefix(basePath); } | notRemoteBase |
301,527 | PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { PsiFile file = holder.getFile(); if (!(file instanceof XmlFile)) return; XmlRefCountHolder refCountHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file); if (refCountHolder == null) return; if (!attribute.isNamespaceDeclaration()) { checkUnusedLocations(attribute, holder, refCountHolder); return; } String namespace = attribute.getValue(); String declaredPrefix = getDeclaredPrefix(attribute); if (namespace != null && !refCountHolder.isInUse(declaredPrefix)) { for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) { if (provider.isImplicitUsage(attribute)) return; } XmlAttributeValue value = attribute.getValueElement(); assert value != null; holder.registerProblem(attribute, XmlAnalysisBundle.message("xml.inspections.unused.schema.declaration"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, false, !refCountHolder.isUsedNamespace(namespace))); XmlTag parent = attribute.getParent(); if (declaredPrefix.isEmpty()) { XmlAttribute location = getDefaultLocation(parent); if (location != null) { holder.registerProblem(location, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } else if (!refCountHolder.isUsedNamespace(namespace)) { for (PsiReference reference : getLocationReferences(namespace, parent)) { if (!XmlHighlightVisitor.hasBadResolve(reference, false)) holder.registerProblemForReference(reference, ProblemHighlightType.LIKE_UNUSED_SYMBOL, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } } } }; } | buildVisitor |
301,528 | void (@NotNull XmlAttribute attribute) { PsiFile file = holder.getFile(); if (!(file instanceof XmlFile)) return; XmlRefCountHolder refCountHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file); if (refCountHolder == null) return; if (!attribute.isNamespaceDeclaration()) { checkUnusedLocations(attribute, holder, refCountHolder); return; } String namespace = attribute.getValue(); String declaredPrefix = getDeclaredPrefix(attribute); if (namespace != null && !refCountHolder.isInUse(declaredPrefix)) { for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) { if (provider.isImplicitUsage(attribute)) return; } XmlAttributeValue value = attribute.getValueElement(); assert value != null; holder.registerProblem(attribute, XmlAnalysisBundle.message("xml.inspections.unused.schema.declaration"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, false, !refCountHolder.isUsedNamespace(namespace))); XmlTag parent = attribute.getParent(); if (declaredPrefix.isEmpty()) { XmlAttribute location = getDefaultLocation(parent); if (location != null) { holder.registerProblem(location, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } else if (!refCountHolder.isUsedNamespace(namespace)) { for (PsiReference reference : getLocationReferences(namespace, parent)) { if (!XmlHighlightVisitor.hasBadResolve(reference, false)) holder.registerProblemForReference(reference, ProblemHighlightType.LIKE_UNUSED_SYMBOL, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } } } | visitXmlAttribute |
301,529 | void (PsiReference[] references) { if (references.length == 0) { return; } XmlAttributeValue element = (XmlAttributeValue)references[0].getElement(); XmlAttribute attribute = (XmlAttribute)element.getParent(); if (element.getReferences().length == references.length) { // all refs to be removed attribute.delete(); return; } PsiFile file = element.getContainingFile(); Project project = file.getProject(); SmartPsiElementPointer<XmlAttribute> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(attribute); for (PsiReference reference : references) { RemoveNamespaceDeclarationFix.removeReferenceText(reference); } // trimming the result PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); Document document = file.getViewProvider().getDocument(); assert document != null; documentManager.commitDocument(document); String trimmed = element.getValue().trim(); XmlAttribute pointerElement = pointer.getElement(); assert pointerElement != null; pointerElement.setValue(trimmed); } | removeReferencesOrAttribute |
301,530 | void (XmlAttribute attribute, ProblemsHolder holder, @NotNull XmlRefCountHolder refCountHolder) { if (XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(attribute.getNamespace())) { if (XmlUtil.NO_NAMESPACE_SCHEMA_LOCATION_ATT.equals(attribute.getLocalName())) { if (refCountHolder.isInUse("")) return; holder.registerProblem(attribute, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveNamespaceLocationFix("")); } else if (XmlUtil.SCHEMA_LOCATION_ATT.equals(attribute.getLocalName())) { XmlAttributeValue value = attribute.getValueElement(); if (value == null) return; PsiReference[] references = value.getReferences(); for (int i = 0, referencesLength = references.length; i < referencesLength; i++) { PsiReference reference = references[i]; if (reference instanceof URLReference) { String ns = getNamespaceFromReference(reference); if (ArrayUtil.indexOf(attribute.getParent().knownNamespaces(), ns) == -1 && !refCountHolder.isUsedNamespace(ns)) { if (!XmlHighlightVisitor.hasBadResolve(reference, false)) { holder.registerProblemForReference(reference, ProblemHighlightType.LIKE_UNUSED_SYMBOL, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), new RemoveNamespaceLocationFix(ns)); } for (int j = i + 1; j < referencesLength; j++) { PsiReference nextRef = references[j]; if (nextRef instanceof URLReference) break; if (!XmlHighlightVisitor.hasBadResolve(nextRef, false)) { holder.registerProblemForReference(nextRef, ProblemHighlightType.LIKE_UNUSED_SYMBOL, XmlAnalysisBundle.message("xml.inspections.unused.schema.location"), new RemoveNamespaceLocationFix(ns)); } } } } } } } } | checkUnusedLocations |
301,531 | String (XmlAttribute attribute) { return attribute.getName().contains(":") ? attribute.getLocalName() : ""; } | getDeclaredPrefix |
301,532 | XmlAttribute (XmlTag parent) { return parent.getAttribute(XmlUtil.NO_NAMESPACE_SCHEMA_LOCATION_ATT, XmlUtil.XML_SCHEMA_INSTANCE_URI); } | getDefaultLocation |
301,533 | PsiReference[] (String namespace, XmlTag tag) { XmlAttribute locationAttr = tag.getAttribute(XmlUtil.SCHEMA_LOCATION_ATT, XmlUtil.XML_SCHEMA_INSTANCE_URI); if (locationAttr == null) { return PsiReference.EMPTY_ARRAY; } XmlAttributeValue value = locationAttr.getValueElement(); return value == null ? PsiReference.EMPTY_ARRAY : getLocationReferences(namespace, value); } | getLocationReferences |
301,534 | PsiReference[] (String namespace, XmlAttributeValue value) { PsiReference[] references = value.getReferences(); for (int i = 0, referencesLength = references.length; i < referencesLength; i+=2) { PsiReference reference = references[i]; if (namespace.equals(getNamespaceFromReference(reference))) { if (i + 1 < referencesLength) { return new PsiReference[] { references[i + 1], reference }; } else { return new PsiReference[] { reference }; } } } return PsiReference.EMPTY_ARRAY; } | getLocationReferences |
301,535 | String (PsiReference reference) { return reference.getRangeInElement().substring(reference.getElement().getText()); } | getNamespaceFromReference |
301,536 | boolean () { return true; } | isEnabledByDefault |
301,537 | String () { return "XmlUnusedNamespaceDeclaration"; } | getShortName |
301,538 | String () { return getFamilyName(); } | getName |
301,539 | String () { return XmlAnalysisBundle.message("xml.quickfix.remove.unused.namespace.decl"); } | getFamilyName |
301,540 | void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { doFix(project, descriptor, true); } | applyFix |
301,541 | SmartPsiElementPointer<XmlTag> (Project project, ProblemDescriptor descriptor, boolean reformat) { PsiElement element = descriptor.getPsiElement(); if (element instanceof XmlAttributeValue) { element = element.getParent(); } else if (!(element instanceof XmlAttribute)) { return null; } XmlAttribute attribute = (XmlAttribute)element; XmlTag parent = attribute.getParent(); SmartPsiElementPointer<XmlTag> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(parent); doRemove(project, attribute, parent); if (reformat) { reformatStartTag(project, pointer); } return pointer; } | doFix |
301,542 | void (Project project, SmartPsiElementPointer<? extends XmlTag> pointer) { PsiDocumentManager manager = PsiDocumentManager.getInstance(project); PsiFile file = pointer.getContainingFile(); assert file != null; Document document = file.getViewProvider().getDocument(); assert document != null; manager.commitDocument(document); XmlTag tag = pointer.getElement(); assert tag != null; XmlUtil.reformatTagStart(tag); } | reformatStartTag |
301,543 | void (Project project, XmlAttribute attribute, XmlTag parent) { if (!attribute.isNamespaceDeclaration()) { SchemaPrefix schemaPrefix = DefaultXmlExtension.DEFAULT_EXTENSION.getPrefixDeclaration(parent, myPrefix); if (schemaPrefix != null) { attribute = schemaPrefix.getDeclaration(); } else { // declaration was already removed by previous fix in "Fix all" return; } } String namespace = attribute.getValue(); String prefix = getDeclaredPrefix(attribute); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); Document document = parent.getContainingFile().getViewProvider().getDocument(); assert document != null; attribute.delete(); if (myRemoveLocation) { if (prefix.isEmpty()) { XmlAttribute locationAttr = getDefaultLocation(parent); if (locationAttr != null) { locationAttr.delete(); } } else { documentManager.doPostponedOperationsAndUnblockDocument(document); PsiReference[] references = getLocationReferences(namespace, parent); removeReferencesOrAttribute(references); documentManager.commitDocument(document); } } } | doRemove |
301,544 | void (PsiReference ref) { PsiElement element = ref.getElement(); PsiFile file = element.getContainingFile(); TextRange range = ref.getRangeInElement().shiftRight(element.getTextRange().getStartOffset()); Document document = file.getViewProvider().getDocument(); assert document != null; PsiDocumentManager.getInstance(file.getProject()).doPostponedOperationsAndUnblockDocument(document); document.deleteString(range.getStartOffset(), range.getEndOffset()); } | removeReferenceText |
301,545 | boolean (Object obj) { return obj instanceof RemoveNamespaceDeclarationFix && Objects.equals(myPrefix, ((RemoveNamespaceDeclarationFix)obj).myPrefix) && (myLocationFix || ((RemoveNamespaceDeclarationFix)obj).myLocationFix); } | equals |
301,546 | int () { return myPrefix == null ? 0 : myPrefix.hashCode(); } | hashCode |
301,547 | String () { return XmlAnalysisBundle.message("xml.intention.remove.unused.namespace.location"); } | getName |
301,548 | void (Project project, XmlAttribute attribute, XmlTag parent) { if (StringUtil.isEmpty(myPrefix)) { attribute.delete(); } else { XmlAttributeValue value = attribute.getValueElement(); if (value == null) { return; } PsiReference[] references = getLocationReferences(myPrefix, value); removeReferencesOrAttribute(references); } } | doRemove |
301,549 | boolean (Object obj) { return this == obj; } | equals |
301,550 | PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { Pattern pattern = Pattern.compile(regexp); return new XmlElementVisitor() { @Override public void visitXmlTag(@NotNull XmlTag tag) { if (checkDeprecated(tag.getDescriptor(), pattern)) { ASTNode nameNode = XmlChildRole.START_TAG_NAME_FINDER.findChild(tag.getNode()); if (nameNode != null) { holder.registerProblem(nameNode.getPsi(), XmlAnalysisBundle.message("xml.inspections.the.tag.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } } @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { if (checkDeprecated(attribute.getDescriptor(), pattern)) { holder.registerProblem(attribute.getNameElement(), XmlAnalysisBundle.message( "xml.inspections.the.attribute.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } }; } | buildVisitor |
301,551 | void (@NotNull XmlTag tag) { if (checkDeprecated(tag.getDescriptor(), pattern)) { ASTNode nameNode = XmlChildRole.START_TAG_NAME_FINDER.findChild(tag.getNode()); if (nameNode != null) { holder.registerProblem(nameNode.getPsi(), XmlAnalysisBundle.message("xml.inspections.the.tag.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } } | visitXmlTag |
301,552 | void (@NotNull XmlAttribute attribute) { if (checkDeprecated(attribute.getDescriptor(), pattern)) { holder.registerProblem(attribute.getNameElement(), XmlAnalysisBundle.message( "xml.inspections.the.attribute.is.marked.as.deprecated"), ProblemHighlightType.LIKE_DEPRECATED); } } | visitXmlAttribute |
301,553 | OptPane () { return pane( string("regexp", XmlAnalysisBundle.message("xml.options.label.regexp"), 30, new RegexValidator()) ); } | getOptionsPane |
301,554 | boolean (@Nullable PsiMetaData metaData, Pattern pattern) { if (metaData == null) return false; if (metaData instanceof XmlDeprecationOwnerDescriptor) { return ((XmlDeprecationOwnerDescriptor)metaData).isDeprecated(); } PsiElement declaration = metaData.getDeclaration(); if (!(declaration instanceof XmlTag tag)) return false; XmlComment comment = XmlUtil.findPreviousComment(declaration); if (comment != null && pattern.matcher(comment.getCommentText().trim()).matches()) return true; return checkTag(ArrayUtil.getFirstElement(tag.findSubTags("annotation", tag.getNamespace())), pattern); } | checkDeprecated |
301,555 | boolean (XmlTag tag, Pattern pattern) { if (tag == null) return false; if ("documentation".equals(tag.getLocalName())) { String text = tag.getValue().getTrimmedText(); return pattern.matcher(text).matches(); } for (XmlTag subTag : tag.getSubTags()) { if (checkTag(subTag, pattern)) return true; } return false; } | checkTag |
301,556 | PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new XmlElementVisitor() { private Boolean isXml; private boolean isXmlFile(XmlElement element) { if (isXml == null) { final PsiFile file = element.getContainingFile(); isXml = file instanceof XmlFile && !InjectedLanguageManager.getInstance(element.getProject()).isInjectedFragment(file); } return isXml.booleanValue(); } @Override public void visitXmlToken(final @NotNull XmlToken token) { if (isXmlFile(token) && token.getTokenType() == XmlTokenType.XML_NAME) { PsiElement element = token.getPrevSibling(); while(element instanceof PsiWhiteSpace) element = element.getPrevSibling(); if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_START_TAG_START) { PsiElement parent = element.getParent(); if (parent instanceof XmlTag tag && !(token.getNextSibling() instanceof OuterLanguageElement)) { checkUnboundNamespacePrefix(tag, tag, tag.getNamespacePrefix(), token, holder, isOnTheFly); } } } } @Override public void visitXmlAttribute(final @NotNull XmlAttribute attribute) { if (!isXmlFile(attribute)) { return; } final String namespace = attribute.getNamespace(); if (attribute.isNamespaceDeclaration() || XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(namespace)) { return; } XmlTag tag = attribute.getParent(); if (tag == null) return; XmlElementDescriptor elementDescriptor = tag.getDescriptor(); if (elementDescriptor == null || elementDescriptor instanceof AnyXmlElementDescriptor) { return; } final String name = attribute.getName(); checkUnboundNamespacePrefix(attribute, tag, XmlUtil.findPrefixByQualifiedName(name), null, holder, isOnTheFly); } @Override public void visitXmlAttributeValue(@NotNull XmlAttributeValue value) { PsiReference[] references = value.getReferences(); for (PsiReference reference : references) { if (reference instanceof SchemaPrefixReference) { if (!XML.equals(((SchemaPrefixReference)reference).getNamespacePrefix()) && reference.resolve() == null) { holder.registerProblem(reference, XmlAnalysisBundle.message("xml.inspections.unbound.namespace", ((SchemaPrefixReference)reference).getNamespacePrefix()), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } } }; } | buildVisitor |
301,557 | boolean (XmlElement element) { if (isXml == null) { final PsiFile file = element.getContainingFile(); isXml = file instanceof XmlFile && !InjectedLanguageManager.getInstance(element.getProject()).isInjectedFragment(file); } return isXml.booleanValue(); } | isXmlFile |
301,558 | void (final @NotNull XmlToken token) { if (isXmlFile(token) && token.getTokenType() == XmlTokenType.XML_NAME) { PsiElement element = token.getPrevSibling(); while(element instanceof PsiWhiteSpace) element = element.getPrevSibling(); if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_START_TAG_START) { PsiElement parent = element.getParent(); if (parent instanceof XmlTag tag && !(token.getNextSibling() instanceof OuterLanguageElement)) { checkUnboundNamespacePrefix(tag, tag, tag.getNamespacePrefix(), token, holder, isOnTheFly); } } } } | visitXmlToken |
301,559 | void (final @NotNull XmlAttribute attribute) { if (!isXmlFile(attribute)) { return; } final String namespace = attribute.getNamespace(); if (attribute.isNamespaceDeclaration() || XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(namespace)) { return; } XmlTag tag = attribute.getParent(); if (tag == null) return; XmlElementDescriptor elementDescriptor = tag.getDescriptor(); if (elementDescriptor == null || elementDescriptor instanceof AnyXmlElementDescriptor) { return; } final String name = attribute.getName(); checkUnboundNamespacePrefix(attribute, tag, XmlUtil.findPrefixByQualifiedName(name), null, holder, isOnTheFly); } | visitXmlAttribute |
301,560 | void (@NotNull XmlAttributeValue value) { PsiReference[] references = value.getReferences(); for (PsiReference reference : references) { if (reference instanceof SchemaPrefixReference) { if (!XML.equals(((SchemaPrefixReference)reference).getNamespacePrefix()) && reference.resolve() == null) { holder.registerProblem(reference, XmlAnalysisBundle.message("xml.inspections.unbound.namespace", ((SchemaPrefixReference)reference).getNamespacePrefix()), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } } | visitXmlAttributeValue |
301,561 | void (final XmlElement element, final XmlTag context, String namespacePrefix, final XmlToken token, final ProblemsHolder holder, boolean isOnTheFly) { if (namespacePrefix.isEmpty() && (!(element instanceof XmlTag) || !(element.getParent() instanceof XmlDocument)) || XML.equals(namespacePrefix)) { return; } final String namespaceByPrefix = context.getNamespaceByPrefix(namespacePrefix); if (!namespaceByPrefix.isEmpty()) { return; } PsiFile psiFile = context.getContainingFile(); if (!(psiFile instanceof XmlFile containingFile)) return; if (!HighlightingLevelManager.getInstance(containingFile.getProject()).shouldInspect(containingFile)) return; final XmlExtension extension = XmlExtension.getExtension(containingFile); if (extension.getPrefixDeclaration(context, namespacePrefix) != null) { return; } final String localizedMessage = isOnTheFly ? XmlAnalysisBundle.message("xml.inspections.unbound.namespace", namespacePrefix) : XmlAnalysisBundle .message("xml.inspections.unbound.namespace.no.param"); if (namespacePrefix.isEmpty()) { final XmlTag tag = (XmlTag)element; if (!XmlUtil.JSP_URI.equals(tag.getNamespace()) && isOnTheFly) { LocalQuickFix fix = XmlQuickFixFactory.getInstance().createNSDeclarationIntentionFix(context, namespacePrefix, token); reportTagProblem(tag, localizedMessage, null, ProblemHighlightType.INFORMATION, fix, holder); } return; } final int prefixLength = namespacePrefix.length(); final TextRange range = new TextRange(0, prefixLength); final HighlightInfoType infoType = extension.getHighlightInfoType(containingFile); final ProblemHighlightType highlightType = infoType == HighlightInfoType.ERROR ? ProblemHighlightType.ERROR : ProblemHighlightType.LIKE_UNKNOWN_SYMBOL; if (isSuppressedFor(element)) return; if (element instanceof XmlTag) { LocalQuickFix fix = isOnTheFly ? XmlQuickFixFactory.getInstance().createNSDeclarationIntentionFix(context, namespacePrefix, token) : null; reportTagProblem(element, localizedMessage, range, highlightType, fix, holder); } else if (element instanceof XmlAttribute attribute) { LocalQuickFix fix = isOnTheFly ? XmlQuickFixFactory.getInstance().createNSDeclarationIntentionFix(element, namespacePrefix, token) : null; holder.registerProblem(attribute.getNameElement(), localizedMessage, highlightType, range, fix); } else { holder.registerProblem(element, localizedMessage, highlightType, range); } } | checkUnboundNamespacePrefix |
301,562 | void (final XmlElement element, final @InspectionMessage String localizedMessage, final TextRange range, final ProblemHighlightType highlightType, final LocalQuickFix fix, final ProblemsHolder holder) { XmlToken nameToken = XmlTagUtil.getStartTagNameElement((XmlTag)element); if (nameToken != null) { holder.registerProblem(nameToken, localizedMessage, highlightType, range, fix); } nameToken = XmlTagUtil.getEndTagNameElement((XmlTag)element); if (nameToken != null) { holder.registerProblem(nameToken, localizedMessage, highlightType, range, fix); } } | reportTagProblem |
301,563 | boolean () { return true; } | isEnabledByDefault |
301,564 | String () { return "XmlUnboundNsPrefix"; } | getShortName |
301,565 | PsiElement (PsiElement element) { if (element instanceof XmlTag tag) { XmlAttribute attribute = tag.getAttribute(IdReferenceProvider.ID_ATTR_NAME, null); if (!myIdAttrsOnly) { if (attribute == null) { attribute = tag.getAttribute(IdReferenceProvider.NAME_ATTR_NAME, null); } if (attribute == null) { attribute = tag.getAttribute(IdReferenceProvider.STYLE_ID_ATTR_NAME, null); } } return attribute != null ? attribute.getValueElement() : getImplicitIdRefValueElement(tag); } else { return element; } } | getIdValueElement |
301,566 | String (final PsiElement element) { if (element instanceof XmlTag tag) { String s = tag.getAttributeValue(IdReferenceProvider.ID_ATTR_NAME); if (!myIdAttrsOnly) { if (s == null) s = tag.getAttributeValue(IdReferenceProvider.NAME_ATTR_NAME); if (s == null) s = tag.getAttributeValue(IdReferenceProvider.STYLE_ID_ATTR_NAME); } return s != null ? s: getImplicitIdRefValue(tag); } else if (element instanceof PsiComment) { return getImplicitIdValue((PsiComment) element); } return null; } | getIdValue |
301,567 | XmlAttribute (@NotNull XmlTag tag) { for (ImplicitIdRefProvider idRefProvider : ImplicitIdRefProvider.EXTENSION_POINT_NAME.getExtensionList()) { XmlAttribute value = idRefProvider.getIdRefAttribute(tag); if (value != null) return value; } return null; } | getImplicitIdRefAttr |
301,568 | XmlAttributeValue (@NotNull XmlTag tag) { for (ImplicitIdRefProvider idRefProvider : ImplicitIdRefProvider.EXTENSION_POINT_NAME.getExtensionList()) { XmlAttribute value = idRefProvider.getIdRefAttribute(tag); if (value != null) return value.getValueElement(); } return null; } | getImplicitIdRefValueElement |
301,569 | String (@NotNull XmlTag tag) { XmlAttributeValue attribute = getImplicitIdRefValueElement(tag); return attribute != null ? attribute.getValue() : null; } | getImplicitIdRefValue |
301,570 | boolean (final XmlTag subTag) { return subTag.getAttributeValue(IdReferenceProvider.ID_ATTR_NAME) != null || subTag.getAttributeValue(IdReferenceProvider.FOR_ATTR_NAME) != null || getImplicitIdRefValue(subTag) != null || (subTag.getAttributeValue(IdReferenceProvider.NAME_ATTR_NAME) != null && !subTag.getName().contains(".directive")); } | isAcceptableTagType |
301,571 | List<PsiElement> (PsiFile file) { final List<PsiElement> result = new ArrayList<>(); file.accept(new XmlRecursiveElementVisitor(true) { @Override public void visitXmlTag(@NotNull XmlTag tag) { if (isAcceptableTagType(tag)) result.add(tag); super.visitXmlTag(tag); } @Override public void visitComment(@NotNull final PsiComment comment) { if (isDeclarationComment(comment)) result.add(comment); super.visitComment(comment); } @Override public void visitXmlComment(final @NotNull XmlComment comment) { if (isDeclarationComment(comment)) result.add(comment); super.visitComment(comment); } }); return result; } | doCompute |
301,572 | void (@NotNull XmlTag tag) { if (isAcceptableTagType(tag)) result.add(tag); super.visitXmlTag(tag); } | visitXmlTag |
301,573 | void (@NotNull final PsiComment comment) { if (isDeclarationComment(comment)) result.add(comment); super.visitComment(comment); } | visitComment |
301,574 | void (final @NotNull XmlComment comment) { if (isDeclarationComment(comment)) result.add(comment); super.visitComment(comment); } | visitXmlComment |
301,575 | Key<CachedValue<List<PsiElement>>> () { return ourCachedIdsValueKey; } | getKey |
301,576 | boolean (@NotNull final PsiComment comment) { return comment.getText().contains("@declare id="); } | isDeclarationComment |
301,577 | String (@NotNull final PsiComment comment) { return XmlDeclareIdInCommentAction.getImplicitlyDeclaredId(comment); } | getImplicitIdValue |
301,578 | void (PsiElementProcessor<? super PsiElement> processor) { final PsiFile psiFile = getElement().getContainingFile(); process(processor, psiFile); } | process |
301,579 | void (final PsiElementProcessor<? super PsiElement> processor, PsiFile file) { for (PsiElement e : ourCachedIdsCache.compute(file)) { if (!processor.execute(e)) return; } } | process |
301,580 | PsiElement () { final PsiElement[] result = new PsiElement[1]; process(new PsiElementProcessor<>() { final String canonicalText = getCanonicalText(); @Override public boolean execute(@NotNull final PsiElement element) { final String idValue = getIdValue(element); if (idValue != null && idValue.equals(canonicalText)) { result[0] = getIdValueElement(element); return false; } return true; } }); return result[0]; } | resolve |
301,581 | boolean (@NotNull final PsiElement element) { final String idValue = getIdValue(element); if (idValue != null && idValue.equals(canonicalText)) { result[0] = getIdValueElement(element); return false; } return true; } | execute |
301,582 | boolean (@NotNull final PsiElement element) { String value = getIdValue(element); if (value != null) { result.add(value); } return true; } | execute |
301,583 | boolean () { return false; } | isSoft |
301,584 | String[] () { return new String[]{FOR_ATTR_NAME, ID_ATTR_NAME, NAME_ATTR_NAME,STYLE_ID_ATTR_NAME}; } | getIdForAttributeNames |
301,585 | ElementFilter () { return new ElementFilter() { @Override public boolean isAcceptable(Object element, PsiElement context) { final PsiElement grandParent = ((PsiElement)element).getParent().getParent(); if (grandParent instanceof XmlTag tag) { if (!tag.getNamespacePrefix().isEmpty()) { return true; } } return false; } @Override public boolean isClassAcceptable(Class hintClass) { return true; } }; } | getIdForFilter |
301,586 | boolean (Object element, PsiElement context) { final PsiElement grandParent = ((PsiElement)element).getParent().getParent(); if (grandParent instanceof XmlTag tag) { if (!tag.getNamespacePrefix().isEmpty()) { return true; } } return false; } | isAcceptable |
301,587 | boolean (Class hintClass) { return true; } | isClassAcceptable |
301,588 | boolean () { final XmlAttributeDescriptor descriptor = ((XmlAttribute)parentElement).getDescriptor(); return descriptor != null && !descriptor.hasIdRefType(); } | isSoft |
301,589 | boolean (@NotNull PsiElement element) { for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof OuterLanguageElement) { return true; } } return false; } | hasOuterLanguageElement |
301,590 | boolean () { return mySoft; } | isSoft |
301,591 | CachedValue<XmlRefCountHolder> (final XmlFile file, final Object p) { return CachedValuesManager.getManager(file.getProject()).createCachedValue(() -> { final XmlRefCountHolder holder = new XmlRefCountHolder(); final Language language = file.getViewProvider().getBaseLanguage(); final PsiFile psiFile = file.getViewProvider().getPsi(language); assert psiFile != null; psiFile.accept(new IdGatheringRecursiveVisitor(holder)); return new CachedValueProvider.Result<>(holder, file); }, false); } | compute |
301,592 | XmlRefCountHolder (@NotNull XmlFile file) { return CACHE.get(xmlRefCountHolderKey, file, null).getValue(); } | getRefCountHolder |
301,593 | boolean (@NotNull final XmlAttributeValue value) { return myPossiblyDuplicateIds.contains(value); } | isDuplicateIdAttributeValue |
301,594 | boolean (@Nullable final PsiElement element) { return !myDoNotValidateParentsList.contains(element); } | isValidatable |
301,595 | boolean (@NotNull final String idRef) { return myId2AttributeListMap.get(idRef) != null || myAdditionallyDeclaredIds.contains(idRef); } | hasIdDeclaration |
301,596 | boolean (@NotNull final XmlAttributeValue value) { return myIdReferences.contains(value); } | isIdReferenceValue |
301,597 | void (@NotNull final String id, @NotNull final XmlAttributeValue attributeValue, final boolean soft) { List<Pair<XmlAttributeValue, Boolean>> list = myId2AttributeListMap.get(id); if (list == null) { list = new ArrayList<>(); myId2AttributeListMap.put(id, list); } else if (!soft) { final boolean html = HtmlUtil.isHtmlFile(attributeValue); final boolean html5 = HtmlUtil.isHtml5Context(attributeValue); // mark as duplicate List<XmlAttributeValue> notSoft = ContainerUtil.mapNotNull(list, (NullableFunction<Pair<XmlAttributeValue, Boolean>, XmlAttributeValue>)pair -> { if (html5 && !"id".equalsIgnoreCase(((XmlAttribute)pair.first.getParent()).getName())) { // according to HTML 5 (http://www.w3.org/TR/html5/dom.html#the-id-attribute) spec // only id attribute is unique identifier return null; } if (html && pair.first.getParent().getParent() == attributeValue.getParent().getParent()) { // according to HTML 4 (http://www.w3.org/TR/html401/struct/global.html#adef-id, // http://www.w3.org/TR/html401/struct/links.html#h-12.2.3) spec id and name occupy // same namespace, but having same values on one tag is ok return null; } return pair.second ? null : pair.first; }); if (!notSoft.isEmpty()) { myPossiblyDuplicateIds.addAll(notSoft); myPossiblyDuplicateIds.add(attributeValue); } } list.add(new Pair<>(attributeValue, soft)); } | registerId |
301,598 | void (@NotNull final String id) { myAdditionallyDeclaredIds.add(id); } | registerAdditionalId |
301,599 | void (@NotNull final XmlAttributeValue value) { myIdReferences.add(value); } | registerIdReference |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.