Reformat (command+option+L) behaves differently with/without selection code block

Answered

I use Google formating file.

I have a code block like below:

private boolean isInProgress(A a) {
return Optional.of(a)
.map(A::getB)
.map(C.class::cast)
.map(C::getD)
.map(D::getE)
.stream()
.flatMap(List::stream)
.anyMatch();
}

When I press command+option+L without highlighting the code, it would usually reformat the entire class. Since this is the format I want, it says `no lines changed`.

But once I highlight my code block and press again, the reformatting changes the code to

private boolean isInProgress(A a) {
return Optional.of(a).map(A::getB)
.map(C.class::cast).map(C::getD).map(D::getE)
.stream()
.flatMap(List::stream)
.anyMactch();

So why the reformatting behaves differently? 

1
3 comments

Is it reproduced with all 3rd party plugins disabled? 

What is "Google formating file" in your case? Is it a EditorConfig file, or set of IDE settings? 

 

0
Avatar
Permanently deleted user

Intellij code style XML schema file.

0

Can you share that file? I cannot reproduce that problem in the default installation. 

0

Please sign in to leave a comment.