Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Format Changed LinesNew to Visual Studio Code? Get it now.
Format Changed Lines

Format Changed Lines

Joel Gutiérrez Ruiz

|
2 installs
| (0) | Free
Format only what you changed. Uses Git to detect modified lines and applies your formatter — nothing else is touched.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Format Changed Lines

Stop formatting entire files. Only format the lines you actually changed.


This extension uses Git to detect your modifications and applies your VS Code formatter only to those lines. The rest of the file stays untouched — clean diffs, clean history.

Ideal for working with Copilot, Cursor, or any AI tool that generates unformatted code.

Note: Currently optimized for Java. Other languages with a VS Code formatter may work but have not been fully tested.

✨ Features

  • Git-powered — detects changed lines via git diff HEAD.
  • Multi-file — formats all modified files at once.
  • Statement-aware — if you touched one line of a multi-line if() or method call, the whole statement gets formatted.
  • Smart reformat — joins broken statements into one line, then lets the formatter decide the correct layout.
  • Any language — works with Java, TypeScript, Python, C#, or any language with a VS Code formatter.
  • New files — untracked files are fully formatted.

🚀 Quick Start

  1. Write or edit code (manually or with AI).
  2. Press Ctrl+Alt+S.
  3. Done. Files are formatted and saved.

📦 Requirements

  • Git installed and in PATH.
  • A Git repository with at least one commit.
  • A formatter extension for your language (Prettier, Java formatter, etc.).

⌨️ Keybinding

Command Shortcut
Format Changed Lines Ctrl+Alt+A

Customizable in File > Preferences > Keyboard Shortcuts.

📝 Release Notes

1.0.9

  • Initial release.
  • Git-based changed line detection.
  • Multi-file support.
  • Statement-aware expansion.
  • Join & reformat workflow.

Author: Joel Gutiérrez Ruiz

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