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

Syntax highlighting when using Jinja tags inside HTML tags #65

Closed n-wagner closed 4 years ago

n-wagner commented 4 years ago

Syntax doesn't seem to highlight if you're doing something like the below.

<div
  id={{ myId }}
  {% if myCondition %}
    class="myclass1"
  {% else %}
    class="myclass2"
  {% endif %}
></div>

Equivalently the control flow operators can be moved outside the tags and the highlighting will work, but this requires duplicating the tag.

{% if myCondition %}
  <div class="myclass1">
{% else %}
  <div class="myclass2">
{% endif %}
</div>

Setting an attribute doesn't have an equivalent as far as I am aware. Probably should allow it to be enclosed in strings too like the below as per this.

<div
  id="{{ myId }}"
></div>
samuelcolvin commented 4 years ago

this is a limitation of the syntax highlighter.

Simply use <div id="{{ myId }}"

n-wagner commented 4 years ago

Just to be clear, the quoting won't solve the issue of the syntax highlighting as of present. Was also wondering if this is a limitation of this given plugin, or a deeper one like some VS Code issue? Thanks!

samuelcolvin commented 4 years ago

Same route cause as #59 I think. An issue with vscode.