Mago for VS Code

VS Code extension for the mago PHP toolchain — formatting, linting, and static analysis.
Features
- Format — Format PHP files using
mago format (format-on-save compatible)
- Lint — Real-time diagnostics from 135+ lint rules across 9 categories
- Analyze — Static analysis diagnostics in the Problems panel
- Code actions — Quick fixes and batch fix-all from mago suggestions
- Explain rule — View documentation for any lint rule from the command palette
Requirements
Install the mago CLI. The extension searches for the binary in this order:
mago.bin setting (explicit path)
./vendor/bin/mago (Composer local)
./mago (workspace root)
- System
$PATH
Settings
| Setting |
Default |
Description |
mago.enabled |
true |
Master enable/disable |
mago.bin |
"" |
Custom binary path |
mago.configPath |
"" |
Custom mago.toml path |
mago.phpVersion |
"" |
Override PHP version |
mago.lint.enabled |
false |
Enable lint diagnostics |
mago.lint.run |
"onSave" |
"onSave" or "onType" |
mago.analyze.enabled |
false |
Enable analyzer diagnostics |
mago.format.enabled |
true |
Register as formatter |
mago.trace.level |
"info" |
Log verbosity (off/error/warn/info/debug) |
Commands
All commands are available via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
- Mago: Format File — Format the active PHP file
- Mago: Lint File — Lint the active file
- Mago: Lint Workspace — Lint all files in the workspace
- Mago: Analyze File — Run static analysis on the active file
- Mago: Analyze Workspace — Analyze all workspace files
- Mago: Fix File (Safe) — Apply safe auto-fixes
- Mago: Fix File (All Including Unsafe) — Apply all fixes (with confirmation)
- Mago: Explain Rule — Show documentation for a lint rule
- Mago: Show Output — Open the output channel
- Mago: Restart — Re-resolve binary and refresh diagnostics
License
MIT
| |