AppCode 2017.2 Help

Joining Lines and Literals

Basics

AppCode makes it possible to concatenate two unselected or several selected lines into one, removing the extra spaces, and providing the proper syntax. This operation smartly analyzes the lines being joined and treats them accordingly. For example, you can join lines of code, lines of comments, field declaration and initialization.

Joining lines

  1. Place the caret on the line, to which the other lines should be added.
    /help/img/idea/2017.2/ctrlShiftJ1.png
  2. Sequentially press ⌃⇧J keyboard shortcut, until all fragments are joined in a single line.
    /help/img/idea/2017.2/ctrlShiftJ2.png

Joining string literals

  1. Select the lines with string literals that should be joined.
    /help/img/idea/2017.2/AppCodeJoinLiterals1.png
  2. Press ⌃⇧J keyboard shortcut. All redundant characters (spaces, quotes, and plus signs) are gone.
    /help/img/idea/2017.2/AppCodeJoinLiterals2.png

Examples

Joining a field or variable declaration and assignment:

/help/img/idea/2017.2/ctrlShiftJ8.png

Pressing ⌃⇧J produces the following result, with the unwanted spaces and variable name in the second line removed:

/help/img/idea/2017.2/ctrlShiftJ9.png

Consider the following pair of statements:

/help/img/idea/2017.2/ctrlShiftJ10.png

Press ⌃⇧J to join these lines into a correct single-line statement.

/help/img/idea/2017.2/ctrlShiftJ11.png

See Also

Getting Started:

Last modified: 26 July 2017