kevin wang
kevin wang

Reputation: 119

IntelliJ formats the whole file even if I do not highlight any code

My IDE is IntelliJ and my laptop is Mac OS.

When I click Code -> Reformat Code, even if I am not highlighting any code, the whole file gets reformatted.

How to make it format nothing if no code is highlighted?

Thank!

Upvotes: 0

Views: 127

Answers (1)

Koyasha
Koyasha

Reputation: 6857

The behavior is expected, see corresponding help page:

enter image description here

If you don't want any of the code reformatted, do not invoke the Reformat Code action.

You can always undo the misfired reformatting with Meta+Z.

Upvotes: 1

Related Questions