Closed rjv closed 8 years ago
Thank you for taking the time to post this. I have noticed this before, and I know what causes it. Unfortunately I haven't worked out a solution just yet.
What happens here is, when the file is saved, the PHP-CS-Fixer executable is run using a separate process. That means that the file is altered outside of VSCode. Therefore, the VSCode file buffer remains unchanged. It would be inconvenient, however, to have the user reopen the file on every save. So that's why the extension does that for you. The side effect of that is, however, the issue you present here. The other issue is that you lose your undo history.
I have been working on workarounds. One of which is a proposed feature for the PHP-CS-Fixer that enables it to fix a file and return the results in the command-line itself, without writing it to the file. But I have not found the time yet to test it and make a pull request.
I finally got around to fix the problems I described above.
Just now I released version 0.1.0 which uses temporary files to run the formatter on. Using this method, the undo history will no longer be lost after formatting and split views will no longer close either.
With the
onSave
configuration enabled, when I save a file that is open within a split editor, it collapses all of the editors and I lose my pane layout.Visual Studio Code 1.3.0 Windows 10 Pro (1511) PHP CS Fixer 1.10.2 (installed with Composer)