For loop indentation is not taking place in jinja2 templating in vscode

Viewed 114

I am writing a for loop or if else using jinja2 templating but it is not giving me indentation in vscode. Fore example, I wrote this:

{% extends 'base.html' %}
{% block content %}
<h2>This is Item List</h2>

{% for item in items %}
    <p>{{items}}</p>
{% endfor %}

{% endblock content %}

But when I press Ctrl s or save it manually, it loses the indentation. The code becomes like this:

{% extends 'base.html' %}
{% block content %}
<h2>This is Item List</h2>

{% for item in items %}
<p>{{items}}</p>
{% endfor %}

{% endblock content %}

This is happening for for loops, if else and everything inside jinja2 templating. Not happening in normal python codes. This is not giving any error, but I feel distressed. How to solve it.

1 Answers
Related