Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for formatting changed lines only in a file #184

Open
aszenz opened this issue Aug 19, 2022 · 3 comments
Open

Add support for formatting changed lines only in a file #184

aszenz opened this issue Aug 19, 2022 · 3 comments

Comments

@aszenz
Copy link

aszenz commented Aug 19, 2022

VScode has this formatting feature, where it only formats changed lines of code instead of the whole file.
Can we add support for this

@junstyle
Copy link
Owner

this extension spawn a child process to execute php code, it's inefficient and slow. if do more complex work, it will be more slower.
and php-cs-fixer can't only format changed code, grammar will be wrong.
if you means only replace the changed lines, i think it's not necessary, replace the whole file cost less time

@aszenz
Copy link
Author

aszenz commented Aug 19, 2022

This feature is useful not for performance but rather to reduce the diff in pr's, u contribute new code, and u wish to format it only and not the whole file. Also helps in code review

@junstyle
Copy link
Owner

junstyle commented Aug 19, 2022

this is a extension for vscode, just a wrapper for php-cs-fixer. if you want to use in git, i think you should use php-cs-fixer directly, it provide the diff info in the result.

php-cs-fixer fix --diff --dry-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants