How to stop PyCharm from autocompleting HTML and D

2019-05-16 22:28发布

When I'm writing Django templates with PyCharm it automatically closes them; this is reasonably helpful when I'm starting a new tag, but if my intention is to place some already existing content inside a different tag it tends to get a bit annoying, as I then have to delete or move the closing tag, e.g. I'll end up with something like this.

<div></div>Already existing text.

Is there any way of disabling this feature?

2条回答
女痞
2楼-- · 2019-05-16 23:06

You can modify the smart keys functionality of the Editor by doing the following:

  1. Go to Settings --> Editor --> General --> Smart Keys
  2. Uncheck "insert closing tag on tag completion" under the "XML/HTML" section.
查看更多
虎瘦雄心在
3楼-- · 2019-05-16 23:09

Apprently, there is a way to achieve this already in PyCharm.

  • Select the desired code fragment.
  • Do one of the following:
  • On the main menu, choose Code | Surround With
  • Press Ctrl+Alt+T
  • A pop-up window displays the list of enclosing statements according to the context.

Select the desired surround statement from the list. To do that, use the mouse cursor, up and down arrow keys, or a shortcut key displayed next to each element of the list.

Here is the relevant documentation for Wrapping

Here is the documentation for unwrapping

EDIT:

The Shortcut for Tags is Ctrl+Alt+J

Here is the relevant documentation for tags

查看更多
登录 后发表回答