-
Notifications
You must be signed in to change notification settings - Fork 17
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
Formatting on save takes ~300ms, the CLI takes ~15ms #43
Comments
The issue seems to happen in |
I have the same issue, sometimes reaching up to 500ms~ .. |
I did some digging, and it looks like this could be resolved by caching the resolved command. The actual format-command takes practically no time at all, even with a heap of PHP extensions installed & active (including xdebug which usually slows things down quite a bit). I added a very hacky caching logic to
|
@Urbanproof Will love to see that caching logic 👀 Otherwise feel free to open a draft PR so we can review it |
@Urbanproof I think the resolution logic should happen when the extension loads, not when the first save happens, because the delay will still be very noticeable |
I don't actually have the code any more - I threw it away as it was more of a quick test than an actual patch. I intended to get back to this as soon as I had spare time, and surprise surprise, that time never came. 😁 If you still want help with this I could take another look.
I thought about this, too, but I wasn't sure if this would cause problems with project setup. If you were to clone a fresh project you wouldn't have the vendor-directory there just yet, so you would have to reload the extension after running |
Ah, that's sad, anyway I could take a look as well at this, maybe just for the sake of fixing the saving issue when applying refactorings or code actions to lot of files at once |
@Urbanproof good thinking - this good be solved relatively easily by watching file changes though, VSC has a nice API for that 👍 |
@innocenzi It's what it does right now for the About the rest of files I don't know how much will this help, depends on how the VSCode's API detect a file change (if is based on the file content or just last update timestamp)
This will depend as of today extension is on pre-release until I manage to have tests (to also determine what a break change will really be), so it can be v2 or still be v1.x but as a final release, tho I still need to manage the integration with Laravel Sail which was once working and not anymore |
Context
I'm trying to move from my
php-cs-fixer
setup to Pint, so I need IDE support and I naturally found this extension.Describe the bug
Saving using the formatter takes about 300 milliseconds. This is very noticeable when formatting on save compared to the ~20ms that the CLI command takes.
To Reproduce
Steps to reproduce the behavior:
formatOnSave
totrue
orcodeActionsOnSave
tosource.fixAll.format
php
's formatter toopen-southeners.laravel-pint
Expected behavior
The changes should not take more than a few more milliseconds compared to the CLI.
Environment:
The text was updated successfully, but these errors were encountered: