Automatically formats single-line code blobs the moment you paste them. Paste minified JavaScript, JSON, or HTML on one line — KY Formatter expands it into clean, indented multi-line code.
Features
Auto-format on paste: single-line pastes (60+ characters by default) are expanded and indented automatically.
JSON support: valid one-line JSON objects/arrays are pretty-printed.
HTML support: single-line markup blobs are split tag-per-line with proper nesting.
JS/TS/CSS-like support: generic brace/semicolon formatter that respects '...', "...", and `...` strings.
Manual command: KY Formatter: Format Single-Line Selection from the Command Palette formats the selection (or current line).
Safe by default: plain English text (no { } ; or HTML tags) is left untouched; Markdown and plaintext are excluded.
Extension Settings
This extension contributes the following settings:
ky-formatter.enable: Enable/disable KY Formatter.
ky-formatter.formatOnPaste: Automatically format single-line code blobs when pasted.
ky-formatter.minLength: Minimum pasted single-line length that triggers auto-format (default 60).
ky-formatter.maxLength: Maximum pasted length to consider — protects against huge pastes (default 50000).
ky-formatter.useEditorIndent: Use the active editor tabSize/insertSpaces for indentation.
ky-formatter.excludedLanguages: Language IDs where paste auto-format is disabled (default ["markdown", "plaintext"]).
Sponsor
If KY Formatter saves you time, consider supporting its development:
You can also run KY Formatter: Sponsor (Buy Me a Coffee) from the Command Palette.
Known Issues
The generic formatter does not parse comments specially; ; or braces inside comments may split lines.
Very exotic syntaxes fall back to the generic brace formatter, which may not match your project's style — run your project formatter afterwards if needed.