• 请不要在回答技术问题时复制粘贴 AI 生成的内容
JasonLaw
V2EX  ›  程序员

IntelliJ IDEA 格式化代码问题

  •  
  •   JasonLaw · Aug 31, 2021 · 2225 views
    This topic created in 1729 days ago, the information mentioned may be changed or developed.

    代码仓库中有一个名为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 replies    2021-09-04 11:18:19 +08:00
    JUSTIGNOREME
        1
    JUSTIGNOREME  
       Aug 31, 2021   ❤️ 1
    File | Settings | Editor | Code Style | SQL | General => DDL => ALTER TABLE => 取消勾选"Indent altering instructions"
    JasonLaw
        2
    JasonLaw  
    OP
       Aug 31, 2021
    @skai0dev #1 谢谢,不过弄反了,想要变成上面那样,需要勾选"Indent altering instructions"才对。
    Flicker
        3
    Flicker  
       Sep 1, 2021   ❤️ 1
    建议导出一个.editorconfig,大家统一
    JasonLaw
        4
    JasonLaw  
    OP
       Sep 4, 2021
    @Flicker #3
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5277 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 01:27 · PVG 09:27 · LAX 18:27 · JFK 21:27
    ♥ Do have faith in what you're doing.