Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
---|---|---|
304,400 | void (@NotNull LookupElement element, final @NotNull Lookup lookup, @NotNull Consumer<? super @NotNull LookupElementAction> consumer) { if (element instanceof CustomLiveTemplateLookupElement && ((CustomLiveTemplateLookupElement)element).getCustomLiveTemplate() instanceof ZenCodingTemplate) { PsiFile file = lookup.getPsiFile(); if (file == null) { return; } CustomTemplateCallback callback = new CustomTemplateCallback(lookup.getEditor(), file); final ZenCodingGenerator generator = ZenCodingTemplate.findApplicableDefaultGenerator(callback, false); if (generator != null) { consumer.consume(new LookupElementAction(PlatformIcons.EDIT, XmlBundle.message("edit.emmet.settings")) { @Override public Result performLookupAction() { final Project project = lookup.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) return; final Configurable generatorSpecificConfigurable = generator.createConfigurable(); Configurable configurable = generatorSpecificConfigurable != null ? generatorSpecificConfigurable : new XmlEmmetConfigurable(); ShowSettingsUtil.getInstance().editConfigurable(project, new EmmetCompositeConfigurable(configurable)); }); return Result.HIDE_LOOKUP; } }); consumer.consume(new LookupElementAction(AllIcons.Actions.Cancel, XmlBundle.message("disable.emmet")) { @Override public Result performLookupAction() { ApplicationManager.getApplication().invokeLater(generator::disableEmmet); return Result.HIDE_LOOKUP; } }); } } } | fillActions |
304,401 | Result () { final Project project = lookup.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) return; final Configurable generatorSpecificConfigurable = generator.createConfigurable(); Configurable configurable = generatorSpecificConfigurable != null ? generatorSpecificConfigurable : new XmlEmmetConfigurable(); ShowSettingsUtil.getInstance().editConfigurable(project, new EmmetCompositeConfigurable(configurable)); }); return Result.HIDE_LOOKUP; } | performLookupAction |
304,402 | Result () { ApplicationManager.getApplication().invokeLater(generator::disableEmmet); return Result.HIDE_LOOKUP; } | performLookupAction |
304,403 | void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { if (LiveTemplateCompletionContributor.shouldShowAllTemplates() || !parameters.isAutoPopup()) { // covered with com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor return; } ZenCodingTemplate zenCodingTemplate = CustomLiveTemplate.EP_NAME.findExtension(ZenCodingTemplate.class); if (zenCodingTemplate != null) { zenCodingTemplate.addCompletions(parameters, result); } } | addCompletions |
304,404 | ZenCodingNode () { return myLeftOperand; } | getLeftOperand |
304,405 | ZenCodingNode () { return myRightOperand; } | getRightOperand |
304,406 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { List<GenerationNode> result = new ArrayList<>(); result.addAll(myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent)); GenerationNode grandParent = parent != null ? parent.getParent() : null; if (grandParent != null) { myRightOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, grandParent); } else { result.addAll(myRightOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent)); } return result; } | expand |
304,407 | List<ZenCodingNode> () { return ContainerUtil.newLinkedList(myLeftOperand, myRightOperand); } | getChildren |
304,408 | String () { return "^"; } | toString |
304,409 | int (CustomTemplateCallback callback) { return myLeftOperand.getApproximateOutputLength(callback) + myRightOperand.getApproximateOutputLength(callback); } | getApproximateOutputLength |
304,410 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { return Collections.emptyList(); } | expand |
304,411 | int (@Nullable CustomTemplateCallback callback) { return 0; } | getApproximateOutputLength |
304,412 | String () { return "EMPTY_NODE"; } | toString |
304,413 | List<ZenCodingNode> () { return Collections.emptyList(); } | getChildren |
304,414 | ZenCodingNode () { return myLeftOperand; } | getLeftOperand |
304,415 | int () { return myRightOperand; } | getRightOperand |
304,416 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { List<GenerationNode> result = new ArrayList<>(); for (int i = 0; i < myRightOperand; i++) { result.addAll(myLeftOperand.expand(i, myRightOperand, surroundedText, callback, insertSurroundedTextAtTheEnd, parent)); } return result; } | expand |
304,417 | int (@Nullable CustomTemplateCallback callback) { return myLeftOperand.getApproximateOutputLength(callback) * myRightOperand; } | getApproximateOutputLength |
304,418 | String () { return "*"; } | toString |
304,419 | TemplateToken () { return myTemplateToken; } | getTemplateToken |
304,420 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { TemplateToken templateToken = myTemplateToken; String templateKey = templateToken.getKey(); if (myGenerator != null && StringUtil.containsChar(templateKey, '$') && callback.findApplicableTemplate(templateKey) == null) { String newTemplateKey = ZenCodingUtil.replaceMarkers(templateKey, numberInIteration, totalIterations, surroundedText); TemplateToken newTemplateToken = new TemplateToken(newTemplateKey, templateToken.getAttributes(), templateToken.isForceSingleTag()); TemplateImpl template = myGenerator.createTemplateByKey(newTemplateKey, newTemplateToken.isForceSingleTag()); if (template != null) { template.setDeactivated(true); newTemplateToken.setTemplate(template, callback); templateToken = newTemplateToken; } } GenerationNode node = new GenerationNode(templateToken, numberInIteration, totalIterations, surroundedText, insertSurroundedTextAtTheEnd, parent); return Collections.singletonList(node); } | expand |
304,421 | String () { String result = myTemplateToken.getKey(); Map<String, String> attributes = myTemplateToken.getAttributes(); if (!attributes.isEmpty()) { result += attributes; } return "Template(" + result + ")"; } | toString |
304,422 | int (@Nullable CustomTemplateCallback callback) { TemplateImpl template = myTemplateToken.getTemplate(); if (template != null) { int result = template.getTemplateText().length(); for (Map.Entry<String, String> attribute : myTemplateToken.getAttributes().entrySet()) { result += attribute.getKey().length() + attribute.getValue().length() + 4; //plus space, eq, quotes } return result; } return 0; } | getApproximateOutputLength |
304,423 | ZenCodingNode () { return myNode; } | getNode |
304,424 | String () { return myFilter; } | getFilter |
304,425 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { return myNode.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); } | expand |
304,426 | int (@Nullable CustomTemplateCallback callback) { return myNode.getApproximateOutputLength(callback); } | getApproximateOutputLength |
304,427 | String () { return "Filter(" + myFilter + ")"; } | toString |
304,428 | ZenCodingNode () { return myLeftOperand; } | getLeftOperand |
304,429 | ZenCodingNode () { return myRightOperand; } | getRightOperand |
304,430 | List<ZenCodingNode> () { return ContainerUtil.newLinkedList(myLeftOperand, myRightOperand); } | getChildren |
304,431 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { List<GenerationNode> result = new ArrayList<>(); List<GenerationNode> leftNodes = myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, false, parent); result.addAll(leftNodes); result.addAll(myRightOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent)); return result; } | expand |
304,432 | String () { return "+"; } | toString |
304,433 | int (CustomTemplateCallback callback) { return myLeftOperand.getApproximateOutputLength(callback) + myRightOperand.getApproximateOutputLength(callback); } | getApproximateOutputLength |
304,434 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { final TemplateToken templateToken = new TemplateToken(""); final TemplateImpl template = new TemplateImpl("", myLoremGenerator.generate(myWordsCount, numberInIteration <= 0), ""); templateToken.setTemplate(template, callback); final GenerationNode node = new GenerationNode(templateToken, numberInIteration, totalIterations, surroundedText, insertSurroundedTextAtTheEnd, parent); return Collections.singletonList(node); } | expand |
304,435 | int (@Nullable CustomTemplateCallback callback) { return myWordsCount * 7; } | getApproximateOutputLength |
304,436 | String () { return "Lorem(" + myWordsCount + ")"; } | toString |
304,437 | ZenCodingNode () { return myLeftOperand; } | getLeftOperand |
304,438 | ZenCodingNode () { return myRightOperand; } | getRightOperand |
304,439 | List<ZenCodingNode> () { return ContainerUtil.newLinkedList(myLeftOperand, myRightOperand); } | getChildren |
304,440 | int (@Nullable CustomTemplateCallback callback) { int mul = myLeftOperand instanceof MulOperationNode ? ((MulOperationNode)myLeftOperand).getRightOperand() : 1; return myLeftOperand.getApproximateOutputLength(callback) + (myRightOperand.getApproximateOutputLength(callback) * mul); } | getApproximateOutputLength |
304,441 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { if (myLeftOperand instanceof MulOperationNode || (myLeftOperand instanceof UnaryMulOperationNode && surroundedText != null)) { List<GenerationNode> result = new ArrayList<>(); if (myLeftOperand instanceof MulOperationNode mul) { for (int i = 0; i < mul.getRightOperand(); i++) { List<GenerationNode> parentNodes = mul.getLeftOperand().expand(i, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); for (GenerationNode parentNode : parentNodes) { myRightOperand.expand(i, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parentNode); } result.addAll(parentNodes); } } else { UnaryMulOperationNode unaryMul = (UnaryMulOperationNode)myLeftOperand; String[] lines = LineTokenizer.tokenize(StringUtil.trim(surroundedText), false); for (int i = 0; i < lines.length; i++) { String line = lines[i].trim(); List<GenerationNode> parentNodes = unaryMul.getOperand().expand(i, totalIterations, line, callback, insertSurroundedTextAtTheEnd, parent); for (GenerationNode parentNode : parentNodes) { myRightOperand.expand(i, totalIterations, line, callback, insertSurroundedTextAtTheEnd, parentNode); } result.addAll(parentNodes); } } return result; } List<GenerationNode> leftGenNodes = myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); if (leftGenNodes.isEmpty()) { return myRightOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent); } for (GenerationNode leftGenNode : leftGenNodes) { myRightOperand.expand(numberInIteration,totalIterations , surroundedText, callback, insertSurroundedTextAtTheEnd, leftGenNode); } return leftGenNodes; } | expand |
304,442 | String () { return ">"; } | toString |
304,443 | boolean () { return myInsertNewLineBetweenNodes; } | isInsertNewLineBetweenNodes |
304,444 | List<GenerationNode> () { return myChildren; } | getChildren |
304,445 | void (GenerationNode child) { child.setParent(this); myChildren.add(child); } | addChild |
304,446 | void (Collection<? extends GenerationNode> children) { for (GenerationNode child : children) { addChild(child); } } | addChildren |
304,447 | boolean () { return myChildren.size() == 0; } | isLeaf |
304,448 | boolean () { if (myTemplateToken != null) { XmlTag tag = myTemplateToken.getXmlTag(); if (tag != null) { return HtmlUtil.isHtmlBlockTag(tag.getName(), true); } } return false; } | isBlockTag |
304,449 | TemplateImpl (@NotNull CustomTemplateCallback callback, @Nullable ZenCodingGenerator generator, @NotNull Collection<ZenCodingFilter> filters, boolean insertSurroundedText, int segmentsLimit) { myContainsSurroundedTextMarker = !(insertSurroundedText && myInsertSurroundedTextAtTheEnd); GenerationNode generationNode = this; boolean shouldNotReformatTemplate = false; boolean oneLineTemplateExpanding = false; for (ZenCodingFilter filter : filters) { generationNode = filter.filterNode(generationNode); if (filter instanceof SingleLineEmmetFilter) { shouldNotReformatTemplate = true; oneLineTemplateExpanding = true; } } CodeStyleSettings settings = CodeStyle.getSettings(callback.getFile()); String indentStr; if (callback.isInInjectedFragment()) { Editor editor = callback.getEditor(); Document document = editor.getDocument(); if (document instanceof DocumentWindow && ((DocumentWindow)document).isOneLine()) { /* * If document is one-line that in the moment of inserting text, * new line chars will be filtered (see DocumentWindowImpl#insertString). * So in this case we should filter text by SingleLineAvoid in order to avoid * inconsistency of template segments. */ oneLineTemplateExpanding = true; filters.add(new SingleLineEmmetFilter()); } indentStr = ""; } else if (settings.useTabCharacter(callback.getFileType())) { indentStr = "\t"; } else { int tabSize = settings.getTabSize(callback.getFileType()); indentStr = StringUtil.repeatSymbol(' ', tabSize); } LiveTemplateBuilder builder = new LiveTemplateBuilder(EmmetOptions.getInstance().isAddEditPointAtTheEndOfTemplate(), segmentsLimit); int end = -1; boolean hasChildren = myChildren.size() > 0; TemplateImpl parentTemplate; Map<String, String> predefinedValues; if (generator instanceof XmlZenCodingGenerator) { TemplateToken xmlTemplateToken = myTemplateToken; parentTemplate = invokeXmlTemplate(xmlTemplateToken, callback, generator, hasChildren); predefinedValues = buildPredefinedValues(xmlTemplateToken.getAttributes(), (XmlZenCodingGenerator)generator, hasChildren); } else { parentTemplate = invokeTemplate(myTemplateToken, hasChildren, callback, generator); predefinedValues = null; } String s = parentTemplate.getString(); for (ZenCodingFilter filter : filters) { s = filter.filterText(s, myTemplateToken); } parentTemplate = parentTemplate.copy(); parentTemplate.setString(s); final String txt = hasChildren || myContainsSurroundedTextMarker ? null : mySurroundedText; parentTemplate = expandTemplate(parentTemplate, predefinedValues, txt, segmentsLimit); int offset = builder.insertTemplate(0, parentTemplate, null); int newOffset = gotoChild(callback.getProject(), builder.getText(), offset, 0, builder.length()); if (offset < builder.length() && newOffset != offset) { end = offset; } offset = newOffset; if (end == -1 && offset < builder.length() && myChildren.size() == 0) { end = offset; } LiveTemplateBuilder.Marker marker = offset < builder.length() ? builder.createMarker(offset) : null; for (int i = 0, myChildrenSize = myChildren.size(); i < myChildrenSize; i++) { GenerationNode child = myChildren.get(i); TemplateImpl childTemplate = child.generate(callback, generator, filters, !myContainsSurroundedTextMarker, segmentsLimit); boolean blockTag = child.isBlockTag(); if (!oneLineTemplateExpanding && blockTag && !isNewLineBefore(builder.getText(), offset)) { builder.insertText(offset, "\n" + indentStr, false); offset += indentStr.length() + 1; } int e = builder.insertTemplate(offset, childTemplate, null); offset = marker != null ? marker.getEndOffset() : builder.length(); if (!oneLineTemplateExpanding && ((blockTag && !isNewLineAfter(builder.getText(), offset)) || myInsertNewLineBetweenNodes)) { builder.insertText(offset, "\n" + indentStr, false); offset += indentStr.length() + 1; } if (end == -1 && e < offset) { end = e; } } if (shouldNotReformatTemplate) { builder.setIsToReformat(false); } return builder.buildTemplate(); } | generate |
304,450 | TemplateImpl (@NotNull TemplateToken token, boolean hasChildren, final CustomTemplateCallback callback, @Nullable ZenCodingGenerator generator) { TemplateImpl template = token.getTemplate(); if (generator != null) { assert template != null; template = generator.generateTemplate(token, hasChildren, callback.getContext()); removeVariablesWhichHasNoSegment(template); } return template; } | invokeTemplate |
304,451 | TemplateImpl (final TemplateToken token, CustomTemplateCallback callback, @Nullable ZenCodingGenerator generator, final boolean hasChildren) { ZenCodingGenerator zenCodingGenerator = ObjectUtils.notNull(generator, XmlZenCodingGeneratorImpl.INSTANCE); Map<String, String> attributes = token.getAttributes(); TemplateImpl template = token.getTemplate(); assert template != null; PsiFileFactory fileFactory = PsiFileFactory.getInstance(callback.getProject()); PsiFile dummyFile = fileFactory.createFileFromText("dummy.html", callback.getFile().getLanguage(), token.getTemplateText(), false, true); XmlTag tag = PsiTreeUtil.findChildOfType(dummyFile, XmlTag.class); if (tag != null) { // autodetect href if (EmmetOptions.getInstance().isHrefAutoDetectEnabled() && StringUtil.isNotEmpty(mySurroundedText)) { final boolean isEmptyLinkTag = "a".equalsIgnoreCase(tag.getName()) && isEmptyValue(tag.getAttributeValue("href")); if (!hasChildren && isEmptyLinkTag) { if (HREF_PATTERN.matcher(mySurroundedText).matches()) { attributes.put("href", PROTOCOL_PATTERN.matcher(mySurroundedText).find() ? mySurroundedText.trim() : "http://" + mySurroundedText.trim()); } else if (EMAIL_PATTERN.matcher(mySurroundedText).matches()) { attributes.put("href", "mailto:" + mySurroundedText.trim()); } } } for (Map.Entry<String, String> attribute : attributes.entrySet()) { if (Strings.isEmpty(attribute.getValue())) { template.addVariable(prepareVariableName(attribute.getKey()), "", "", true); } } XmlTag tag1 = hasChildren ? expandEmptyTagIfNecessary(tag) : tag; setAttributeValues(tag1, attributes, callback, zenCodingGenerator.isHtml(callback)); token.setTemplateText(tag1.getContainingFile().getText(), callback.getFile()); } template = zenCodingGenerator.generateTemplate(token, hasChildren, callback.getContext()); removeVariablesWhichHasNoSegment(template); return template; } | invokeXmlTemplate |
304,452 | String (@NotNull String attributeName) { char[] toReplace = {'$', '-', '+', ':'}; StringBuilder builder = new StringBuilder(attributeName.length()); for (int i = 0; i < attributeName.length(); i++) { char c = attributeName.charAt(i); boolean replaced = false; for (char aToReplace : toReplace) { if (c == aToReplace) { builder.append('_'); replaced = true; break; } } if (!replaced) { builder.append(c); } } return builder.toString(); } | prepareVariableName |
304,453 | TemplateImpl (@NotNull TemplateImpl template, Map<String, String> predefinedVarValues, String surroundedText, int segmentsLimit) { LiveTemplateBuilder builder = new LiveTemplateBuilder(EmmetOptions.getInstance().isAddEditPointAtTheEndOfTemplate(), segmentsLimit); if (predefinedVarValues == null && surroundedText == null) { return template; } int offset = builder.insertTemplate(0, template, predefinedVarValues); if (surroundedText != null) { builder.insertText(offset, surroundedText, true); builder.setIsToReformat(true); } return builder.buildTemplate(); } | expandTemplate |
304,454 | XmlTag (@NotNull XmlTag tag) { StringBuilder builder = new StringBuilder(); boolean flag = false; for (PsiElement child : tag.getChildren()) { if (child instanceof XmlToken && XmlTokenType.XML_EMPTY_ELEMENT_END.equals(((XmlToken)child).getTokenType())) { flag = true; break; } builder.append(child.getText()); } if (flag) { builder.append("></").append(tag.getName()).append('>'); return XmlElementFactory.getInstance(tag.getProject()).createTagFromText(builder.toString(), XMLLanguage.INSTANCE); } return tag; } | expandEmptyTagIfNecessary |
304,455 | int (Project project, CharSequence text, int offset, int start, int end) { PsiFile file = PsiFileFactory.getInstance(project) .createFileFromText("dummy.xml", XmlFileType.INSTANCE, text, LocalTimeCounter.currentTime(), false); PsiElement element = file.findElementAt(offset); if (offset < end && element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_END_TAG_START) { return offset; } int newOffset = -1; XmlTag tag = PsiTreeUtil.findElementOfClassAtRange(file, start, end, XmlTag.class); if (tag != null) { for (PsiElement child : tag.getChildren()) { if (child instanceof XmlToken && ((XmlToken)child).getTokenType() == XmlTokenType.XML_END_TAG_START) { newOffset = child.getTextOffset(); } } } if (newOffset >= 0) { return newOffset; } return offset; } | gotoChild |
304,456 | void (TemplateImpl template) { Set<String> segments = new HashSet<>(); for (int i = 0; i < template.getSegmentsCount(); i++) { segments.add(template.getSegmentName(i)); } for (int i = template.getVariableCount() - 1; i >= 0; i--) { String varName = template.getVariableNameAt(i); if (!segments.contains(varName)) { template.removeVariable(i); } else { segments.remove(varName); } } } | removeVariablesWhichHasNoSegment |
304,457 | void (@NotNull XmlTag tag, final @NotNull Map<String, String> attributes, @NotNull CustomTemplateCallback callback, boolean isHtml) { // default and implied attributes final String defaultAttributeValue = attributes.get(XmlEmmetParser.DEFAULT_ATTRIBUTE_NAME); if (defaultAttributeValue != null) { attributes.remove(XmlEmmetParser.DEFAULT_ATTRIBUTE_NAME); // exclude user defined attributes final List<XmlAttribute> xmlAttributes = ContainerUtil.filter(tag.getAttributes(), attribute -> !attributes.containsKey(attribute.getLocalName())); XmlAttribute defaultAttribute = findImpliedAttribute(xmlAttributes); if (defaultAttribute == null) { defaultAttribute = findEmptyAttribute(xmlAttributes); } if (defaultAttribute != null) { String attributeName = defaultAttribute.getName(); if (attributeName.length() > 1) { if (isImpliedAttribute(attributeName)) { defaultAttribute = (XmlAttribute)defaultAttribute.setName(attributeName.substring(1)); } final String oldValue = defaultAttribute.getValue(); if (oldValue != null && StringUtil.containsChar(oldValue, '|')) { defaultAttribute.setValue(StringUtil.replace(oldValue, "|", defaultAttributeValue)); } else { defaultAttribute.setValue(defaultAttributeValue); } } } } // boolean attributes for (XmlAttribute xmlAttribute : tag.getAttributes()) { final String attributeName = xmlAttribute.getName(); final XmlAttributeValue xmlAttributeValueElement = xmlAttribute.getValueElement(); if ((xmlAttributeValueElement != null && !attributes.containsKey(attributeName) || isImpliedAttribute(attributeName) || TemplateImplUtil.isValidVariable(attributeName))) { continue; } String attributeValue = StringUtil.notNullize(attributes.get(attributeName), StringUtil.notNullize(xmlAttribute.getValue())); if (ZenCodingUtil.containsSurroundedTextMarker(attributeValue)) { myContainsSurroundedTextMarker = true; } if (isHtml && isBooleanAttribute(attributeValue, xmlAttribute, callback)) { if (HtmlUtil.isShortNotationOfBooleanAttributePreferred()) { if (xmlAttributeValueElement != null) { final PsiElement prevSibling = xmlAttributeValueElement.getPrevSibling(); if (prevSibling != null && prevSibling.textMatches("=")) { xmlAttribute.deleteChildRange(prevSibling, xmlAttributeValueElement); } } } else { if (xmlAttributeValueElement == null) { xmlAttribute.delete(); } tag.setAttribute(attributeName, attributeName); } } else { if (xmlAttributeValueElement == null) { xmlAttribute.delete(); } tag.setAttribute(attributeName, StringUtil.isEmpty(attributeValue) ? "$" + prepareVariableName(attributeName) + "$" : ZenCodingUtil.getValue(attributeValue, myNumberInIteration, myTotalIterations, mySurroundedText)); } } // remove all implicit and default attributes for (XmlAttribute xmlAttribute : tag.getAttributes()) { final String xmlAttributeLocalName = xmlAttribute.getLocalName(); if (xmlAttribute.getValue() != null && isImpliedAttribute(xmlAttributeLocalName)) { xmlAttribute.delete(); } } } | setAttributeValues |
304,458 | boolean (@Nullable String attributeValue, @NotNull XmlAttribute xmlAttribute, @NotNull CustomTemplateCallback callback) { if (XmlEmmetParser.BOOLEAN_ATTRIBUTE_VALUE.equals(attributeValue)) { return true; } if (StringUtil.isEmpty(attributeValue)) { final XmlAttributeDescriptor descriptor = xmlAttribute.getDescriptor(); return descriptor != null && HtmlUtil.isBooleanAttribute(descriptor, callback.getContext()); } return false; } | isBooleanAttribute |
304,459 | boolean (String xmlAttributeLocalName) { return StringUtil.startsWithChar(xmlAttributeLocalName, '!'); } | isImpliedAttribute |
304,460 | boolean (String attributeValue) { return attributeValue != null && (attributeValue.isEmpty() || ATTRIBUTE_VARIABLE_PATTERN.matcher(attributeValue).matches()); } | isEmptyValue |
304,461 | boolean (CharSequence text, int offset) { int i = offset - 1; while (i >= 0 && Character.isWhitespace(text.charAt(i))) { if (text.charAt(i) == '\n') { return true; } i--; } return i < 0; } | isNewLineBefore |
304,462 | boolean (CharSequence text, int offset) { int i = offset; while (i < text.length() && Character.isWhitespace(text.charAt(i))) { if (text.charAt(i) == '\n') { return true; } i++; } return i == text.length(); } | isNewLineAfter |
304,463 | TemplateToken () { return myTemplateToken; } | getTemplateToken |
304,464 | String () { return mySurroundedText; } | getSurroundedText |
304,465 | void (String surroundedText) { mySurroundedText = surroundedText; } | setSurroundedText |
304,466 | GenerationNode () { return myParent; } | getParent |
304,467 | void (GenerationNode parent) { myParent = parent; } | setParent |
304,468 | String () { return myText; } | getText |
304,469 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { final TemplateToken templateToken = new TemplateToken(""); final boolean containsSurroundedTextMarker = ZenCodingUtil.containsSurroundedTextMarker(myText); final String text = ZenCodingUtil.replaceMarkers(myText.replace("${nl}", "\n"), numberInIteration, totalIterations, surroundedText); final TemplateImpl template = new TemplateImpl("", text, ""); templateToken.setTemplate(template, callback); final GenerationNode node = new GenerationNode(templateToken, numberInIteration, totalIterations, containsSurroundedTextMarker ? null : surroundedText, insertSurroundedTextAtTheEnd, parent); return Collections.singletonList(node); } | expand |
304,470 | int (@Nullable CustomTemplateCallback callback) { return myText.length(); } | getApproximateOutputLength |
304,471 | String () { return "Text(" + myText + ")"; } | toString |
304,472 | ZenCodingNode () { return myOperand; } | getOperand |
304,473 | List<GenerationNode> (int numberInIteration, int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { if (surroundedText == null) { return myOperand.expand(numberInIteration, totalIterations, null, callback, insertSurroundedTextAtTheEnd, parent); } String[] lines = LineTokenizer.tokenize(StringUtil.trim(surroundedText), false); List<GenerationNode> result = new ArrayList<>(); for (int i = 0; i < lines.length; i++) { String line = lines[i].trim(); result.addAll(myOperand.expand(i, lines.length, line, callback, insertSurroundedTextAtTheEnd, parent)); } return result; } | expand |
304,474 | int (@Nullable CustomTemplateCallback callback) { return myOperand.getApproximateOutputLength(callback); } | getApproximateOutputLength |
304,475 | String () { return "*"; } | toString |
304,476 | String () { return myText; } | getText |
304,477 | String () { return myText; } | toString |
304,478 | PsiFile () { return myFile; } | getFile |
304,479 | String () { return myFile.getText(); } | getTemplateText |
304,480 | void (PsiFile file) { myFile = file; } | setFile |
304,481 | boolean () { return myForceSingleTag; } | isForceSingleTag |
304,482 | void (@NotNull String templateText, @NotNull PsiFile context) { PsiFile file = PsiFileFactory.getInstance(context.getProject()) .createFileFromText("dummy.html", context.getLanguage(), templateText, false, true); VirtualFile vFile = file.getVirtualFile(); if (vFile != null) { UndoUtil.disableUndoFor(vFile); } setFile(file); } | setTemplateText |
304,483 | String () { return myKey; } | getKey |
304,484 | void (@NotNull TemplateImpl template, @NotNull CustomTemplateCallback callback) { myTemplate = template; setTemplateText(createTemplateText(template, callback, getAttributes()), callback.getFile()); } | setTemplate |
304,485 | boolean (@NotNull TemplateImpl template) { for (int i = 0; i < template.getVariableCount(); i++) { String varName = template.getVariableNameAt(i); if (ATTRS.equals(varName)) { return true; } } return false; } | containsAttrsVar |
304,486 | String (@NotNull TemplateImpl template, @NotNull CustomTemplateCallback callback, @NotNull Map<String, String> attributes) { XmlTag dummyRootTag = null; String templateString = template.getString(); if (!containsAttrsVar(template)) { PsiFile dummyFile = PsiFileFactory.getInstance(callback.getProject()) .createFileFromText("dummy.html", callback.getFile().getLanguage(), templateString, false, true); dummyRootTag = PsiTreeUtil.findChildOfType(dummyFile, XmlTag.class); if (dummyRootTag != null && !attributes.isEmpty()) { addMissingAttributes(dummyRootTag, attributes); } } return dummyRootTag != null ? dummyRootTag.getContainingFile().getText() : templateString; } | createTemplateText |
304,487 | void (@NotNull XmlTag tag, @NotNull Map<String, String> attributes) { for (Map.Entry<String, String> attribute : attributes.entrySet()) { if (!XmlEmmetParser.DEFAULT_ATTRIBUTE_NAME.equals(attribute.getKey()) && tag.getAttribute(attribute.getKey()) == null) { XmlTag htmlTag = XmlElementFactory.getInstance(tag.getProject()).createHTMLTagFromText("<dummy " + attribute.getKey() + "=\"\"/>"); final XmlAttribute newAttribute = ArrayUtil.getFirstElement(htmlTag.getAttributes()); if (newAttribute != null) { tag.add(newAttribute); } } } } | addMissingAttributes |
304,488 | String () { return "TEMPLATE"; } | toString |
304,489 | int () { return myNumber; } | getNumber |
304,490 | String () { return Integer.toString(myNumber); } | toString |
304,491 | String () { return myText; } | toString |
304,492 | String () { return myText; } | getText |
304,493 | String () { return mySuffix; } | getSuffix |
304,494 | String () { return "|" + mySuffix; } | toString |
304,495 | String () { return myText; } | toString |
304,496 | String () { return myText; } | getText |
304,497 | String () { return myString; } | toString |
304,498 | char () { return mySign; } | getSign |
304,499 | String () { return Character.toString(mySign); } | toString |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.