Skip to content

[Repo Assist] docs: clarify phpcbf.onsave vs editor.formatOnSave interaction#121

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/docs-clarify-onsave-2026-04-01-a964c5a5d87e2b44
Draft

[Repo Assist] docs: clarify phpcbf.onsave vs editor.formatOnSave interaction#121
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/docs-clarify-onsave-2026-04-01-a964c5a5d87e2b44

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 1, 2026

🤖 This is an automated pull request from Repo Assist.

Problem

The phpcbf.onsave setting description in README.md says:

"Format on save. "editor.formatOnSave": true will override this setting."

This is misleading. "Override" implies a simple priority conflict, but the two settings use entirely different code paths:

  • phpcbf.onsave: true registers an onWillSaveTextDocument listener that checks editor.formatOnSave === false before firing.
  • editor.formatOnSave: true (with persoderlind.vscode-phpcbf as the default formatter) triggers the DocumentFormattingEditProvider instead.

So the listener only fires when editor.formatOnSave is not true — they don't conflict, they're mutually exclusive code paths. The old description causes users to misunderstand why their configuration isn't working.

This confusion appears to be a root cause of several long-standing "onsave not working" issues (#24, #25, #34).

Fix

Updated the phpcbf.onsave setting description to accurately describe when the listener fires, and added a recommendation to prefer editor.formatOnSave: true with editor.defaultFormatter for more reliable behaviour.

Test Status

✅ All 7 unit tests pass (npm run test:unit).

No behavioural code changes — this is documentation only.

Helps with #24, #25, #34.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

The previous one-line description said 'editor.formatOnSave: true will
override this setting', which was misleading. It implied a simple
priority override, when the actual behaviour is that the two settings
use entirely different code paths:

- phpcbf.onsave uses an onWillSaveTextDocument listener that only fires
  when editor.formatOnSave is NOT true.
- editor.formatOnSave (with persoderlind.vscode-phpcbf as the default
  formatter) uses the DocumentFormattingEditProvider, which is the more
  robust path.

This confusion is a root cause of several 'onsave not working' issues
(#24, #25, #34). The updated description explains the condition under
which the listener fires and recommends the preferred approach.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants