Format XML files instantly — lightweight and fast, inspired by Notepad++ Pretty Print.
Version: 1.7.0
Screenshots
Right-click context menu with Format XML options
Features
- Three formatting modes:
- Compact: Keeps all attributes on a single line
- Semi-Expanded: Splits attributes when the line exceeds the print width
- Expanded: Places each attribute on its own line with alignment
- Configurable indentation: Respects your editor settings or use custom values
- Selection support: Formats only the selected text, or the entire document if nothing is selected
- Smart inline elements: Keeps
<Tag>text</Tag> on a single line
- Preserves empty elements: Does not convert
<Tag></Tag> to <Tag/>
- Comments and CDATA: Preserves
<!-- --> and <![CDATA[...]]> as-is
- Declarations at root:
<?xml ...?> and <!DOCTYPE ...> are placed without indentation
Real-time XML Validation
- Automatic error detection: Analyzes your XML as you type
- Visual diagnostics: Displays errors and warnings inline (like Error Lens)
- Validations included:
- ❌ Unclosed tags
- ❌ Mismatched closing tags
- ❌ Closing tags without an opening tag
- ❌ Unclosed XML comments (
<!--)
- ❌ Unclosed CDATA sections (
<![CDATA[)
- ❌ Malformed tags (missing
>)
- ⚠️ Warnings on tags related to errors
Usage
Compact Mode (all attributes on one line)
| Method |
Action |
| Keyboard shortcut |
Ctrl+Shift+Alt+F (XML files only) |
| Right-click in editor |
"Format XML - Compact" |
| Command palette |
Format XML - Compact |
Semi-Expanded Mode
| Method |
Action |
| Keyboard shortcut |
Ctrl+Shift+Alt+S (XML files only) |
| Right-click in editor |
"Format XML - Semi-Expanded" |
| Command palette |
Format XML - Semi-Expanded |
Expanded Mode (one attribute per line)
| Method |
Action |
| Keyboard shortcut |
Ctrl+Shift+Alt+E (XML files only) |
| Right-click in editor |
"Format XML - Expanded" |
| Command palette |
Format XML - Expanded |
Configuration
Option 1: Use your editor settings (recommended)
The extension automatically respects your VS Code configuration:
{
"editor.tabSize": 4,
"editor.insertSpaces": true
}
Option 2: Extension-specific settings
Override the editor settings just for this extension:
{
"xmlFastFormatter.indentSize": 2,
"xmlFastFormatter.useSpaces": true,
"xmlFastFormatter.printWidth": 120
}
| Setting |
Type |
Default |
Description |
xmlFastFormatter.indentSize |
number |
(uses editor.tabSize) |
Number of spaces for indentation |
xmlFastFormatter.useSpaces |
boolean |
(uses editor.insertSpaces) |
Use spaces instead of tabs |
xmlFastFormatter.printWidth |
number |
(uses editor.wordWrapColumn or 160) |
Max line width for semi-expanded mode |
Fallback default: 4 spaces if no configuration is found.
Examples
Compact
<Order localOrderKey="1" operatorId="123" operatorName="GIGIGO" storeId="809998" status="128">
<Item index="1" currentSelected="true">
<product code="105" qty="1" unitPrice="990.00"></product>
</Item>
</Order>
Expanded
<Order localOrderKey="1"
operatorId="123"
operatorName="GIGIGO"
storeId="809998"
status="128">
<Item index="1"
currentSelected="true">
<product code="105"
qty="1"
unitPrice="990.00"></product>
</Item>
</Order>
Manual Installation
- Download the
.vsix file
- In VS Code:
Ctrl+Shift+P → Extensions: Install from VSIX...
- Select the
.vsix file
- Reload VS Code
License
MIT