Search in sources :

Example 21 with TemplateImpl

use of com.intellij.codeInsight.template.impl.TemplateImpl in project intellij-community by JetBrains.

the class EmmetUpdateTagAction method expandTemplate.

@Nullable
private static String expandTemplate(@NotNull String abbreviation, @NotNull PsiFile file, @NotNull Editor editor) throws EmmetException {
    final CollectCustomTemplateCallback callback = new CollectCustomTemplateCallback(editor, file);
    ZenCodingTemplate.expand(abbreviation, callback, XmlZenCodingGeneratorImpl.INSTANCE, Collections.emptyList(), true, Registry.intValue("emmet.segments.limit"));
    TemplateImpl template = callback.getGeneratedTemplate();
    return template != null ? template.getTemplateText() : null;
}
Also used : TemplateImpl(com.intellij.codeInsight.template.impl.TemplateImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with TemplateImpl

use of com.intellij.codeInsight.template.impl.TemplateImpl in project intellij-community by JetBrains.

the class XmlZenCodingGenerator method generateTemplate.

@Override
public TemplateImpl generateTemplate(@NotNull TemplateToken token, boolean hasChildren, @NotNull PsiElement context) {
    String s = toString(token, hasChildren, context);
    TemplateImpl tokenTemplate = token.getTemplate();
    assert tokenTemplate != null;
    TemplateImpl template = tokenTemplate.copy();
    template.setString(s);
    return template;
}
Also used : TemplateImpl(com.intellij.codeInsight.template.impl.TemplateImpl)

Aggregations

TemplateImpl (com.intellij.codeInsight.template.impl.TemplateImpl)22 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 TemplateToken (com.intellij.codeInsight.template.emmet.tokens.TemplateToken)4 XmlZenCodingGenerator (com.intellij.codeInsight.template.emmet.generators.XmlZenCodingGenerator)3 Editor (com.intellij.openapi.editor.Editor)3 ZenCodingGenerator (com.intellij.codeInsight.template.emmet.generators.ZenCodingGenerator)2 InvokeTemplateAction (com.intellij.codeInsight.template.impl.InvokeTemplateAction)2 TextRange (com.intellij.openapi.util.TextRange)2 PsiElement (com.intellij.psi.PsiElement)2 PsiFile (com.intellij.psi.PsiFile)2 Matcher (java.util.regex.Matcher)2 ReformatCodeProcessor (com.intellij.codeInsight.actions.ReformatCodeProcessor)1 ExpressionLookupItem (com.intellij.codeInsight.lookup.ExpressionLookupItem)1 CustomLiveTemplate (com.intellij.codeInsight.template.CustomLiveTemplate)1 LiveTemplateBuilder (com.intellij.codeInsight.template.LiveTemplateBuilder)1 SmartCompletionContextType (com.intellij.codeInsight.template.SmartCompletionContextType)1 SingleLineEmmetFilter (com.intellij.codeInsight.template.emmet.filters.SingleLineEmmetFilter)1 ZenCodingFilter (com.intellij.codeInsight.template.emmet.filters.ZenCodingFilter)1 TemplateSettings (com.intellij.codeInsight.template.impl.TemplateSettings)1