jinja2 code formatting

It would be nice to have some formatting options for jinja2/html code.

The syntax is properly highlighted, but formatting is completely left at the whim of the user, and "reformatting" does nothing.

When I share code with people in my team we usually reformat all code before committing so to have a consistent style. It works for python code, for js code, for HTML code... but not for our templates.

We do it by hand, more or less. But we humans are fallible. :(

Is there a way to tell pycharm to reformat jinja2 files as HTML while respecting/highlighting the template tags?

Thanks and regards.
2
Avatar
Permanently deleted user
Hi Ivan, formatting of jinja2 templates works in PyCharm. Do you have jinja2 selected as template language on the Template Languages settings page (http://www.jetbrains.com/pycharm/webhelp/template-languages.html)?
1
Avatar
Permanently deleted user
I have this problem as well. Here's an example of switching between Django and Jinja templates: http://cl.ly/image/0T2a2V0X1H2F

This is in Professional 4.0.5. Any thoughts?
0
Avatar
Permanently deleted user
Actually, this may have been fixed by the latest RC. If so, apologies!
0

I'm using CLion and I have a license for the whole JetBrains suite of software. I'm writing Rust, which has a Jinja implementation, and I'd like to have file type support for Jinja files. What plugins do I need to install in CLion to get Jinja file type support?

 

0

Naftuli Kay template languages is a feature of PyCharm Professional. CLion comes with the bundled PyCharm Community functionality. So currently there is no way to get Jinja2 support in CLion. Feel free to comment or upvote a feature request about combining CLion and PyCharm Professional: https://youtrack.jetbrains.com/issue/CPP-13470. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

请先登录再写评论。