izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.35k stars 202 forks source link

Apache Freemarker-Template Language Support #2698

Open ChrNi-CleverProcess opened 5 months ago

ChrNi-CleverProcess commented 5 months ago

Have you checked the issues and discussions to ensure there are no duplicates?

Yes

Your programming languages

Java

Free or paid?

Paid users

Expected Behavior

I have to work with the famous Apache Freemarker template engine now. Freemarker Template Language (.ftl) seems not to be supported right now by Rainbow brackets. https://freemarker.apache.org/docs/ref_directives.html

The directives there are similar like HTML but with a hash char: <#if>…</#if> But there are directives, which don't need closing tags... like <#ftl...>, <#import ...>, <#assign ...>

Code snippet for test

<#if x == 1>
  x is 1
</#if>
<#if x == 1>
  x is 1
<#else>
  x is not 1
</#if>
<#if x == 1>
  x is 1
<#elseif x == 2>
  x is 2
<#elseif x == 3>
  x is 3
<#elseif x == 4>
  x is 4
<#else>
  x is not 1 nor 2 nor 3 nor 4
</#if>

not allowed: <#if>…<#else>...<#else>...</#if>

<#import "/libs/commons.ftl" as com>
<#ftl encoding="UTF-8">

i.e. assign

<#assign seq = ["foo", "bar", "baz"]>
<#macro myMacro>foo</#macro>
<#assign x>
  <#list 1..3 as n>
    ${n} <@myMacro />
  </#list>
</#assign>
Number of words: ${x?word_list?size}
${x}

Your Environment

IntelliJ IDEA 2023.3.1 (Ultimate Edition) Build #IU-233.11799.300, built on December 12, 2023 Licensed to C***N***e Subscription is active until May 1, 2024. Runtime version: 17.0.9+7-b1087.7 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 8192M Cores: 12 Registry: ide.balloon.shadow.size=0 debugger.watches.in.variables=false ide.experimental.ui=true Non-Bundled Plugins: lermitage.intellij.extratci (1.29.0) com.jetbrains.edu (2023.11-2023.3-421) com.github.copilot (1.4.4.3955) com.intellij.properties.bundle.editor (233.11799.172) Key Promoter X (2023.3.0) co.bito.bito-intellij (1.2.6) com.chylex.intellij.coloredicons (1.5) org.intellij.RegexpTester (2.2.0) org.igu.plugins.bettercomments (1.0) com.jetbrains.jax.ws (233.11799.196) org.strangeway.vaadin (233.11799.196) com.intellij.spring.shell (233.11799.196) com.intellij.spring.websocket (233.11799.196) com.intellij.lang.jsgraphql (233.11799.172) com.intellij.javaee.ejb (233.11799.196) com.jetbrains.packagesearch.intellij-plugin (233.11799.196) com.linsage (1.0.7) MavenRunHelper (4.27.1-IJ2022.2) izhangzhihao.rainbow.brackets (2023.3.9-233) com.haulmont.jpab (2023.4.1-233) ru.adelf.idea.dotenv (2023.3) com.intellij.ml.llm (233.11799.300) com.crunch42.openapi (1.69) com.mallowigi (94.1.0) cn.yiiguxing.plugin.translate (3.5.6) com.intellij.spring.graphql (233.11799.196) Kotlin: 233.11799.300-IJ