IntelliJ IDEA 格式化代码问题

2021-08-31 15:19:47 +08:00
 JasonLaw

代码仓库中有一个名为db.changelog-master.xml的文件,里面包含如下内容:

<changeSet id="2021-08-25-001" author="Jason Law-current_feature">
    <sql>
        alter table shop_dish_revenue
            add dish_specification varchar(50) not null comment '菜品规格' after dish_code;
    </sql>
</changeSet>

但在我同事的电脑上格式化代码的话,会变成下面这样,为什么呢?怎么可以格式化成上面那样?

<changeSet id="2021-08-25-001" author="Jason Law-current_feature">
    <sql>
        alter table shop_dish_revenue
        add dish_specification varchar(50) not null comment '菜品规格' after dish_code;
    </sql>
</changeSet>
1683 次点击
所在节点    程序员
4 条回复
skai0dev
2021-08-31 15:32:24 +08:00
File | Settings | Editor | Code Style | SQL | General => DDL => ALTER TABLE => 取消勾选"Indent altering instructions"
JasonLaw
2021-08-31 15:42:58 +08:00
@skai0dev #1 谢谢,不过弄反了,想要变成上面那样,需要勾选"Indent altering instructions"才对。
Flicker
2021-09-01 15:27:58 +08:00
建议导出一个.editorconfig,大家统一
JasonLaw
2021-09-04 11:18:19 +08:00
@Flicker #3 <amp-youtube data-videoid="vjVWjocENLg" layout="responsive" width="480" height="270"></amp-youtube>

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/799062

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX