mitsuhiko / jinja2-tmbundle

Editor support
34 stars 36 forks source link

Filetypes are not registered - no syntax highlighting in IDEs #9

Open FractalizeR opened 9 years ago

FractalizeR commented 9 years ago

If you add this bundle to some editor, supporting many file extensions (like PHPStorm IDE for example), no syntax highlighting appears.

This happens, because the filetypes key in the file Syntaxes\Jinja Templates.tmLanguage is empty. I had to edit it to look like this to enable syntax highlighting of Ansible jinja templates in PHPStorm:

 <key>fileTypes</key>
    <array>
        <string>j2</string>
    </array>
cristiroma commented 6 years ago

Just to clarify for those coming like me from Google, you need to edit the file in this repository where you did the checkout as @FractalizeR (thanks!) said above, not .PHPStorm home directory or PHPStorm itself.

  1. Clone https://github.com/mitsuhiko/jinja2-tmbundle somewhere
  2. Edit Syntaxes\Jinja Templates.tmLanguage as above (replace )
  3. Add cloned repository folder to PHPStorm -> Settings -> Editor -> TextMate Bundles
  4. It should work now, but may be you will have to add “*.j2” to PHPStorm -> Settings -> Editor -> Filetypes -> Files supported via TextMate bundles

Excerpt from http://www.fractalizer.ru/frpost_900/enabling-ansible-jinja2-template-syntax-highlighting-in-phpstorm-and-other-editors/

ppar commented 5 years ago

The above PR should fix this issue