문제

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.

도움이 되었습니까?

해결책

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)

다른 팁

For me the solution was to disable the EditorConfig support. In Editor -> Code Style

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top