Preventing IntelliJ code auto formatting from ruining your day

Today I ran into something extremely annoying while typing some JSON for a LibGDX tutorial.  LibGDX uses a naming convention that IntelliJ doesn’t like…  here, I’ll show you what I mean.

codeReform

Suffice to say… it’s pretty annoying.  What’s even more annoying is there is simply no way to turn this behavior off.  There is however a way to suppress it thankfully.  It isn’t intuitive however, so I figured I would make this post.  So hopefully if you are struggling with turning off IntelliJ automatic code reformatting in JSON, this will be useful to you.

Go to File->Settings… menu.  Locate Editor->Code Style settings.   Find “Formatter Control” and tick Enable Formatter markers in comments.

image

Now add // @formatter:off at the top of your file and edit like normal.   Now…

codeReform2

Much better!

Scroll to Top