当前位置:网站首页>Make the text template in pycharm project support jinjia2 syntax

Make the text template in pycharm project support jinjia2 syntax

2022-06-22 16:10:00 The evening breeze brushed the willow face

File explorer finds the root directory of the project .idea In the folder Project name .iml file ( Hidden files )

use notepad++ Edit this iml file , stay component Sibling of label , Add the following code :

<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/templates" />
</list>
</option>
</component>

And then restart pycharm, Find out Jianji2 The syntax code highlights , It's a success

This method is equivalent to in pycharm Set the internal visual configuration

Here is another problem , These three default template files cannot be deleted

If you just want to html use jinjia2 engine , however xml What can I do without this engine ?

The answer is to xml The directory where the file is located is marked as   exclude

After the mark is excluded, the folder display effect is orange , In this way, the documents inside will not adopt jinjia2 The grammar , For example, the shortcut key annotation will not be {#   #} In form

In this way, the system can be loaded normally xml

2021-06-28 Add

Do not mark as excluded , Marking as a resource root is the best , It can ensure that there will not be jinjia2 grammar , It can also ensure that the global search can find

原网站

版权声明
本文为[The evening breeze brushed the willow face]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221448122764.html