Intellij or Clion formatter to merge short lines


My IntelliJ and Clion can help split a long line into multiple with the auto-formatting, but the not the other way around. How should it merge multiple short lines into a single longer line?

This is needed quite often. For example it happens after I renaming a long variable, and that makes the function call chain being able to fit in a single line. My Gift Card Site

Example, what I want is:

1 Codes before formatting:


2 Intellij or Clion auto-format should change it to:


1 comment


You can use the "Join Lines" action -

To join lines, place the caret at the line to which you want to join the other lines and press Ctrl+Shift+J. Keep pressing the keys until all the needed elements are joined.


Please sign in to leave a comment.