IntelliJ syntax highlighting for jinja files (.jinja, .j2) - intellij-idea

Question is pretty much in the title. Does IntelliJ have native syntax highlighting for .jinja and .j2 files?
If not is there a plugin?

This plugin: https://plugins.jetbrains.com/plugin/7792-yaml-ansible-support offers some support for jinja files.
To ensure that this plugin is associated with jinja files:
Go to File > Preferences > Editor > File Types
Under Recognized File Types scroll down to YAML/Ansible and select it
Under Registered Patterns click the + icon and enter *.jinja.
With this configuration in place your jinja files will open into this plugin. If they do not, then jinja files must be already associated with one of the other Recognized File Types in which case you'll need to scroll through them to find the culprit and remove *.jinja from its Registered Patterns.

Try the Python plugin with IntelliJ IDEA Ultimate, that has support for Jinja2 Templates.

With recent version of Intellij, you don't need any plugin any more.
Go to File > Settings > Editor > File Types
Under Recognized Files Types, choose Jinja 2 Template
Under File Name Patterns add *.j2 for jinja2, and/or *.jinja for jinja
For Ansible yaml jinja 2 templates:
Under Recognized Files Types, choose YAML/Ansible
Under File Name Patterns add *.yaml.j2 and *yml.j2

Just for sanity sake. I found my solution in a combination of both answers previously posted.
Besides the Python plugin as #Andrei states it is needed that the file extension is recognized as explained above by #glytching: File > Preferences > Editor > File Types, for me the pattern *.j2 was missing.
As a good thing to do also would be to mark the directory as Template as described in section To define template directories on the referenced templates link given by #Andrei:
1. In the Settings/Preferences dialog, click the Project Structure page.
2. Choose the directory to be marked as a template root.
3. Do one of the following:
* Click Templates on the toolbar of the Content roots pane.
* Choose Templates on the directory's context menu.

Related

IntelliJ does not recognize kotlin file after deleting it and recreate with the same name

I am currently having a problem with IntelliJ. I am using Kotlin in my project. I have deleted a file (let's say test.kt), and now, I want to create a new file with the same name. IntelliJ does not recognize the kotlin syntaxe and show it as a text file.
When I have deleted I have unchecked "safe delete" and "Search in comment and strings"
Can anyone help me in this matter ?
Edit : I tried to delete .idea and .iml file, restart intelliJ. It does not change anything.
"Overrid File Type" to Kotlin would work.
Expanding on a comment:
Is test.kt listed in Preferences > Editor > File Types > Text, under the Registered Patterns? An entry there may override the default Kotlin filetype
I had a class, MyProxy.kt, that as the question implies was not being picked up as a Kotlin class in IntelliJ. I scrolled through my list of file associations and did not find anything that could match MyProxy.kt except for the Kotlin extension, *.kt (it is entirely possible I missed something.)
Most regex matching will apply the most specific rule, though. On the off chance my class was being picked up by another association, I explicitly declared it as a Kotlin file pattern. It is a little hacky, but it did work! My Kotlin file name patterns are now:
*.kt
*.kts
*.main.kts
MyProxy.kt
Note: IntelliJ did complain that *.kt would already catch MyProxy.kt, but I overrode it.
Ctrl+alt+s, Editor, File Types, under recognized filetypes,
Under Filetype auto-detected by file content...
remove Main.kt

How do I make my modified Intellij 'intention' available to my colleagues?

I have modified an Intellij 'intention'. (I changed the initialization of the JUnit test class).
How do I make this available to other members of my organization? We are all working on the same Intellij 'project', but I believe that these changes are on a per-user, not per-project basis. (If there is a way to make the changes apply only to one project, I would prefer that).
File | Export Setting / File | Import Settings.
Are more robust way would be to use the Settings Repository plug-in.
Templates are stored in the %CONFIG% directory, fileTemplates subdirectory.
To export the file, you set the 'Schema:' pulldown in the upper right corner of 'Settings->Editor->File and Code Templates->Code tab' to 'Project' This will cause IDEA to create a folder PROJECT/.idea/fileTemplates/code, and put your modified file there. Details are in:
https://www.jetbrains.com/help/idea/2016.3/file-and-code-templates.html#d2040410e142

Exporting code style settings from IntelliJ IDEA version 14.1.5

I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at https://confluence.jetbrains.com/display/IntelliJIDEA/Code+Styles and http://forum.shakacode.com/t/sharing-your-intellij-rubymine-webstorm-codestyle-among-developers/240, which seems fairly simple.
Unfortunately that is not how my 'export settings' pane looks like, and I don't have a line that says 'code styles'. Mine looks like
The closest I can find is the line I highlighted which has CodeStyleSettingsManager in it along with a whole bunch of other stuff. However I tried using that and extracted the .jar file only to find that there was nothing much inside at all.
Does anyone know a way of exporting code styles that works with the latest version of IntelliJ?
Edit: My codeStyleSettings.xml file only contains the following:
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value/>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
</project>
I don't understand, why you don't see Code Style in your list (it appears in my IDEA 14.1.5), but...
(...) export my code style settings so that they can be used by all developers working on a particular project
A better way to share the project code style across all developers is to include it in your VCS repository. Pulling such a commit will apply those code styles automatically. This is the file: project/.idea/codeStyleSettings.xml. If your VCS is set to ignore .idea/, add an exception for this file.
If you don't see this file at all, you're probably using a local formatter and your Project scheme is unchanged. In this case, go to Settings > Editor > Code Style > Scheme: Manage, select your formatter and click Copy to Project.
Update
Code style files only state the difference to the IDEA Default Code style (which is always the same). You can try this yourself: create a new project, go the the Code Style settings, select Project and change only one option. The codeStyleSettings.xml file will be created, and it will contain only this one option. If you could export your code style settings, the output would be exactly the same.

Is there a way to change the Doxygen term Modules in the tree and in the right pane pages to something else?

I am using Doxygen groups and therefore see them listed in the Doxygen navigation tree under Modules, as expected. My project is documenting integration using Zend modules and therefore Doxygen Modules and the Zend modules tend to overload the term modules and make it confusing for the readers. My question is: is there a way, preferably an automated way, to change the Doxygen term Modules in the tree and in the right pane pages to something else?
I've sucessfully changed the word 'Modules' in the past, but I've only ever needed to do this for the top-of-page tabs, and not the navigation tree. The method I used than may also work for you:
You need a fresh Layout file.
Generate one with doxygen -l layoutfilename.xml
Locate the line containing type="modules"
Change the title entry from "" to "Your Word" - I used "Index"
Specify the replacement layout file in you doxyfile.
After you did like the suggestion above.
If you want to manually replace it for PDF file that generates from latex you can open refman.tex go to %--- Begin generated contents --- and change to something like this:
(Note that I marked the lines you should edit with <========)
%--- Begin generated contents ---
\chapter{Main Page}
\label{index}\hypertarget{index}{}\input{index}
\chapter{Index Index} <========
\input{index} <========
\chapter{Index Documentation} <========
\input{whatever was here before}
%--- End generated contents ---
After that go to modules.tex and change the filename to index.tex (for this example).

Why does the default IntelliJ default class javadoc comment use non-standard syntax?

Why does the default IntelliJ default class javadoc comment use non-standard syntax? Instead of creating a line with "User: jstauffer" it could create a line with "#author jstauffer". The other lines that it creates (Date and Time) probably don't have javadoc syntax to use but why not use the javadoc syntax when available?
For reference here is an example:
/**
* Created by IntelliJ IDEA.
* User: jstauffer
* Date: Nov 13, 2007
* Time: 11:15:10 AM
* To change this template use File | Settings | File Templates.
*/
I'm not sure why Idea doesn't use the #author tag by default.
But you can change this behavior by going to File -> Settings -> File Templates and editing the File Header entry in the Includes tab.
As of IDEA 14 it's: File -> Settings -> Editor -> File and Code Templates -> Includes -> File Header
In AndroidStuido 1.0.2 on Mac
Go in Preferences
then on left span File and Code Templates
After selecting file and code templates on right hand side select includes tab select
file Header and change your file header.
The default is readable, usable, but does not adhere to or suggest any coding standard.
I think the reason IntelliJ doesn't use the Javadoc tags in the default, is so that it avoids possible interference with any coding/javadoc standards that might exist in development shops. It should be obvious to the user if the default needs to be modified to something more appropriate.
Where I am working, the use of author tags is discouraged, for various reasons.
Because it's a default file template that you're supposed to change to your organization's standard, or your tastes.
My best guess.
It is likely that the header snippet you show is older than javadoc and was just borrowed from some coding standard document, probably written for C++.