Skip to content

Commit

Permalink
Fix Twig auto-indent not working for HTML elements
Browse files Browse the repository at this point in the history
This commit also includes a naive attempt to add auto-indent support for
Twig tags. It does not work well in the following scenarios:

* when the cursor is after a ending block token: indentation should not
be added but is for now

**Current**
```
{% if true %}
{% endif %}
	<CURSOR>
```

**Wished**
```
{% if true %}
{% endif %}
<CURSOR>
```

* when we press return after an `{% else %}` statement: indentation for
the else statement should be removed instead of adding a new indent on
the new line

**Current**
```
{% if true %}
	{% else %}
		<CURSOR>
{% endif %}
```

**Wished**
```
{% if true %}
{% else %}
	<CURSOR>
{% endif %}
```

More advanced RegExp could be used to handle those cases.
  • Loading branch information
titouanmathis committed Feb 6, 2023
1 parent 54322cb commit de6e560
Showing 1 changed file with 587 additions and 0 deletions.
Loading

0 comments on commit de6e560

Please sign in to comment.