Skip to content

Mago ​

Mago both formats and lints PHP, and this plugin offers both. Bundled with Porta and off by default — turn it on under Settings → Plugins → mago.

The mago page in Settings → Plugins

  • Mago: Format Current File (Ctrl+Alt+G) formats the file and applies the result to the open buffer, so the whole reformat is one Ctrl+Z away — unsaved edits included.
  • Mago: Lint Current File (Ctrl+Alt+E) lints it. Findings are published as editor diagnostics — inline messages, gutter and stripe marks, and the Problems panel (Alt+6), exactly like a language server's — and a clean run clears them. A language server that publishes diagnostics for the same file replaces them, and the other way round: the last writer wins.

With both on save settings on, a save formats first and then lints the formatted file.

The plugin finds mago through its mago binary setting when you set one, then vendor/bin/mago, then your PATH. While none of those resolves, its menu entries stay dimmed, and its page under Settings → Plugins offers to install it (composer require --dev carthage-software/mago).

In a project you have not trusted, mago does not run at all: a mago.toml can name a program for mago lint to start ([extension-hosts]). See Trusting a project.

Settings ​

SettingDefaultWhat it does
mago binaryemptyThe executable to run; empty finds it as above
Format on saveoffFormat each PHP file when you save it (Mago: Toggle Format on Save)
Lint on saveoffLint each PHP file when you save it (Mago: Toggle Lint on Save)

Keys ​

KeyAction
Ctrl+Alt+GFormat the current file
Ctrl+Alt+ELint the current file

Released under the MIT License.