Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>CompactifyNew to Visual Studio Code? Get it now.
Compactify

Compactify

buraby1

|
1 install
| (1) | Free
Reduce unnecessary line breaks in JavaScript, JSON, JSONC and Power Fx. Configurable compact formatting.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Compactify

Less space. Same logic.

Compactify reduces unnecessary line breaks while keeping complex code structured. Use it alongside your usual formatter, such as Prettier.

Supported files

JavaScript (.js), JSON (.json), JSONC (.jsonc), and standalone Power Fx (.fx, .powerfx).

Before and after

Before:

if (!isValid) {
    return false;
}

After:

if (!isValid) { return false; }

Short objects, arrays and calls can also be compacted when they fit the configured line length. For JavaScript and JSON, the formatter checks the parsed syntax structure before accepting changes. Power Fx uses a conservative lexical check, not a full Power Fx parser.

Usage

Open a supported file, open the Command Palette, choose Format Document With..., and select Compactify. You can also use Compactify: Format Document or Compactify: Format Selection.

Compactify: Restore Original Formatting restores the last in-memory snapshot only if the document still matches the formatted result. Use Undo or Timeline otherwise.

Settings

{
    "compactify.maxLineLength": 160,
    "compactify.maxStatements": 1
}
  • maxLineLength: maximum length of newly compacted lines (40–500). Existing long lines are not necessarily wrapped.
  • maxStatements: maximum number of statements in eligible JavaScript blocks (1–3).

Limitations

Complex blocks and candidates containing comments or sensitive literal syntax may be left unchanged. Power Fx interpolated strings and Canvas Apps YAML are not supported. Review changes and test your code before deployment. Formatting runs locally; the extension does not make network requests.

Bundled TypeScript license: TYPESCRIPT-LICENSE.txt.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft