Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Single Line BlockNew to Visual Studio Code? Get it now.
Single Line Block

Single Line Block

Oktay Aydoğan

|
1 install
| (1) | Free
Format a selected block into one line or multiple logical lines
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Single Line Block

Format a selected text block into one line or multiple logical lines in Visual Studio Code.

Usage

  1. Select the text to collapse.
  2. Run Collapse to Single Line from the editor context menu or the Command Palette.

Keyboard shortcut:

  • macOS: Cmd+Shift+J
  • Windows and Linux: Ctrl+Shift+J

For example, this selection:

  first line

  second line

becomes:

first line second line

Expand to Multiple Lines

Select a line of text and run Expand to Multiple Lines from the editor context menu or the Command Palette.

The command starts a new line after sentence-ending punctuation (., !, and ?). Within long sentences it prefers natural pauses such as commas, semicolons, and colons, then falls back to word boundaries without splitting words. The default maximum line length is 40 characters and can be changed with the singleLineBlock.expand.maxLineLength setting.

For example:

First sentence. Second sentence! This sentence is still part of the same paragraph.

becomes:

First sentence.
Second sentence!
This sentence is still part of the same paragraph.

License

This project is licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft