samuelcolvin / jinjahtml-vscode

Syntax highlighting for jinja(2) html templates in vscode
https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml
MIT License
135 stars 53 forks source link

update folding markers to support optional whitespace control characters `-` #153

Open dhananjaipai opened 4 months ago

dhananjaipai commented 4 months ago

Hi, we are using jinja with terraform to generate providers dynamically. we are using

{%- if ....}
# Content here
{%- endif -%}

Since the folding markers in the language is, this never matches

"folding": {
    "markers": {
      "start": "{%\\s*(block|filter|for|if|macro|raw)",
      "end": "{%\\s*end(block|filter|for|if|macro|raw)\\s*%}"
    }
  }

Can you update these to

"folding": {
    "markers": {
      "start": "{%-{0,1}\\+{0,1}\\s*(block|filter|for|if|macro|raw)",
      "end": "{%-{0,1}\\+{0,1}\\s*end(block|filter|for|if|macro|raw)\\s*-{0,1}\\+{0,1}%}"
    }
  }

Refer Stackoverflow for more details.