Live templates file does not exist in pycharm templates folder?

不羁岁月 提交于 2021-01-28 18:04:02

问题


I wanted to insert multiple live templates. For example whenever I type prop and press tab, then pycharm would write the full property for python.

I wanted to import the following list: https://github.com/hoffmann/PyCharm-Python-Templates

But I can not find the templates folder in <your home directory>\.<product name><version number>\config\templates, as said in https://www.jetbrains.com/help/pycharm/2016.1/live-templates.html

Also I am using the community edition 2016.1.4.


回答1:


I got this to work on Windows when I used the path <your home directory>\.PyCharm2018.3\config\jba_config\templates\user.xml (my version of PyCharm is 2018.3.4)

In case this doesn't work for you, you may find where the file belong by following what I did.

  • Open File | Settings | Editor | Live Templates in PyCharm, created a new template called MyNewUniqueLiveTemplate
  • On the command line in the directory <user directory>\.PyCharm2018.3\config "grep"ed for the string MyNewUniqueLiveTemplate.



回答2:


I've had the same issue and found that there is one simplest way to insert multiple live templates.

  • Just copy desired template code from *.XML file,
  • open PyCharm's Live Templates Settings (Ctrl+Alt+S -> Editor / Live Templates),
  • select Template Group (such as Python or create your own like a 'user'),
  • and paste in the value. That's all!

It works fine dependless of the operating system, PyCharm version and you shouldn't worry about PyCharm config files location.

You can insert in that way multiply live templates at once.



来源:https://stackoverflow.com/questions/38370553/live-templates-file-does-not-exist-in-pycharm-templates-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!