Closed JannieT closed 1 year ago
Same thing here, indents are wrong. I had to downgrade to previous version, 0.18.0.
This is most likely caused by #118, @devmattrick @nathan-barrett any ideas what's going on?
I believe that formatting was not working before the update to load vscode html language features. Now, it is triggering the html formatters which don't understand how to handle jinja templates. As far as I know, there isn't a way to configure prettier or the built-in formatter to handle the jinja template tags and there isn't another extension that handles it.
It is possible to disable auto formatting just for jinja-html files in your settings.json. That's how I am working around this change:
"[jinja-html]": {
"editor.formatOnSave": false
}
great, thanks for the explanation.
Afaik there's kinda no way to make HTML Language Features understand how to indent Jinja templates, right? Maybe it would be possible to add a Jinja HTML formatter to the Better Jinja extension itself? That might be a lot of work, though.
Prettier support is kinda unrelated since Prettier doesn't seem to support Jinja out of the box, not something that this extension can fix short of writing a Prettier plugin.
Looks like I misunderstood the role of this extension. I did not realise that it is focused on syntax highlighting. I was looking for a code formatter. Thanks for clarifying.
Happy to review a PR to add formatting if someone wants to have a crack at it.
This might be an installation / configuration issue, because the extension is not working for me at all. I installed the extension and changed this in my settings.json for the project:
After I restart VS Code and open a template file, I get a warning that:
I have only
vscode.html-language-features
andesbenp.prettier-vscode
to choose from. If I choose either of those and save my template file, the formatting the template tags does not get indented:I would have expected that line 26 and line 34 would be indented. Am I missing something?