In these tutorials, you’ll find many ways to join multiple lines into a single line.

For example, The file contains the following lines.

line 1
line 2
line 3

Output

line 1 line 2 line 3

Visual Studio Code Join multiple lines

There are multiple ways

  • Open VSCode Editor
  • Select the text or multiple lines you want to combine
  • Open Command Palette using Ctrl + Shift + P
  • It opens a popup type Join lines and select it.
  • It joins multiple lines into a single line
line 1 line 2 line 3

In VSCode, the Default prettier width is 80,

After joining the lines, if you still face an issue, try to change the prettier width.

  • Open the Settings window
  • Type a prettier width and change the width to 150 characters.
  • Alternatively, open settings.json, add or update Prettier.printWidth:150