简体   繁体   中英

intellij formating inconsistant

Hy, it's not a big issue, but anyway:

All my other coworker code is auto-formated like that:

        output = output.update(
                par1,
                par2
        );

mine is autoformated like that:

       output = output.update(
            par1,
            par2
        );

more specificaly: the tabulation for their parameters method have 2x 4 space, mine have 1x4 spaces

any idea which how to change this codestyle rules? We use a common formater file, but somehow, I don't have the same things than everyone else.

Edit: It's java code, I need the name of the rules who manage that

This is almost certainly down to the settings in Intellij's Editor preferences.

Open the settings panel and search for code format or open the Editor > Code Style > Java options.

Code Formatting page

In here you'll options to change pretty much every part of your code layout.

You can also import and export schemes, which can keep things consistent across your company. More information on how to do that can be found on the jetbrains site.

As already indicated, Intellij-IDEA (and all its variants) have a Code Style per language (and even per-project).

代码样式的 Intellij IDEA 设置

The preview on the right side is live-updated, so if you change settings on the left, they will be reflected on the right.

Please note that not all options are available for all languages and it's often a matter of playing a bit with it.

An alternative is that your coworkers can EXPORT the settings they are using and you can import them.

They would export it by tapping the "gear" (?) next to the Scheme:

显示代码样式设置的导出选项的菜单弹出窗口的图像

You can then Import them by using the "import Scheme" option;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM