Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>VSCode FormatterNew to Visual Studio Code? Get it now.
VSCode Formatter

VSCode Formatter

Dimas Lanjaka

|
2 installs
| (0) | Free
Format PHP (php-cs-fixer, phpcbf) and Python (black) files in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-formatter

Format PHP (php-cs-fixer, phpcbf) and Python (black) files in VS Code.

Features

  • PHP Formatting: Support for php-cs-fixer and phpcbf
  • Python Formatting: Support for black
  • Configurable: Choose your preferred PHP formatter backend

Installation

Install from the VS Code Marketplace or search for "VSCode Formatter" in VS Code Extensions.

Configuration

{
  "VSCodeFormatter.phpToolFormatter": "phpcbf", // or "php-cs-fixer"
  "VSCodeFormatter.blackPath": "black"
}

Development

Prerequisites

  • Node.js 18+
  • Yarn package manager

Building

# Install dependencies
yarn install

# Build the extension
npm run build

This compiles TypeScript source files from src/ into bundled outputs in out/:

  • out/extension.mjs (ESM format)
  • out/extension.cjs (CommonJS format)

Testing

npm test

Publishing

1. Create Publisher Account

  1. Go to Visual Studio Marketplace
  2. Sign in with your Microsoft account
  3. Navigate to your publisher page:
    https://marketplace.visualstudio.com/manage/publishers/<your-publisher-name>
    
  4. Click "New Extension" to begin creating your publisher account if you don't have one yet

2. Build the Extension

# Install dependencies
yarn install

# Build TypeScript sources
npm run build

3. Package the Extension

npm run package

This generates a .vsix file (e.g., vscode-formatter-1.0.0.vsix).

4. Upload to Marketplace

  1. Go to your publisher page:
    https://marketplace.visualstudio.com/manage/publishers/dimaslanjaka
    
  2. Click "New Extension" → select "Visual Studio Code"
  3. Click "Upload" and select your .vsix file
  4. Fill in the extension details:
    • Name: Must match your package.json name
    • Category: Select appropriate category
    • Tags: Add relevant tags for discoverability
  5. Click "Save" then "Publish"

Your extension will be available on the Marketplace after a few minutes.

Version Updates

When updating the extension:

  1. Update the version field in package.json (e.g., 1.0.0 → 1.0.1)
  2. Rebuild and re-upload:
npm run build
npm run package

Then upload the new .vsix file from your publisher page.

Install Locally

To test the packaged extension locally:

code --install-extension vscode-formatter-1.0.0.vsix

References

  • VS Code Extension API
  • Publishing Extensions
  • vsce - Publishing Tool

php-cs-fixer usage

php-cs-fixer fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--allow-unsupported-php-version ALLOW-UNSUPPORTED-PHP-VERSION] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [<path>...]
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft