Vic*_*Cui 3 intellij-idea jinja2
标题中几乎没有问题。IntelliJ是否对* .jinja文件具有本机语法突出显示?如果没有插件?
And*_*rey 19
尝试使用 IntelliJ IDEA Ultimate的Python插件,它支持 Jinja2模板。
veb*_*ben 15
使用最新版本的 Intellij,您不再需要任何插件。
Recognized Files Types
,选择Jinja 2 模板File Name Patterns
在添加*.j2
jinja2 和/或*.jinja
jinja下对于 Ansible yaml jinja 2 模板:
Recognized Files Types
,选择YAML/AnsibleFile Name Patterns
添加*.yaml.j2
和*yml.j2
该插件:https : //plugins.jetbrains.com/plugin/7792-yaml-ansible-support提供了对jinja
文件的一些支持。
为确保此插件与jinja
文件关联:
File > Preferences > Editor > File Types
Recognized File Types
滚动YAML/Ansible
并选择在下面Registered Patterns
单击+
图标,然后输入*.jinja
。
使用此配置后,您的jinja
文件将打开此插件。如果它们不存在,则jinja files
必须已经与另一个中的一个相关联,Recognized File Types
在这种情况下,您将需要滚动它们以找到罪魁祸首并*.jinja
从中删除Registered Patterns
。
只是为了理智。我在之前发布的两个答案的组合中找到了我的解决方案。
除了@Andrei 指出的Python插件之外,还需要识别文件扩展名,如上面 @glytching: 所解释的那样File > Preferences > Editor > File Types
,对我来说,该模式*.j2
丢失了。
最好的做法是标记目录,如在@Andrei 给出的引用模板链接上定义模板目录Template
部分中所述:
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.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2716 次 |
最近记录: |