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

CodeMaiden

CodeMaiden

|
5 installs
| (0) | Free
Code cleanup, reorganizing, and formatting — inspired by the original CodeMaiden for Visual Studio
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CodeMaiden for VS Code

A VS Code port of the beloved CodeMaiden Visual Studio extension.
Cleanup, sort, and tidy your code — automatically on save or on demand.


Features

Code Cleanup (Ctrl+M Ctrl+F)

Runs a set of configurable cleanup steps on the active file:

Step Default Setting
Remove trailing whitespace ✅ On codemaiden.cleaning.removeTrailingWhitespace
Collapse multiple blank lines ✅ On codemaiden.cleaning.removeMultipleBlankLines
Ensure final newline ✅ On codemaiden.cleaning.ensureFinalNewline
Sort imports alphabetically ❌ Off codemaiden.cleaning.sortImports
Insert/replace file header ❌ Off codemaiden.fileHeader.enabled

Sort Imports

Command: CodeMaiden: Sort Imports
Sorts import/using statements alphabetically. Language-aware:

  • TypeScript / JavaScript — ES import blocks
  • Python — import / from … import, stdlib first
  • C# — using statements, System.* first
  • Java / Kotlin — import blocks

Join Lines (Ctrl+M Ctrl+J)

  • No selection: joins the current line with the line below.
  • With selection: collapses all selected lines into one.

Sort Selected Lines (Ctrl+M Ctrl+S)

Sorts the highlighted lines alphabetically (case-insensitive).

Auto-cleanup on Save

Click the $(sparkle) CodeMaiden button in the status bar (bottom-right) to toggle automatic cleanup every time you save a file. Or run CodeMaiden: Toggle Auto Cleanup on Save from the Command Palette.

File Header

When enabled (codemaiden.fileHeader.enabled: true), inserts a configurable header at the top of each file during cleanup.

Default template:

// File: {filename}
// Created: {date}

Available tokens: {filename}, {date}, {year}, {author}.


Commands

Command Keybinding Description
CodeMaiden: Cleanup Document Ctrl+M Ctrl+F Clean active file
CodeMaiden: Cleanup All Open Documents — Clean all dirty open files
CodeMaiden: Sort Imports — Sort imports in active file
CodeMaiden: Join Lines Ctrl+M Ctrl+J Join line(s)
CodeMaiden: Sort Selected Lines Ctrl+M Ctrl+S Sort selection
CodeMaiden: Toggle Auto Cleanup on Save — Toggle save-hook
CodeMaiden: Open Settings — Open CodeMaiden settings

Supported Languages

By default, cleanup runs on:
TypeScript, JavaScript, TSX, JSX, C#, Python, Java, Go, Rust, C/C++, HTML, CSS, SCSS, LESS, JSON, XML, YAML, Markdown.

Customize with codemaiden.cleaning.languages.


Settings Reference

{
  // Auto-clean on every save
  "codemaiden.autoCleanupOnSave": false,

  // ── Cleaning ──────────────────────────────────
  "codemaiden.cleaning.removeTrailingWhitespace": true,
  "codemaiden.cleaning.ensureFinalNewline": true,
  "codemaiden.cleaning.removeMultipleBlankLines": true,
  "codemaiden.cleaning.maxConsecutiveBlankLines": 1,
  "codemaiden.cleaning.sortImports": false,
  "codemaiden.cleaning.languages": ["typescript", "javascript", ...],

  // ── File Header ───────────────────────────────
  "codemaiden.fileHeader.enabled": false,
  "codemaiden.fileHeader.template": "// File: {filename}\n// Created: {date}\n",
  "codemaiden.fileHeader.author": ""
}

Inspiration

This extension is inspired by CodeMaiden by Steve Cadwallader,
a powerful open-source Visual Studio extension. CodeMaiden for VS Code brings the core cleanup
experience to VS Code with language-aware logic and a zero-dependency, pure TypeScript implementation.


License

MIT

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