junstyle / vscode-django-support

django formatter, highlight...
https://marketplace.visualstudio.com/items?itemName=junstyle.vscode-django-support
Apache License 2.0
4 stars 0 forks source link

Unwanted extra spaces added between tags #30

Closed SteveGiralt closed 1 month ago

SteveGiralt commented 2 months ago

My Code:

                {% for contact in unassigned_contacts|get_dict_item:office %}
                  {{ contact.name }}{% if contact.team %} ({{ contact.team }}){% endif %}{% if not forloop.last %}, {% endif %}
                {% endfor %}
      </para>

Output: John Doe, Jane Doe

After formatter runs the code becomes:

<para style="default-sm">
                {% for contact in unassigned_contacts|get_dict_item:office %}
                  {{ contact.name }}{% if contact.team %}
                    ({{ contact.team }})
                  {% endif %}
                  {% if not forloop.last %}, {% endif %}
                {% endfor %}
</para>

Output: John Doe , Jane Doe

Expected Behavior: Don't insert the extra space between first contact.name and comma

junstyle commented 1 month ago
<para style="default-sm">
                {% for contact in unassigned_contacts|get_dict_item:office %}
                  {{- contact.name -}}{%- if contact.team -%}
                    ({{- contact.team -}})
                  {%- endif -%}
                  {%- if not forloop.last %}, {% endif -%}
                {% endfor -%}
</para>
SteveGiralt commented 1 month ago
Screenshot 2024-07-01 at 11 44 05 AM

This code results in a syntax error