V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
JasonLaw
V2EX  ›  程序员

IntelliJ IDEA 格式化代码问题

  •  
  •   JasonLaw · 2021-08-31 15:19:47 +08:00 · 1664 次点击
    这是一个创建于 940 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码仓库中有一个名为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>
    
    4 条回复    2021-09-04 11:18:19 +08:00
    skai0dev
        1
    skai0dev  
       2021-08-31 15:32:24 +08:00   ❤️ 1
    File | Settings | Editor | Code Style | SQL | General => DDL => ALTER TABLE => 取消勾选"Indent altering instructions"
    JasonLaw
        2
    JasonLaw  
    OP
       2021-08-31 15:42:58 +08:00
    @skai0dev #1 谢谢,不过弄反了,想要变成上面那样,需要勾选"Indent altering instructions"才对。
    Flicker
        3
    Flicker  
       2021-09-01 15:27:58 +08:00   ❤️ 1
    建议导出一个.editorconfig,大家统一
    JasonLaw
        4
    JasonLaw  
    OP
       2021-09-04 11:18:19 +08:00
    @Flicker #3
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4453 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:05 · PVG 09:05 · LAX 18:05 · JFK 21:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.