Reputation: 380
I've used the "reformat code" option but it refuses to format the code to my custom settings. I have changed the "code style" settings in a new template and I'm using it. There is not option to change code style on a global level.
It continutes to format my code like this:
if (x) {
y();
}
It should look like this:
if (x)
{
y();
}
Any thoughts? Just to confirm I have gone into settings and changed the code style in my custom template for the project. I see no global code style option for the IDE settings.
Upvotes: 10
Views: 17198
Reputation: 2332
Latest AMD Software
version overrides Ctrl + Alt + L
.
It's a shortcut for Performance logging
.
In order to unset it, go to AMD Software
and select
Settings
(gear icon)->Hotkeys
->And replace that combination with something else:
BTW, I struggled a lot until I found what was intercepting that Intellj Autoformat
hotkey...
Upvotes: 2
Reputation: 311
Your editor may also be inheriting the settings from prettier.
For example, I use WebStorm and no matter what I did, it'd not get formatted according to my settings. I disable the prettier plugin, then my reformat file, and it finally works.
Upvotes: 2
Reputation: 1345
For my issue, it's because I installed google-java-format plugin, when it's enabled, it overwrites the code style setting.
Go to Preference -> Other Settings -> google-java-format Settings Uncheck the Enable google-java-format box.
Upvotes: 3
Reputation: 431
For me the solution was to disable the EditorConfig support. In Editor -> Code Style
Upvotes: 4
Reputation: 31906
Code styles are applied on a project level. There is no global setting. You can set a default style via Settings > Other Settings > Default Settings > [Template Project Settings] > Code Style Any new project will use that style.
That said... when you reformat you should get the styles you set. You need to verify that the configuration you created is set in the Settings > [Project Settings] > Code Style --> Scheme dialog. I seen some case where the default is actually reselected by mistake. You may want to double check the specific setting options in that scheme. Make sure the same code that is shown looks exactly like what you want.
Then run a code Layout reformat (Ctrl+Alt+L)
Upvotes: 5