Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
304,200
boolean (@NotNull PsiElement parent) { return !(parent instanceof XmlAttribute); }
isAcceptableNamedParent
304,201
boolean (final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile psiFile) { return completeEndTag(project, editor, psiFile); }
process
304,202
boolean (Project project, Editor editor, PsiFile psiFile) { final PsiElement atCaret = getStatementAtCaret(editor, psiFile); XmlTag tagAtCaret = PsiTreeUtil.getParentOfType(atCaret, XmlTag.class); if (tagAtCaret == null) { return false; } try { final ASTNode emptyTagEnd = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag...
completeEndTag
304,203
boolean (int caretAt, int probableCommaOffset) { return probableCommaOffset > caretAt; }
shouldAfterWrapTextWithTag
304,204
void (Project project, Editor editor, PsiFile psiFile, int caretOffset, @Nullable XmlTag tagToReformat) { if (isUncommited(project)) { commit(editor); if (tagToReformat == null) { tagToReformat = PsiTreeUtil.getParentOfType(getStatementAtCaret(editor, psiFile), XmlTag.class); } editor.getCaretModel().moveToOffset(caret...
commitChanges
304,205
boolean (PsiElement lastChild) { //strange approach, but it's universal for xml and html return lastChild != null && lastChild.getNode().getElementType() != XmlTokenType.XML_TAG_END && lastChild.getNode().getElementType() != XmlTokenType.XML_EMPTY_ELEMENT_END; }
isTagUnclosed
304,206
boolean (final XmlAttribute xmlAttribute, final XmlTag tagAtCaret) { return xmlAttribute == null || getClosingQuote(xmlAttribute).length() != 0; }
shouldInsertClosingTag
304,207
String (final XmlAttribute xmlAttribute, final XmlTag tagAtCaret, final boolean emptyTag) { return getClosingQuote(xmlAttribute) + (emptyTag ? CheckEmptyTagInspection.isTagWithEmptyEndNotAllowed(tagAtCaret) ? "></" + tagAtCaret.getName() + ">" : "/>" : ">"); }
getClosingPart
304,208
CharSequence (final @Nullable XmlAttribute attribute) { if (attribute == null) { return ""; } final XmlAttributeValue element = attribute.getValueElement(); if (element == null) { return ""; } final String s = element.getText(); if (s != null && s.length() > 0) { if (s.charAt(0) == '"' && s.charAt(s.length() - 1) != '"...
getClosingQuote
304,209
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); if (position.getNode().getElementType() != XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN) return; XmlAttribute attr = PsiTreeUtil.getParentOfType(position...
addCompletions
304,210
void (CompletionParameters parameters, final CompletionResultSet result, PsiElement element) { if (!XmlCompletionContributor.isXmlNameCompletion(parameters)) { return; } result.stopHere(); if (!(element.getParent() instanceof XmlTag tag)) { return; } final XmlTag parentTag = tag.getParentTag(); if (parentTag == null) r...
complete
304,211
void (@NotNull XmlElementDescriptor descriptor, CompletionResultSet result) { XmlTagInsertHandler insertHandler = XmlTagInsertHandler.INSTANCE; if (descriptor instanceof XmlElementDescriptorImpl) { String name = descriptor.getName(); if (name != null) { insertHandler = new ExtendedTagInsertHandler(name, ((XmlElementDes...
addElementToResult
304,212
LookupElementBuilder (@NotNull XmlElementDescriptor descriptor) { LookupElementBuilder builder = LookupElementBuilder.create(descriptor.getName()); if (descriptor instanceof XmlElementDescriptorImpl) { builder = builder.withTypeText(((XmlElementDescriptorImpl)descriptor).getNamespace(), true); } return builder; }
createLookupElement
304,213
void (@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); if (item.getObject().toString().startsWith("<!")) { context.commitDocument(); int caretOffset = context.getEditor().getCaretModel().getOffset(); PsiElement tag = PsiTreeUtil.getParentOfType(context.getFile().findE...
handleInsert
304,214
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); PsiElement prev = PsiTreeUtil.prevVisibleLeaf(position); if (prev != null && hasDtdKeywordCompletion(prev)) { addKeywordCompletions(result.withPrefix...
addCompletions
304,215
String (@NotNull PsiElement position, @NotNull String prefix) { final PsiElement prevLeaf = PsiTreeUtil.prevLeaf(position); final PsiElement prevPrevLeaf = prevLeaf != null ? PsiTreeUtil.prevLeaf(prevLeaf):null; if (prevLeaf != null) { final String prevLeafText = prevLeaf.getText(); if("#".equals(prevLeafText)) { prefi...
keywordPrefix
304,216
void (@NotNull CompletionResultSet result) { for (String keyword : KEYWORDS) { result.addElement(LookupElementBuilder.create(keyword).withInsertHandler(INSERT_HANDLER)); } }
addKeywordCompletions
304,217
void (final @NotNull CompletionResultSet result, PsiElement position) { final PsiElementProcessor processor = new PsiElementProcessor() { @Override public boolean execute(final @NotNull PsiElement element) { if (element instanceof XmlEntityDecl xmlEntityDecl) { String name = xmlEntityDecl.getName(); if (name != null &&...
addEntityCompletions
304,218
boolean (final @NotNull PsiElement element) { if (element instanceof XmlEntityDecl xmlEntityDecl) { String name = xmlEntityDecl.getName(); if (name != null && xmlEntityDecl.isInternalReference()) { result.addElement(LookupElementBuilder.create(name).withInsertHandler(XmlCompletionContributor.ENTITY_INSERT_HANDLER)); } ...
execute
304,219
boolean (@NotNull PsiElement prev) { return prev.textMatches("#") || prev.textMatches("!") || prev.textMatches("(") || prev.textMatches(",") || prev.textMatches("|") || prev.textMatches("[") || prev.getNode().getElementType() == XmlTokenType.XML_NAME; }
hasDtdKeywordCompletion
304,220
void (final @NotNull InsertionContext context, final @NotNull LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); final int caretOffset = editor.getCaretModel().getOffset(); final PsiFile file = context.getFile(); final CharSequence chars = document.getCharsS...
handleInsert
304,221
void (@NotNull String namespacePrefix, @NotNull PsiElement context) { final PsiElement parent = context.getParent(); if (parent instanceof XmlAttribute attribute) { final String prefix = attribute.getNamespacePrefix(); if (!prefix.equals(namespacePrefix) && StringUtil.isNotEmpty(namespacePrefix)) { final String name = ...
qualifyWithPrefix
304,222
String (@NotNull String basePrefix, @NotNull XmlTag context) { if (context.getNamespaceByPrefix(basePrefix).isEmpty()) { return basePrefix; } int i = 1; while (!context.getNamespaceByPrefix(basePrefix + i).isEmpty()) { i++; } return basePrefix + i; }
makePrefixUnique
304,223
boolean (final @NotNull PsiFile file) { return file instanceof HtmlFileImpl; }
isEnabledInFile
304,224
void (@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); Document document = editor.getDocument(); Project project = context.getProject(); if (item instanceof LookupElementDecorator) { ((LookupElementDecorator<?>)item).getDelegate().handleInsert(context); } PsiDocumen...
handleInsert
304,225
boolean (Lookup lookup) { if (!lookup.isCompletion()) return false; PsiElement psiElement = lookup.getPsiElement(); PsiFile file = lookup.getPsiFile(); if (!(file instanceof XmlFile) && psiElement != null) { file = psiElement.getContainingFile(); } if (file instanceof XmlFile) { if (psiElement != null) { PsiElement ele...
isInXmlContext
304,226
boolean (Lookup lookup) { if (isInXmlContext(lookup)) { PsiElement psiElement = lookup.getPsiElement(); final PsiElement parentElement = psiElement != null ? psiElement.getParent() : null; if (parentElement instanceof XmlTag) return true; if (parentElement instanceof PsiErrorElement && parentElement.getParent() instanc...
isWithinTag
304,227
Result (char c, final int prefixLength, final Lookup lookup) { if (!isInXmlContext(lookup)) return null; if (Character.isJavaIdentifierPart(c)) return Result.ADD_TO_PREFIX; switch(c){ case '-': case ':': case '?': return Result.ADD_TO_PREFIX; case '/': if (isWithinTag(lookup)) { if (prefixLength > 0) { return Result.SE...
acceptChar
304,228
void (@NotNull InsertionContext context, @NotNull LookupElement item) { Project project = context.getProject(); Editor editor = context.getEditor(); int startOffset = context.getStartOffset(); Document document = InjectedLanguageUtil.getTopLevelEditor(editor).getDocument(); Ref<PsiElement> currentElementRef = Ref.creat...
handleInsert
304,229
void (char completionChar, final Editor editor, XmlTag tag) { XmlTag originalElement = CompletionUtil.getOriginalElement(tag); XmlElementDescriptor descriptor = originalElement != null ? originalElement.getDescriptor() : tag.getDescriptor(); if (descriptor == null) return; final Project project = editor.getProject(); T...
insertIncompleteTag
304,230
void (Template template) { int offset = editor.getCaretModel().getOffset(); myAttrValueMarker = editor.getDocument().createRangeMarker(offset + 1, offset + 4); }
waitingForInput
304,231
void (final @NotNull Template template, boolean brokenOff) { final int offset = editor.getCaretModel().getOffset(); if (chooseAttributeName && offset > 0) { char c = editor.getDocument().getCharsSequence().charAt(offset - 1); if (c == '/' || (c == ' ' && brokenOff)) { WriteCommandAction.writeCommandAction(project).run(...
templateFinished
304,232
void (final Template template) { if (myAttrValueMarker == null) { return; } if (UndoManager.getInstance(project).isUndoOrRedoInProgress()) { return; } if (chooseAttributeName && myAttrValueMarker.isValid()) { final int startOffset = myAttrValueMarker.getStartOffset(); final int endOffset = myAttrValueMarker.getEndOffse...
templateCancelled
304,233
boolean (char completionChar, XmlElementDescriptor descriptor, boolean isHtmlCode, XmlTag tag, Template template, StringBuilder indirectRequiredAttrs) { if (completionChar == '>' || (completionChar == '/' && indirectRequiredAttrs != null)) { template.addTextSegment(">"); if (indirectRequiredAttrs != null) template.addT...
addTail
304,234
String (XmlTag tag) { CodeStyleSettings settings = CodeStyle.getSettings(tag.getContainingFile()); boolean html = HtmlUtil.isHtmlTag(tag); boolean needsSpace = (html && settings.getCustomSettings(HtmlCodeStyleSettings.class).HTML_SPACE_INSIDE_EMPTY_TAG) || (!html && settings.getCustomSettings(XmlCodeStyleSettings.class...
closeTag
304,235
void (PsiFile file, Template template) { template.addTextSegment(" "); template.addVariable(new MacroCallNode(new CompleteMacro()), true); template.addTextSegment("=" + XmlEditUtil.getAttributeQuote(file)); template.addEndVariable(); template.addTextSegment(XmlEditUtil.getAttributeQuote(file)); }
completeAttribute
304,236
boolean (XmlTag tag) { for (XmlTagRuleProvider ruleProvider : XmlTagRuleProvider.EP_NAME.getExtensionList()) { for (XmlTagRuleProvider.Rule rule : ruleProvider.getTagRule(tag)) { if (rule.needAtLeastOneAttribute(tag)) { return true; } } } return false; }
needAtLeastOneAttribute
304,237
boolean (Template template, XmlElementDescriptor descriptor, PsiFile file, XmlTag context) { if (!WebEditorOptions.getInstance().isAutomaticallyInsertRequiredSubTags()) return false; List<XmlElementDescriptor> requiredSubTags = GenerateXmlTagAction.getRequiredSubTags(descriptor); if (!requiredSubTags.isEmpty()) { templ...
addRequiredSubTags
304,238
void (Template template, XmlElementDescriptor descriptor, PsiFile file, XmlTag context, boolean firstLevel) { boolean completeIt = (!firstLevel || !canHaveAttributes(descriptor, context)) && (file == null || XmlExtension.getExtension(file).shouldCompleteTag(context)); switch (descriptor.getContentType()) { case XmlElem...
completeTagTail
304,239
boolean (XmlElementDescriptor descriptor, XmlTag tag) { return ContainerUtil.find(descriptor.getAttributesDescriptors(tag), attr -> attr instanceof HtmlAttributeDescriptorImpl && HtmlUtil.isOwnHtmlAttribute(attr)) != null; }
hasOwnAttributes
304,240
boolean (XmlElementDescriptor descriptor, XmlTag context) { XmlAttributeDescriptor[] attributes = descriptor.getAttributesDescriptors(context); int required = WebEditorOptions.getInstance().isAutomaticallyInsertRequiredAttributes() ? ArraysKt.count(attributes, (attribute) -> attribute.isRequired() && context.getAttribu...
canHaveAttributes
304,241
void (Template template, XmlElementDescriptor descriptor, XmlTag context) { template.addTextSegment("</" + descriptor.getName(context) + ">"); }
addTagEnd
304,242
boolean (final XmlTag tag) { final String ns = tag.getNamespace(); return XmlUtil.XHTML_URI.equals(ns) || XmlUtil.HTML_URI.equals(ns); }
isTagFromHtml
304,243
void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset()); if (reference instanceof URLReference) { if (((URLReference)reference).isSchemaLocation()) { Object[] objects = completeSc...
fillCompletionVariants
304,244
Object[] (PsiElement myElement) { final XmlFile file = (XmlFile)myElement.getContainingFile(); PsiElement parent = myElement.getParent(); Set<String> list = new HashSet<>(); for (XmlSchemaProvider provider : XmlSchemaProvider.EP_NAME.getExtensionList()) { if (provider.isAvailable(file)) { list.addAll(provider.getAvaila...
completeNamespace
304,245
Object[] (PsiElement element) { XmlTag tag = (XmlTag)element.getParent().getParent(); XmlAttribute[] attributes = tag.getAttributes(); final PsiReference[] refs = element.getReferences(); return ContainerUtil.mapNotNull(attributes, attribute -> { final String attributeValue = attribute.getValue(); return attributeValue...
completeSchemaLocation
304,246
ThreeState (@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { if (HtmlCompletionContributor.isHtmlElementInTextCompletionAutoPopupEnabledForFile(psiFile)) { return notAfterASpace(psiFile, offset); } return shouldSkipAutopopupInHtml(contextElement, offset) ? ThreeState.YES : ThreeState.UNSURE; ...
shouldSkipAutopopup
304,247
ThreeState (PsiFile file, int offset) { if (offset <= 0 || file.getText().charAt(offset - 1) != ' ') { return ThreeState.UNSURE; } return ThreeState.YES; }
notAfterASpace
304,248
boolean (@NotNull PsiElement contextElement, int offset) { ASTNode node = contextElement.getNode(); if (node != null && node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS) { PsiElement parent = contextElement.getParent(); if (parent instanceof XmlText || parent instanceof XmlDocument) { String contextElementText...
shouldSkipAutopopupInHtml
304,249
LookupElement[] (final @NotNull XmlTag tag, final String prefix) { List<LookupElement> elements = new ArrayList<>(); for (XmlTagNameProvider tagNameProvider : XmlTagNameProvider.EP_NAME.getExtensionList()) { tagNameProvider.addTagNameVariants(elements, tag, prefix); } return elements.toArray(LookupElement.EMPTY_ARRAY);...
getTagNameVariants
304,250
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, final @NotNull CompletionResultSet result) { LegacyCompletionContributor.processReferences(parameters, result, (reference, set) -> { if (reference instanceof TagNameReference) { collectCompletionVariants((TagNameReference)reference, set...
addCompletions
304,251
void (TagNameReference tagNameReference, Consumer<? super LookupElement> consumer) { PsiElement element = tagNameReference.getElement(); if (element instanceof XmlTag) { if (!tagNameReference.isStartTagFlag()) { for (LookupElement variant : createClosingTagLookupElements((XmlTag)element, false, tagNameReference.getName...
collectCompletionVariants
304,252
List<LookupElement> (XmlTag tag, boolean includePrefix, ASTNode nameElement) { List<LookupElement> result = new ArrayList<>(); while (tag != null) { LookupElementBuilder builder = LookupElementBuilder.create(includePrefix || !nameElement.getText().contains(":") ? tag.getName() : tag.getLocalName()); result.add(LookupEl...
createClosingTagLookupElements
304,253
void (@NotNull InsertionContext context, @NotNull LookupElementDecorator<LookupElement> item) { final char completionChar = context.getCompletionChar(); if (completionChar == '\'' || completionChar == '\"') { context.setAddCompletionChar(false); item.getDelegate().handleInsert(context); final Editor editor = context.ge...
handleInsert
304,254
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); IElementType type = position.getNode().getElementType(); if (type != XmlTokenType.XML_DATA_CHARACTERS && type != XmlTokenType.XML_ATTRIBUTE_VALUE_TOK...
addCompletions
304,255
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, final @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); if (!position.getLanguage().isKindOf(XMLLanguage.INSTANCE)) { return; } final XmlAttributeValue attributeValue = PsiTreeUtil.getParentOfT...
addCompletions
304,256
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { XmlTag tag = PsiTreeUtil.getParentOfType(parameters.getPosition(), XmlTag.class, false); if (tag != null && !hasEnumerationReference(parameters, result)) { final XmlTag simpleContent = XmlUtil.getS...
addCompletions
304,257
boolean (CompletionParameters parameters, CompletionResultSet result) { Ref<Boolean> hasRef = Ref.create(false); LegacyCompletionContributor.processReferences(parameters, result, (reference, resultSet) -> { if (reference instanceof XmlEnumeratedValueReference) { hasRef.set(true); } }); return hasRef.get(); }
hasEnumerationReference
304,258
boolean (final CompletionParameters parameters) { final ASTNode node = parameters.getPosition().getNode(); return node != null && node.getElementType() == XmlTokenType.XML_NAME; }
isXmlNameCompletion
304,259
void (final @NotNull CompletionParameters parameters, final @NotNull CompletionResultSet result) { super.fillCompletionVariants(parameters, result); if (result.isStopped()) { return; } final PsiElement element = parameters.getPosition(); if (parameters.isExtendedCompletion()) { completeTagName(parameters, result); } el...
fillCompletionVariants
304,260
void (CompletionParameters parameters, CompletionResultSet result) { PsiElement element = parameters.getPosition(); if (!isXmlNameCompletion(parameters)) return; PsiElement parent = element.getParent(); if (!(parent instanceof XmlTag tag) || !(parameters.getOriginalFile() instanceof XmlFile)) { return; } result.stopHer...
completeTagName
304,261
LookupElement (XmlExtension.TagInfo tagInfo, final String tailText, @Nullable String namespacePrefix) { LookupElementBuilder builder = LookupElementBuilder.create(tagInfo, tagInfo.name).withInsertHandler( new ExtendedTagInsertHandler(tagInfo.name, tagInfo.namespace, namespacePrefix)); if (!StringUtil.isEmpty(tailText))...
createLookupElement
304,262
String (final @NotNull CompletionParameters parameters) { if (isXmlNameCompletion(parameters) && parameters.getCompletionType() == CompletionType.BASIC) { if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(TAG_NAME_COMPLETION_FEATURE, parameters.getPosition().getProject())) { final String shortcut = KeymapU...
advertise
304,263
void (final @NotNull CompletionInitializationContext context) { final int offset = context.getStartOffset(); final PsiFile file = context.getFile(); final XmlAttributeValue attributeValue = PsiTreeUtil.findElementOfClassAtOffset(file, offset, XmlAttributeValue.class, true); if (attributeValue != null && offset == attri...
beforeCompletion
304,264
void (PsiElement context, CompletionResultSet resultSet) { XmlFile containingFile = ObjectUtils.tryCast(context.getContainingFile(), XmlFile.class); if (containingFile == null) { return; } List<XmlFile> descriptorFiles = XmlExtension.getExtension(containingFile).getCharEntitiesDTDs(containingFile); final XmlTag tag = P...
addEntityRefCompletions
304,265
boolean (final @NotNull PsiElement element) { if (element instanceof XmlEntityDecl xmlEntityDecl) { if (xmlEntityDecl.isInternalReference() || acceptSystemEntities) { final LookupElementBuilder _item = buildEntityLookupItem(xmlEntityDecl); if (_item != null) { resultSet.addElement(_item); resultSet.stopHere(); } } } re...
execute
304,266
void (@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); context.setAddCompletionChar(false); Editor editor = context.getEditor(); final CaretModel caretModel = editor.getCaretModel(); int caretOffset = caretModel.getOffset(); if (!CharArrayUtil.regionMatches(editor.get...
handleInsert
304,267
void (final @NotNull CompletionParameters parameters, final @NotNull CompletionResultSet result) { boolean empty = result.runRemainingContributors(parameters, true).isEmpty(); if (!empty && parameters.getInvocationCount() == 0) { result.restartCompletionWhenNothingMatches(); } if (empty && parameters.getCompletionType(...
fillCompletionVariants
304,268
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset()); if (reference instanceof XmlAttributeReference) { addAttributeReferenceCompletionVaria...
addCompletions
304,269
void (XmlAttributeReference reference, CompletionResultSet result, @Nullable InsertHandler<LookupElement> replacementInsertHandler) { final XmlTag declarationTag = reference.getElement().getParent(); LOG.assertTrue(declarationTag.isValid()); final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor(); ...
addAttributeReferenceCompletionVariants
304,270
void (final CompletionResultSet result, final XmlAttribute[] attributes, final XmlAttributeDescriptor[] descriptors, XmlAttribute attribute, @Nullable InsertHandler<LookupElement> replacementInsertHandler) { final XmlTag tag = attribute.getParent(); final PsiFile file = tag.getContainingFile(); final XmlExtension exten...
addVariants
304,271
boolean (XmlAttribute attribute, @NotNull XmlAttributeDescriptor descriptor, final XmlAttribute[] attributes, final XmlExtension extension) { if (extension.isIndirectSyntax(descriptor)) return false; String descriptorName = descriptor.getName(attribute.getParent()); if (descriptorName == null) { LOG.error("Null descrip...
isValidVariant
304,272
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); if (!hasHtmlAttributesCompletion(position)) { return; } final XmlAttributeValue attributeValue = PsiTreeUtil.getParentOfType(position, XmlAttri...
addCompletions
304,273
boolean (PsiElement position) { if (PsiTreeUtil.getParentOfType(position, HtmlTag.class, false) != null) { return true; } XmlTag xmlTag = PsiTreeUtil.getParentOfType(position, XmlTag.class, false); return xmlTag != null && xmlTag.getLanguage() == XHTMLLanguage.INSTANCE; }
hasHtmlAttributesCompletion
304,274
String[] (@NotNull XmlTag tag) { final XmlAttribute typeAttribute = tag.getAttribute(ITEM_TYPE); if (typeAttribute != null) { final XmlAttributeValue valueElement = typeAttribute.getValueElement(); final PsiReference[] references = valueElement != null ? valueElement.getReferences() : PsiReference.EMPTY_ARRAY; List<Str...
findItemProperties
304,275
boolean (@Nullable PsiElement element) { PsiFile file = doIfNotNull(element, PsiElement::getContainingFile); if (file == null || !isHtmlElementInTextCompletionEnabledForFile(file)) { return false; } if (isDeselectingFirstPopupItemDisabled(element)) { return false; } IElementType elementType = element.getNode().getEleme...
shouldTryDeselectingFirstPopupItem
304,276
ElementPattern<PsiElement> () { return psiElement(XmlTokenType.XML_DATA_CHARACTERS) .withParent(StandardPatterns.or(psiElement(XmlText.class), psiElement(XmlDocument.class))) .inFile(PlatformPatterns.psiFile(HtmlFileImpl.class)); }
getHtmlElementInTextPattern
304,277
CompletionResultSet (@NotNull CompletionResultSet result, @NotNull CompletionParameters parameters) { // We want live templates to be mixed with tags and other contributions result = result.withRelevanceSorter(withoutLiveTemplatesWeigher(null, parameters, result.getPrefixMatcher())); if (parameters.getInvocationCount()...
patchResultSetForHtmlElementInTextCompletion
304,278
boolean (@NotNull CompletionParameters parameters) { // Do not provide HTML text completions in multi view files like PHP final List<PsiFile> psiFiles = parameters.getOriginalFile().getViewProvider().getAllFiles(); return ContainerUtil.exists(psiFiles, f -> f instanceof HtmlFileImpl) && ContainerUtil.and(psiFiles, f ->...
canProvideHtmlElementInTextCompletion
304,279
boolean (@NotNull PsiFile file) { return ContainerUtil.exists(HtmlInTextCompletionEnabler.EP_NAME.getExtensionList(), enabler -> enabler.isEnabledInFile(file)); }
isHtmlElementInTextCompletionEnabledForFile
304,280
boolean (@NotNull PsiFile file) { return HtmlSettings.getInstance().AUTO_POPUP_TAG_CODE_COMPLETION_ON_TYPING_IN_TEXT && isHtmlElementInTextCompletionEnabledForFile(file); }
isHtmlElementInTextCompletionAutoPopupEnabledForFile
304,281
boolean (@NotNull PsiElement element) { return ContainerUtil.exists(HtmlInTextCompletionPopupExtension.EP_NAME.getExtensionList(), ext -> ext.isDeselectingFirstItemDisabled(element)); }
isDeselectingFirstPopupItemDisabled
304,282
CompletionSorter (@Nullable CompletionSorter sorter, @NotNull CompletionParameters parameters, @NotNull PrefixMatcher prefixMatcher) { if (sorter == null) { sorter = getCompletionService().defaultSorter(parameters, prefixMatcher); } return ((CompletionSorterImpl)sorter).withoutClassifiers(f -> "templates".equals(f.getI...
withoutLiveTemplatesWeigher
304,283
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { if (!canProvideHtmlElementInTextCompletion(parameters)) return; // We cannot modify the file in injections - disable the feature if (parameters.getPosition().getContainingFile().isPhysical()) retur...
addCompletions
304,284
String () { return "<" + super.getLookupString(); }
getLookupString
304,285
void (@NotNull LookupElementPresentation presentation) { super.renderElement(presentation); presentation.setItemText("<" + presentation.getItemText()); }
renderElement
304,286
void (@Nullable Lookup oldLookup, @Nullable Lookup newLookup) { if (newLookup instanceof LookupImpl lookup && shouldTryDeselectingFirstPopupItem(newLookup.getPsiElement())) { lookup.setPrefixChangeListener(new PrefixChangeListener() { @Override public void afterAppend(char c) { // Select first item when two chars are t...
activeLookupChanged
304,287
void (char c) { // Select first item when two chars are typed after '&' if (lookup.getCurrentItemOrEmpty() == null && hasTwoCharsAfterAmp(lookup)) { lookup.setSelectedIndex(0); } }
afterAppend
304,288
void () { var currentCompletion = getCompletionService().getCurrentCompletion(); if (currentCompletion != null && currentCompletion.isAutopopupCompletion() && !lookup.isSelectionTouched() && !hasTwoCharsAfterAmp(lookup)) { // Deselect topmost item lookup.getList().setSelectedValue(null, false); ListSelectionModel selec...
uiRefreshed
304,289
boolean (LookupImpl lookup) { int start = Math.max(lookup.getLookupStart() - 1, 0); int end = lookup.getEditor().getCaretModel().getOffset(); if (end - start < 3) return false; Document doc = lookup.getEditor().getDocument(); return doc.getTextLength() > start && doc.getCharsSequence().charAt(start) == '&'; }
hasTwoCharsAfterAmp
304,290
void (final @NotNull InsertionContext context, final @NotNull LookupElement item) { final XmlFile contextFile = (XmlFile)context.getFile(); final XmlExtension extension = XmlExtension.getExtension(contextFile); final XmlFile file = extension.getContainingFile(contextFile); final Project project = context.getProject(); ...
handleInsert
304,291
void (final String namespacePrefix) { PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document); final PsiElement element = file.findElementAt(context.getStartOffset()); if (element != null) { qualifyWithPrefix(namespacePrefix, element, document); PsiDocumentManager.getInstance(project)....
run
304,292
void (@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); }
doDefault
304,293
boolean (PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof XmlTag tag)) return false; final XmlElementDescriptor tagDescriptor = tag.getDescriptor(); final String tagNamespace = tag.getNamespace(); assert myNamespace != null; return tagDescriptor != null && !(tagDescriptor ins...
isNamespaceBound
304,294
Set<String> (final XmlFile file) { return XmlNamespaceHelper.getHelper(file).getNamespacesByTagName(myElementName, file); }
getNamespaces
304,295
void (final String namespacePrefix, final PsiElement element, final Document document) { qualifyWithPrefix(namespacePrefix, element); }
qualifyWithPrefix
304,296
void (final String namespacePrefix, final PsiElement element) { final PsiElement tag = element.getParent(); if (tag instanceof XmlTag) { final String prefix = ((XmlTag)tag).getNamespacePrefix(); if (!prefix.equals(namespacePrefix) && StringUtil.isNotEmpty(namespacePrefix)) { String toInsert = namespacePrefix + ":"; Doc...
qualifyWithPrefix
304,297
int[] (final PsiFile file, final int caretOffset) { if (file instanceof XmlFile) { PsiElement element = file; PsiElement elementAt = file.findElementAt(caretOffset); elementAt = PsiTreeUtil.getParentOfType(elementAt, XmlTag.class); if (elementAt != null) element = elementAt; ArrayList<PsiElement> array = new ArrayList<...
getMethodNavigationOffsets
304,298
void (ArrayList<? super PsiElement> array, PsiElement element) { PsiElement parent = element instanceof XmlFile ? element : element.getParent(); if (parent != null) { PsiElement[] children = parent.getChildren(); for (PsiElement child : children) { if (child instanceof XmlTag) { array.add(child); } } } final PsiElement...
addNavigationElements
304,299
boolean (final @NotNull Project project, final Editor editor, final @NotNull PsiElement element) { final PsiElement parent = element.getParent(); return parent instanceof XmlAttributeValue && ColorUtil.fromHex(((XmlAttributeValue)parent).getValue(), null) != null; }
isAvailable