fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.63k stars 262 forks source link

How to set indentation of JavaScript within Twig blocks inside inline JavaScript? #1230

Closed jjnilton closed 1 year ago

jjnilton commented 2 years ago

Is there a way to set web-mode to indent JavaScript inside Twig blocks that are inside inline JavaScript?

Now when I try to indent the console.log line it stays this way:

<script>
    {% if condition %}
    console.log('Current indentation');
    {% endif %}
</script>

I want it to behave this way:

<script>
    {% if condition %}
        console.log('Current indentation');
    {% endif %}
</script>

I tried some padding/indenting options, but couldn't find one to do what I wanted. Is that possible? Thanks!

fxbois commented 1 year ago

should be solved with last commit