Intellij自定义XML标签格式

时间:2018-09-20 16:24:52

标签: xml intellij-idea format coding-style vxml

我目前正在尝试让Intellij自动格式化我的工作想要显示某些标签的方式。我最喜欢Intellij的默认XML格式-减去一个例外。例如,当自动格式化某些VXML代码时,它会显示出精美且嵌套的内容,例如:

<if cond="true">
    <script>function();</script>
    <assign name="example"
            expr="examplexpr" />
</if>

所有内容都很好地嵌套在一起。虽然,但我不想嵌套<log>标签。我希望他们成为一条直线。例如,它们是自动格式化后的外观:

<log><value expr="applicationName"/>:<value expr="currentPage"/>: RecordStart output: eduid=
    <value expr="eduid"/>
</log>

我希望Intellij仅将<log>标签自动格式化为单行格式,例如:

<log><value expr="applicationName"/>:<value expr="currentPage"/>: RecordStart output: eduid=<value expr="eduid"/></log>

我不知道如何实现此功能,因为我认为您只能为某些标签自定义格式,对吗?

1 个答案:

答案 0 :(得分:1)

您可以在编写VXML代码时更改语句,如下所示:

<log expr="applicationName + ' : ' + currentPage +' : RecordStart output: eduid='+ eduid"/>

检查此!希望它将解决您在一行中打印日志的问题。