Compress multi-line SQL into a single-line string, ready to paste into an HTTP request body, a JSON field, a YAML config, or anywhere a newline would break things.
The compressed result is copied to your clipboard — the SQL in your editor is left untouched.
Usage
Select the SQL text you want to compress.
Trigger the command in either way:
Command Palette → SQLine: Compress SQL to One Line
Right-click the selection → SQLine: Compress SQL to One Line
Shortcut → Ctrl + Shift + L
A notification shows the character count before and after, plus a preview. Paste anywhere with Ctrl + V.
Note on the shortcut:Ctrl + Shift + L is bound to Select All Occurrences in the default VS Code keymap. If you rely on that, rebind SQLine via Preferences: Open Keyboard Shortcuts and search for sqline.compressSql.
What gets compressed
Rule
Before
After
CRLF normalized to LF
SELECT 1\r\n
SELECT 1
Newlines and tabs become spaces
SELECT *\n\tFROM t
SELECT * FROM t
Consecutive spaces collapse into one
SELECT *
SELECT *
Leading and trailing whitespace trimmed
SELECT 1
SELECT 1
Example:
SELECT
user_id,
COUNT(*) AS cnt
FROM
events
WHERE
dt = '2026-07-30'
GROUP BY
user_id
becomes:
SELECT user_id, COUNT(*) AS cnt FROM events WHERE dt = '2026-07-30' GROUP BY user_id
Feature
[x] Compresses any selection — no SQL parsing, so dialect never matters
[x] Result goes to the clipboard, the original SQL stays formatted
[x] Works from the Command Palette, the context menu, or a keyboard shortcut