How to make vscode compact multiple lines to a single line?
Visual Studio-CodeKeyboard ShortcutsVisual Studio-Code Problem Overview
I have 4 lines like this in vscode:
> 1 line;
> 2 line;
> 3 line;
> 4 line;
Does vscode have a shortcut that can quickly compact 4 lines to 1 line like this:
> 1 line; 2 line; 3 line; 4 line;
Visual Studio-Code Solutions
Solution 1 - Visual Studio-Code
Select your code => F1 => "Join Lines"
You can also create a keyboard shortcut for this command editor.action.joinLines
Default shortcut on Mac is Ctrl+J
Solution 2 - Visual Studio-Code
Solution 3 - Visual Studio-Code
Or you could use these two in vs code.
Fold multiple lines: ctrl + shift + [
Unfold multiple lines: ctrl + shift + ]
I prefer these because I want to use prettier as well.
Solution 4 - Visual Studio-Code
I also had same issue and solved it. If you use Prettier, try it as below.
Settings -> Prettier.printWidth"
The default value is 80. If you change this value higher than 80.