Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
304,500
boolean (FileType type) { return type == XHtmlFileType.INSTANCE || type == StdFileTypes.JSPX || type == XmlFileType.INSTANCE; }
isTrueXml
304,501
String (@NotNull XmlTag tag, @NotNull Map<String, String> attributes, boolean hasChildren, @NotNull PsiElement context) { FileType fileType = context.getContainingFile().getFileType(); PsiFile file = tag.getContainingFile(); if (isTrueXml(fileType)) { closeUnclosingTags(tag); } return file.getText(); }
toString
304,502
String (@NotNull Map<String, String> attributes, boolean hasChildren, int numberInIteration, int totalIterations, @Nullable String surroundedText) { StringBuilder result = new StringBuilder(); for (Map.Entry<String, String> entry : attributes.entrySet()) { String name = entry.getKey(); String value = ZenCodingUtil.getValue(entry.getValue(), numberInIteration, totalIterations, surroundedText); result.append(getAttributeString(name, value)); result.append(' '); } return result.toString().trim(); }
buildAttributesString
304,503
boolean (@NotNull CustomTemplateCallback callback, boolean wrapping) { return isMyContext(callback.getContext(), wrapping); }
isMyContext
304,504
boolean (@NotNull PsiElement context, boolean wrapping) { return isMyLanguage(context.getLanguage()) && (wrapping || HtmlTextContextType.isInContext(context)); }
isMyContext
304,505
boolean (Language language) { return language instanceof XMLLanguage; }
isMyLanguage
304,506
String () { return "html"; }
getSuffix
304,507
boolean () { return EmmetOptions.getInstance().isEmmetEnabled(); }
isEnabled
304,508
boolean (@NotNull PsiElement context) { return true; }
isAppliedByDefault
304,509
String (String name, String value) { return name + "=\"" + value + '"'; }
getAttributeString
304,510
void (@NotNull XmlTag root) { final List<SmartPsiElementPointer<XmlTag>> tagToClose = new ArrayList<>(); Project project = root.getProject(); final SmartPointerManager pointerManager = SmartPointerManager.getInstance(project); root.accept(new XmlRecursiveElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { if (!isTagClosed(tag)) { tagToClose.add(pointerManager.createSmartPsiElementPointer(tag)); } } }); for (SmartPsiElementPointer<XmlTag> pointer : tagToClose) { XmlTag element = pointer.getElement(); if (element == null) continue; String elementText = element.getText(); if (!elementText.endsWith(">")) continue; PsiFile text = PsiFileFactory.getInstance(root.getProject()) .createFileFromText("dummy.html", root.getLanguage(), StringUtil.trimEnd(element.getText(), ">") + "/>", false, true); XmlTag newTag = PsiTreeUtil.findChildOfType(text, XmlTag.class); if (newTag != null) { element.replace(newTag); } } }
closeUnclosingTags
304,511
void (final @NotNull XmlTag tag) { if (!isTagClosed(tag)) { tagToClose.add(pointerManager.createSmartPsiElementPointer(tag)); } }
visitXmlTag
304,512
boolean (@NotNull XmlTag tag) { ASTNode node = tag.getNode(); assert node != null; final ASTNode emptyTagEnd = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(node); final ASTNode endTagEnd = XmlChildRole.CLOSING_TAG_START_FINDER.findChild(node); return emptyTagEnd != null || endTagEnd != null; }
isTagClosed
304,513
List<ZenCodingGenerator> () { return EP_NAME.getExtensionList(); }
getInstances
304,514
boolean (char c) { return Character.isDigit(c) || Character.isLetter(c) || StringUtil.containsChar("/>+^[](){}#.*:$-_!@|%", c); }
isAllowedChar
304,515
EmmetParser (List<ZenCodingToken> tokens, CustomTemplateCallback callback, ZenCodingGenerator generator, boolean surroundWithTemplate) { return new XmlEmmetParser(tokens, callback, generator, surroundWithTemplate); }
createParser
304,516
boolean () { return hasCompletionItem(); }
addToCompletion
304,517
boolean () { return false; }
hasCompletionItem
304,518
boolean (@NotNull CustomTemplateCallback callback) { return false; }
isHtml
304,519
void () { }
disableEmmet
304,520
TemplateImpl (@NotNull TemplateToken token, boolean hasChildren, @NotNull PsiElement context) { TemplateImpl tokenTemplate = token.getTemplate(); String s = toString(token, hasChildren, context); assert tokenTemplate != null; TemplateImpl template = tokenTemplate.copy(); template.setString(s); return template; }
generateTemplate
304,521
TemplateImpl (@NotNull String key, boolean forceSingleTag) { StringBuilder builder = new StringBuilder("<"); builder.append(key).append('>'); if (!forceSingleTag && !HtmlUtil.isSingleHtmlTag(key, false)) { builder.append("$END$</").append(key).append('>'); } return new TemplateImpl("", builder.toString(), ""); }
createTemplateByKey
304,522
String (@NotNull TemplateToken token, boolean hasChildren, @NotNull PsiElement context) { CodeStyleSettings.QuoteStyle quoteStyle = XmlEditUtil.quoteStyle(context.getContainingFile()); XmlTag tag = token.getXmlTag(); if (tag != null) { if (quoteStyle != CodeStyleSettings.QuoteStyle.None) { HtmlQuotesFormatPreprocessor.HtmlQuotesConverter.runOnElement(quoteStyle, tag); //hack: formatter change the document, so we have to apply changes from document back to PSI, since events are disables for the file Document document = token.getFile().getViewProvider().getDocument(); token.setTemplateText(document.getText(), token.getFile()); } return replaceQuotesIfNeeded(toString(token.getXmlTag(), token.getAttributes(), hasChildren, context), context.getContainingFile()); } PsiFile file = token.getFile(); if (quoteStyle != CodeStyleSettings.QuoteStyle.None) { HtmlQuotesFormatPreprocessor.HtmlQuotesConverter.runOnElement(quoteStyle, file); } return replaceQuotesIfNeeded(file.getText(), context.getContainingFile()); }
toString
304,523
String (@NotNull String text, @NotNull PsiFile file) { PsiElement context = file.getContext(); if (context != null) { String contextText = context.getText(); if (StringUtil.startsWithChar(contextText, '"')) { return StringUtil.escapeChar(text, '"'); } else if (StringUtil.startsWithChar(contextText, '\'')) { return StringUtil.escapeChar(text, '\''); } } return text; }
replaceQuotesIfNeeded
304,524
void () { EmmetOptions.getInstance().setEmmetEnabled(false); }
disableEmmet
304,525
boolean (@NotNull CustomTemplateCallback callback) { return ZenCodingUtil.isHtml(callback); }
isHtml
304,526
String (int wordsCount, boolean startWithCommon) { Collection<String> sentences = new LinkedList<>(); int totalWords = 0; String[] words; if (startWithCommon) { words = Arrays.copyOf(COMMON_P, Math.min(wordsCount, COMMON_P.length)); if (words.length > 5) { words[4] += ','; } totalWords += words.length; sentences.add(sentence(words, '.')); } while (totalWords < wordsCount) { words = sample(WORDS, Math.min(rand(3, 12) * rand(1, 5), wordsCount - totalWords)); totalWords += words.length; insertCommas(words); sentences.add(sentence(words)); } return StringUtil.join(sentences, " "); }
generate
304,527
void (String[] words) { if (words.length <= 1) { return; } int len = words.length; int totalCommas; if (len > 3 && len <= 6) { totalCommas = rand(0, 1); } else if (len > 6 && len <= 12) { totalCommas = rand(0, 2); } else { totalCommas = rand(1, 4); } while (totalCommas > 0) { int i = rand(0, words.length - 1); String word = words[i]; if (!StringUtil.endsWithChar(word, ',')) { words[i] = word + ","; } totalCommas--; } }
insertCommas
304,528
String (String[] words) { return sentence(words, choice("?!...")); }
sentence
304,529
String (String[] words, char endChar) { if (words.length > 0) { words[0] = StringUtil.capitalize(words[0]); } return StringUtil.join(words, " ") + endChar; }
sentence
304,530
int (int from, int to) { return random.nextInt(to - from) + from; }
rand
304,531
String[] (String[] words, int wordsCount) { int len = words.length; int iterations = Math.min(len, wordsCount); Set<String> result = new TreeSet<>(); while (result.size() < iterations) { int i = rand(0, len - 1); result.add(words[i]); } return ArrayUtilRt.toStringArray(result); }
sample
304,532
char (String values) { return values.charAt(rand(0, values.length() - 1)); }
choice
304,533
void (Editor editor, Presentation presentation, DataContext dataContext) { super.update(editor, presentation, dataContext); final PsiFile file = getFile(dataContext); if (!XmlGtTypedHandler.fileContainsXmlLanguage(file)) { presentation.setEnabledAndVisible(false); } }
update
304,534
PsiFile (DataContext context) { return CommonDataKeys.PSI_FILE.getData(context); }
getFile
304,535
void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { EmmetEditPointUtil.moveForward(editor, getFile(dataContext)); }
doExecute
304,536
void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { EmmetEditPointUtil.moveBackward(editor, getFile(dataContext)); }
doExecute
304,537
void (final Editor editor, final PsiFile file) { if (!XmlGtTypedHandler.fileContainsXmlLanguage(file)) return; moveToNextPoint(editor, file, editor.getCaretModel().getOffset(), 1); }
moveForward
304,538
void (final Editor editor, final PsiFile file) { if (!XmlGtTypedHandler.fileContainsXmlLanguage(file)) return; moveToNextPoint(editor, file, editor.getCaretModel().getOffset(), -1); }
moveBackward
304,539
void (Editor editor, PsiFile file, int offset, int inc) { final Document doc = editor.getDocument(); final TemplateLanguageFileViewProvider provider = ObjectUtils.tryCast(file.getViewProvider(), TemplateLanguageFileViewProvider.class); final Language additionalLanguage = provider != null ? provider.getTemplateDataLanguage() : null; PsiDocumentManager.getInstance(file.getProject()).commitDocument(doc); for (int i = offset + inc; i < doc.getTextLength() && i >= 0; i += inc) { PsiElement current = InjectedLanguageUtil.findElementAtNoCommit(file, i); if (checkAndMove(editor, doc, i, current)) return; if (additionalLanguage != null) { current = provider.findElementAt(i, additionalLanguage); if (checkAndMove(editor, doc, i, current)) return; } } }
moveToNextPoint
304,540
boolean (Editor editor, Document doc, int offset, PsiElement current) { if (current == null) return false; if (current.getParent() instanceof XmlText) { final int line = doc.getLineNumber(offset); final int lineStart = doc.getLineStartOffset(line); final int lineEnd = doc.getLineEndOffset(line); final CharSequence text = doc.getCharsSequence().subSequence(lineStart, lineEnd); if (StringUtil.isEmptyOrSpaces(text) && moveCaret(editor, current, lineEnd)) { return true; } } else if (isEmptyEditPoint(current) && moveCaret(editor, current, current.getTextRange().getStartOffset())) { return true; } return false; }
checkAndMove
304,541
boolean (Editor editor, PsiElement current, int offset) { editor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, current.getContainingFile()); final CaretModel caretModel = editor.getCaretModel(); if (caretModel.getOffset() == offset) return false; caretModel.moveToOffset(offset); final Caret caret = caretModel.getCurrentCaret(); ScrollingModel scrollingModel = editor.getScrollingModel(); if (caret == caretModel.getPrimaryCaret()) { scrollingModel.scrollToCaret(ScrollType.RELATIVE); } return true; }
moveCaret
304,542
boolean (PsiElement element) { final IElementType type = element.getNode().getElementType(); if (type == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER) { final PsiElement prev = PsiTreeUtil.prevLeaf(element); return prev != null && prev.getNode().getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER; } if (type == XmlTokenType.XML_END_TAG_START || type == XmlTokenType.XML_START_TAG_START) { final PsiElement prev = PsiTreeUtil.prevLeaf(element); return prev != null && prev.getNode().getElementType() == XmlTokenType.XML_TAG_END; } return false; }
isEmptyEditPoint
304,543
String () { return XmlBundle.message("emmet.filter.BEM"); }
getDisplayName
304,544
String () { return SUFFIX; }
getSuffix
304,545
boolean (@NotNull PsiElement context) { return context.getLanguage() instanceof XMLLanguage; }
isMyContext
304,546
GenerationNode (final @NotNull GenerationNode node) { final Map<String, String> attributes = node.getTemplateToken().getAttributes(); String classAttributeName = HtmlUtil.CLASS_ATTRIBUTE_NAME; String classValue = attributes.get(classAttributeName); EmmetOptions emmetOptions = EmmetOptions.getInstance(); if (classValue != null && emmetOptions != null) { String elementSeparator = emmetOptions.getBemElementSeparator(); String modifierSeparator = emmetOptions.getBemModifierSeparator(); String shortElementPrefix = emmetOptions.getBemShortElementPrefix(); List<String> classNames = ContainerUtil.map(HtmlUtil.splitClassNames(classValue), (s) -> normalizeClassName(s, elementSeparator, shortElementPrefix)); BEM_STATE.set(node, new BemState(suggestBlockName(classNames), null, null)); Set<String> newClassNames = new LinkedHashSet<>(); for (String className : classNames) { ContainerUtil.addAll(newClassNames, processClassName(className, node, elementSeparator, modifierSeparator)); } attributes.put(classAttributeName, StringUtil.join(newClassNames, " ")); } return node; }
filterNode
304,547
Iterable<String> (@NotNull String className, @NotNull GenerationNode node, @NotNull String elementSeparator, @NotNull String modifierSeparator) { className = fillWithBemElements(className, node, elementSeparator); className = fillWithBemModifiers(className, node, modifierSeparator); BemState nodeBemState = BEM_STATE.get(node); BemState bemState = extractBemStateFromClassName(className, elementSeparator, modifierSeparator); List<String> result = new ArrayList<>(); if (!bemState.isEmpty()) { String nodeBlockValue = nodeBemState != null ? nodeBemState.getBlock() : null; String block = bemState.getBlock(); if (StringUtil.isEmpty(block)) { block = StringUtil.notNullize(nodeBlockValue); bemState.setBlock(block); } String prefix = block; String element = bemState.getElement(); if (StringUtil.isNotEmpty(element)) { prefix += elementSeparator + element; } result.add(prefix); String modifier = bemState.getModifier(); if (StringUtil.isNotEmpty(modifier)) { result.add(prefix + modifierSeparator + modifier); } BemState newNodeBemState = bemState.copy(); if (StringUtil.isNotEmpty(nodeBlockValue) && StringUtil.isEmpty(modifier)) { // save old value newNodeBemState.setBlock(nodeBlockValue); } BEM_STATE.set(node, newNodeBemState); } else { result.add(className); } return result; }
processClassName
304,548
BemState (@NotNull String className, String elementSeparator, String modifierSeparator) { final BemState result = new BemState(); int indexOfElementSeparator = className.indexOf(elementSeparator); if (indexOfElementSeparator >= 0) { result.setBlock(className.substring(0, indexOfElementSeparator)); result.setElement(className.substring(indexOfElementSeparator + elementSeparator.length())); int lastIndexOfElementSeparator = className.lastIndexOf(elementSeparator); assert lastIndexOfElementSeparator >= 0; int indexOfModifierSeparator = className.indexOf(modifierSeparator, lastIndexOfElementSeparator + elementSeparator.length()); if (indexOfModifierSeparator >= 0) { result.setModifier(className.substring(indexOfModifierSeparator + modifierSeparator.length())); result.setElement(className.substring(indexOfElementSeparator + elementSeparator.length(), indexOfModifierSeparator)); } } else { int indexOfModifierSeparator = className.indexOf(modifierSeparator); if (indexOfModifierSeparator >= 0) { result.setBlock(className.substring(0, indexOfModifierSeparator)); result.setModifier(className.substring(indexOfModifierSeparator + modifierSeparator.length())); } } return result; }
extractBemStateFromClassName
304,549
String (@NotNull String className, @NotNull GenerationNode node, @NotNull String separator) { return transformClassNameToBemFormat(className, separator, node, false); }
fillWithBemElements
304,550
String (@NotNull String className, @NotNull GenerationNode node, @NotNull String separator) { return transformClassNameToBemFormat(className, separator, node, true); }
fillWithBemModifiers
304,551
String (@NotNull String className, @NotNull String separator, @NotNull GenerationNode node, boolean isModifierSeparator) { Pair<String, Integer> cleanStringAndDepth = getCleanStringAndDepth(className, separator); Integer depth = cleanStringAndDepth.second; if (depth > 0) { GenerationNode donor = node; while (donor.getParent() != null && depth > 0) { donor = donor.getParent(); depth--; } BemState bemState = BEM_STATE.get(donor); if (bemState != null) { String prefix = bemState.getBlock(); if (!StringUtil.isEmpty(prefix)) { String element = bemState.getElement(); if (isModifierSeparator && !StringUtil.isEmpty(element)) { prefix = prefix + separator + element; } return prefix + separator + cleanStringAndDepth.first; } } } return className; }
transformClassNameToBemFormat
304,552
String (Iterable<String> classNames) { String result = ContainerUtil.find(classNames, className -> BLOCK_NAME_PATTERN.matcher(className).matches()); if (result == null) { result = ContainerUtil.find(classNames, s -> s != null && !s.isEmpty() && Character.isLetter(s.charAt(0))); } return StringUtil.notNullize(result); }
suggestBlockName
304,553
String (@NotNull String className, @NotNull String elementSeparator, @NotNull String shortElementPrefix) { if (shortElementPrefix.isEmpty() || !className.startsWith(shortElementPrefix)) { return className; } StringBuilder result = new StringBuilder(); while (className.startsWith(shortElementPrefix)) { className = className.substring(shortElementPrefix.length()); result.append(elementSeparator); } return result.append(className).toString(); }
normalizeClassName
304,554
void (@Nullable String modifier) { this.modifier = modifier; }
setModifier
304,555
void (@Nullable String element) { this.element = element; }
setElement
304,556
void (@Nullable String block) { this.block = block; }
setBlock
304,557
boolean () { return StringUtil.isEmpty(block) && StringUtil.isEmpty(element) && StringUtil.isEmpty(modifier); }
isEmpty
304,558
BemState () { return new BemState(block, element, modifier); }
copy
304,559
String (@NotNull String text, @NotNull TemplateToken token) { return text; }
filterText
304,560
GenerationNode (@NotNull GenerationNode node) { return node; }
filterNode
304,561
boolean (@NotNull PsiElement context) { return isSystem() || EmmetOptions.getInstance().isFilterEnabledByDefault(this); }
isAppliedByDefault
304,562
boolean () { return false; }
isSystem
304,563
List<ZenCodingFilter> () { List<ZenCodingFilter> generators = new ArrayList<>(); Collections.addAll(generators, Holder.OUR_STANDARD_FILTERS); generators.addAll(EP_NAME.getExtensionList()); return generators; }
getInstances
304,564
GenerationNode (final @NotNull GenerationNode node) { TemplateToken token = node.getTemplateToken(); final XmlTag tag = token != null ? token.getXmlTag() : null; if (tag != null) { if (token.getAttributes().containsKey(SELECT_ATTR_NAME)) { return node; } if (isOurTag(tag, !node.getChildren().isEmpty())) { XmlAttribute attribute = tag.getAttribute(SELECT_ATTR_NAME); if (attribute != null) { //fake file processing, no write-action needed attribute.delete(); } } return node; } return node; }
filterNode
304,565
boolean (XmlTag tag, boolean hasChildren) { if (hasChildren) { String name = tag.getLocalName(); return name.equals("with-param") || name.equals("variable"); } return false; }
isOurTag
304,566
boolean (@NotNull PsiElement context) { return myDelegate.isMyContext(context, true) || myDelegate.isMyContext(context, false); }
isMyContext
304,567
String () { return "xsl"; }
getSuffix
304,568
boolean (@NotNull PsiElement context) { return XslTextContextType.isXslOrXsltFile(context.getContainingFile()) || super.isAppliedByDefault(context); }
isAppliedByDefault
304,569
String () { return XmlBundle.message("emmet.filter.xsl.tuning"); }
getDisplayName
304,570
String (@Nullable String classAttr, @Nullable String idAttr) { StringBuilder builder = new StringBuilder(); if (!Strings.isEmpty(idAttr)) { builder.append('#').append(idAttr); } if (!Strings.isEmpty(classAttr)) { builder.append('.').append(classAttr); } return builder.toString(); }
buildCommentString
304,571
String (@NotNull String text, @NotNull TemplateToken token) { XmlTag tag = token.getXmlTag(); if (tag != null) { String classAttr = token.getAttributes().get(HtmlUtil.CLASS_ATTRIBUTE_NAME); String idAttr = token.getAttributes().get(HtmlUtil.ID_ATTRIBUTE_NAME); if (!Strings.isEmpty(classAttr) || !Strings.isEmpty(idAttr)) { String commentString = buildCommentString(classAttr, idAttr); return String.format(getCommentFormat(), text, commentString); } } return text; }
filterText
304,572
String () { return "%s\n<!-- /%s -->"; }
getCommentFormat
304,573
String () { return "c"; }
getSuffix
304,574
boolean (@NotNull PsiElement context) { PsiElement parent = context.getParent(); return parent != null && parent.getLanguage() instanceof XMLLanguage; }
isMyContext
304,575
String () { return XmlBundle.message("emmet.filter.comment.tags"); }
getDisplayName
304,576
String (@NotNull String s, @NotNull TemplateToken token) { s = s.replace("&", "&amp;"); s = s.replace("<", "&lt;"); s = s.replace(">", "&gt;"); return s; }
filterText
304,577
String () { return "e"; }
getSuffix
304,578
boolean (@NotNull PsiElement context) { return context.getLanguage() instanceof XMLLanguage; }
isMyContext
304,579
String () { return XmlBundle.message("emmet.filter.escape"); }
getDisplayName
304,580
String () { return "s"; }
getSuffix
304,581
String (@NotNull String text, @NotNull TemplateToken token) { return StringUtil.replace(text, "\n", ""); }
filterText
304,582
GenerationNode (@NotNull GenerationNode node) { TemplateImpl template = node.getTemplateToken().getTemplate(); if (template != null) { template.setToReformat(false); } for (GenerationNode generationNode : node.getChildren()) { filterNode(generationNode); } return node; }
filterNode
304,583
boolean (@NotNull PsiElement context) { return context.getLanguage() instanceof XMLLanguage; }
isMyContext
304,584
String () { return XmlBundle.message("emmet.filter.single.line"); }
getDisplayName
304,585
String () { return "t"; }
getSuffix
304,586
boolean (@NotNull PsiElement context) { return context.getLanguage() instanceof XMLLanguage; }
isMyContext
304,587
String () { return XmlBundle.message("emmet.filter.trim.line.markers"); }
getDisplayName
304,588
String (@NotNull String text, @NotNull TemplateToken token) { XmlTag tag = token.getXmlTag(); if (tag != null && !tag.getText().isEmpty()) { tag.accept(new XmlElementVisitor() { @Override public void visitXmlTag(final @NotNull XmlTag tag) { if (!tag.isEmpty()) { final XmlTagValue tagValue = tag.getValue(); final Matcher matcher = PATTERN.matcher(tagValue.getText()); if (matcher.matches()) { tagValue.setText(matcher.replaceAll("")); } } tag.acceptChildren(this); } }); return tag.getText(); } else { return PATTERN.matcher(token.getTemplateText()).replaceAll(""); } }
filterText
304,589
void (final @NotNull XmlTag tag) { if (!tag.isEmpty()) { final XmlTagValue tagValue = tag.getValue(); final Matcher matcher = PATTERN.matcher(tagValue.getText()); if (matcher.matches()) { tagValue.setText(matcher.replaceAll("")); } } tag.acceptChildren(this); }
visitXmlTag
304,590
GenerationNode (@NotNull GenerationNode node) { doFilter(node); return node; }
filterNode
304,591
void (GenerationNode node) { final String surroundedText = node.getSurroundedText(); if (surroundedText != null) { node.setSurroundedText(PATTERN.matcher(surroundedText).replaceAll("")); } for (GenerationNode child : node.getChildren()) { doFilter(child); } }
doFilter
304,592
String (@NotNull PsiElement element) { if (element instanceof XmlTag tag) { PsiElement parent = tag.getParent(); StringBuilder buffer = new StringBuilder(); buffer.append("tag").append(ELEMENT_TOKENS_SEPARATOR); String name = tag.getName(); buffer.append(name.length() == 0 ? "<unnamed>" : escape(name)); buffer.append(ELEMENT_TOKENS_SEPARATOR); int childIndex = getChildIndex(tag, parent, name, XmlTag.class); if (childIndex < 0) return null; buffer.append(childIndex); if (!(parent instanceof PsiFile)) { String parentSignature = getSignature(parent); if (parentSignature == null) { return null; } buffer.append(";"); buffer.append(parentSignature); } return buffer.toString(); } return null; }
getSignature
304,593
PsiElement (@NotNull PsiFile file, @NotNull PsiElement parent, @NotNull String type, @NotNull StringTokenizer tokenizer, @Nullable StringBuilder processingInfoStorage) { if (type.equals("tag")) { String name = tokenizer.nextToken(); if (parent instanceof XmlFile) { parent = ((XmlFile)parent).getDocument(); if (parent == null) { return null; } } try { int index = Integer.parseInt(tokenizer.nextToken()); String unescapedName = unescape(name); PsiElement result = restoreElementInternal(parent, unescapedName, index, XmlTag.class); if (result == null && file.getFileType() == StdFileTypes.JSP) { //TODO: FoldingBuilder API, psi roots, etc? if (parent instanceof XmlDocument) { // html tag, not found in jsp tree result = restoreElementInternal(HtmlUtil.getRealXmlDocument((XmlDocument)parent), unescapedName, index, XmlTag.class); } else if (name.equals("<unnamed>")) { // scriplet/declaration missed because null name result = restoreElementInternal(parent, "", index, XmlTag.class); } } return result; } catch (NumberFormatException e) { LOG.error(e); return null; } } return null; }
restoreBySignatureTokens
304,594
int (final @NotNull PsiElement parent) { return parent.getTextRange().getStartOffset(); }
getTextStartOffset
304,595
int (@NotNull PsiElement element) { if (element instanceof XmlAttributeValue) { final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class);// for convenience if (xmlTag != null) return xmlTag.getTextRange().getEndOffset(); LOG.assertTrue(false); } return element.getTextRange().getEndOffset(); }
getTextEndOffset
304,596
TextRange (final @NotNull PsiElement container) { XmlTag xmlTag = (XmlTag)container; int endOffset = xmlTag.getTextRange().getStartOffset(); for (PsiElement child = xmlTag.getFirstChild(); child != null; child = child.getNextSibling()) { endOffset = child.getTextRange().getEndOffset(); if (child instanceof XmlToken token) { IElementType tokenType = token.getTokenType(); if (tokenType == XmlTokenType.XML_EMPTY_ELEMENT_END || tokenType == XmlTokenType.XML_TAG_END) break; } } return new TextRange(xmlTag.getTextRange().getStartOffset(), endOffset); }
getDeclarationRange
304,597
XmlAttributeDescriptor[] (final XmlElementDescriptor p) { final XmlAttributeDescriptor[] xmlAttributeDescriptors = p.getAttributesDescriptors(null); Arrays.sort(xmlAttributeDescriptors, COMPARATOR); return xmlAttributeDescriptors; }
getSortedDescriptors
304,598
XmlTag (final @NotNull CreateParameterInfoContext context) { final XmlTag tag = findXmlTag(context.getFile(), context.getOffset()); final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor() : null; if (descriptor == null) { return null; } context.setItemsToShow(new Object[] {descriptor}); return tag; }
findElementForParameterInfo
304,599
void (final @NotNull XmlTag element, final @NotNull CreateParameterInfoContext context) { context.showHint(element, element.getTextRange().getStartOffset() + 1, this); }
showParameterInfo