Fourmolu Checker - Formatting Diagnostics for HaskellDisplay localized Fourmolu formatting differences as VS Code diagnostics without automatically modifying your Haskell source files.
Fourmolu Checker highlights each affected source block, previews both localized and full-file Fourmolu output, and lets you apply either the selected block or the complete file. It complements HLS formatting and format-on-save workflows by keeping formatting differences visible and reviewable. Why use it?Fourmolu Checker is useful when you want to:
How it differs from HLS formattingHaskell Language Server can use Fourmolu as a formatting provider for Format Document or Fourmolu Checker complements that workflow rather than replacing it. Instead of only applying formatted output, it:
Use HLS formatting when you primarily want automatic or on-demand document formatting. Use Fourmolu Checker when you want formatting differences to remain visible and reviewable before applying them. Features
Fourmolu remains the source of the formatted output. Syntax analysis is used only to describe localized changes more precisely; it never claims which Fourmolu option caused a change. When a change cannot be classified safely, Fourmolu Checker reports a generic formatting diagnostic. The extension does not claim complete support for every Haskell construct or GHC extension. More examplesType signature diagnosticFourmolu Checker identifies the surrounding Haskell construct and displays the formatted block when hovering the diagnostic.
Do block diagnosticWhen the syntax context can be identified safely, the diagnostic describes the affected construct rather than reporting only a generic formatting difference.
Preview and apply all formatting changesPreview all Fourmolu changes opens a read-only side-by-side diff using the exact output from the current Fourmolu check. It does not run Fourmolu again or modify the source. Apply all Fourmolu changes remains the explicit action that formats the current file. Workspace scans do not retain complete formatted output for unopened files. Open such a file and run Check Current File when an automatic check is disabled to make its full-file preview available.
RequirementsInstall For Remote SSH, WSL and devcontainer workspaces, install Fourmolu in the remote environment rather than on the local machine. By default, the extension runs Fourmolu Checker does not bundle a Fourmolu binary. If the default executable is
missing, the error notification provides actions to open the setting or the
official Fourmolu installation guide. The extension validation baseline is
Fourmolu Automated real-binary validation covers Fourmolu The Extension Host smoke suite runs on Stable VS Code for Linux, macOS and Windows, plus the minimum declared VS Code version on Ubuntu. Executable and project resolution
For files inside a workspace, relative executable paths and Fourmolu itself is started from the directory containing the Haskell file. This allows Fourmolu to perform its normal upward discovery of Fourmolu Checker does not parse or reproduce Fourmolu configuration logic. Fourmolu is started with an argument array rather than a shell command, so file and executable paths containing spaces work normally.
UsageOpen a Haskell file and save it. When Fourmolu would modify the file, the extension publishes diagnostics on the affected source blocks and in the VS Code Problems panel. Hover a diagnostic to see Fourmolu's formatted output for that block. The diagnostic Quick Fix menu can copy a report containing the file name, range, code, severity and message for an issue report. It excludes source text, formatted output and absolute paths. View Fourmolu options affecting … is a read-only diagnostic Quick Fix. For
recognized imports, import/export lists, module or Haddock documentation,
indentation, declaration spacing, When Fourmolu itself fails, its error diagnostic offers Copy Fourmolu failure details. The report includes the failure code, operation, safe executable name, process status and duration. It never copies source text, formatted output, stderr, configured arguments or absolute paths. For a current The extension does not modify the file automatically. Use the lightbulb Quick Fix to apply Fourmolu's suggestion for the selected diagnostic block, or use one of these commands:
Format Current File asks Fourmolu for read-only stdout, verifies that the document has not changed, then applies that exact full-file text through VS Code. It never asks Fourmolu to write the file directly; save the resulting editor change when ready. Create Fourmolu Configuration prompts for the target folder; it never
guesses a project directory. It resolves the executable for that folder, runs
Fourmolu with Workspace checkingRun Fourmolu Checker: Check Workspace from the Command Palette to check all
matching Each folder retains its own include, exclude, executable, extra-argument and severity settings. The scan reports progress, can be cancelled, and checks at most four files concurrently. A new workspace check cancels and replaces an older one. Diagnostics may be published for unopened files. Dirty open files are skipped:
the extension neither saves them nor checks a different on-disk version behind
their editor buffer. Partial diagnostics already published before cancellation
remain valid; late cancelled results are discarded. The Output channel records
the scan summary and, when Workspace-derived selected-block Quick Fixes are available after opening the
file. They validate the complete current document fingerprint before editing.
Workspace diagnostics are cleared when their unopened source changes externally
or when its workspace folder is removed. A create, change or delete of
Settings
Additional Fourmolu options
Check only after saving
This checks matching files after they are saved, but not when clean files are opened. Workspace-relative executableRelative executable paths and
Diagnostic severityFormatting diagnostics default to Set Output and troubleshootingUse View: Output and select Fourmolu Checker to inspect execution details and failures. Run Fourmolu Checker: Diagnose Current File to explicitly report the current file's resolved executable, workspace folder, executable base, process working directory, arguments, Fourmolu version and check result. It never saves, formats or changes diagnostics. For a dirty document it reports the execution context and version, then skips the file check rather than inspecting an older on-disk version. The Output channel records:
It never logs formatted source output. When VS Code reports that the executable was not found:
The missing-executable notification also provides Configure Executable and Installation Guide actions. It never silently substitutes a bundled or downloaded Fourmolu version. The integrated terminal and the VS Code extension host may not use exactly the same For Remote SSH, WSL and devcontainer workspaces, install and configure Fourmolu in the remote environment rather than on the local machine. Known limitations
Privacy and network behaviorFourmolu Checker has no telemetry, source upload or remote formatting service. It runs the configured Fourmolu executable in the VS Code extension-host environment and keeps project source local to that environment. The optional contributor-only corpus tooling can clone public repositories when a maintainer explicitly runs it; it is excluded from the published VSIX and never runs in the extension. DevelopmentThe fast test suite uses Node.js built-ins and a fake Fourmolu process. Separate release-validation commands use an explicitly supplied real Fourmolu executable in disposable fixtures. Contributor technical documentation is available in the repository. Run the complete test suite with:
Launch an Extension Development Host with:
|



