[Repo Assist] docs: clarify phpcbf.onsave vs editor.formatOnSave interaction#121
Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
Draft
Conversation
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>
66 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist.
Problem
The
phpcbf.onsavesetting description inREADME.mdsays:This is misleading. "Override" implies a simple priority conflict, but the two settings use entirely different code paths:
phpcbf.onsave: trueregisters anonWillSaveTextDocumentlistener that checkseditor.formatOnSave === falsebefore firing.editor.formatOnSave: true(withpersoderlind.vscode-phpcbfas the default formatter) triggers theDocumentFormattingEditProviderinstead.So the listener only fires when
editor.formatOnSaveis nottrue— 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.onsavesetting description to accurately describe when the listener fires, and added a recommendation to prefereditor.formatOnSave: truewitheditor.defaultFormatterfor 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.