在自闭合标签之前添加空间

在基于WebStorm / IntelliJ的产品中,如何在自动结束标记中的结束标记之前包含空格?

默认设置轮流<ReactComp /><ReactComp/>,这是不合规矩的(一个JSX-空间之前关闭的常用AirBNBs的JavaScript风格指南)。

宝儿2020/04/03 11:38:33

Maybe a little confusingly, the setting is under "HTML" code style and not the JS code style in IntelliJ.

Enable the setting "In empty tag" in Preferences -> Editor -> Code Style -> HTML.

When you do an explicit reformat the space will be added. To ensure that the space is added when autocompleting React components, check the same box in in the Preferences -> Editor -> Code Style -> XML -> Other tab.

Screenshot from 2016-10-12, IntelliJ IDEA 2016.2

在此处输入图片说明