Overview Version History Q & A Rating & Review
A VS Code extension to transform selected code into a single line.
Features
This extension adds a "Compact to One Line" command to the context menu when you select text. This command transforms the selected text into a single line by replacing line breaks with spaces.
Example
Code on multiple lines:
<Button
label="Send"
isLoading={isSaving}
onClick={handleSubmit}
disabled={isSaving}
/>
Becomes:
<Button label="Send" isLoading={isSaving} onClick={handleSubmit} disabled={isSaving} />
Usage
Select text in the editor
Right-click on the selection
Choose "Compact to One Line" from the context menu
Keyboard shortcuts
The extension is configured with the following default keyboard shortcut:
Windows/Linux: Alt+Shift+O
Mac: Option+Shift+O
To customize this shortcut:
Open the command palette with Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(Mac)
Type "Preferences: Keyboard Shortcuts" and select it
In the search bar, type "Compact to One Line"
Click on the pencil icon next to the "Compact to One Line" command and enter your new shortcut
Press Enter to confirm
The shortcut will only work when a text selection is active in the editor.