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.getV...
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 @NotNu...
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....
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 Stri...
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(se...
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 w...
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.getTemplateDataLangu...
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...
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 = ca...
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; } ...
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 ...
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.ge...
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(cla...
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.getP...
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 = class...
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 ...
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)...
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 Matche...
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(E...
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 =...
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 tok...
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