onsave sometimes stops working until I restart VSCode
See original GitHub issueHi
I have these configs in my workspace settings:
"php-cs-fixer.config": "..\\myrepo\\phpcsfixer.php",
"php-cs-fixer.executablePath": "${workspaceFolder}\\..\\myrepo\\vendor\\bin\\php-cs-fixer.bat",
"php-cs-fixer.onsave": true,
"php-cs-fixer.allowRisky": true,
and my phpcsfixer.php:
$config = new PhpCsFixer\Config();
return $config
->setIndent("\t")
->setLineEnding("\n")
->setRules([
(...)
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
);
Many times, the “onsave” seems to stop working. If I restart VSCode, it works again, but eventually stops working again.
When it works, I can see an output like:
(if there is something to fix)
[
"fix",
"--using-cache=no",
"--format=json",
"--config=f:\\Files\\Git\\myrepo/..\\myrepo\\phpcsfixer.php",
"--allow-risky=yes",
"--path-mode=override",
"C:\\Users\\myuser\\AppData\\Local\\Temp/myfile.php"
]
{"files":[{"name":"C:\\Users\\myuser\\AppData\\Local\\Temp\\myfile.php"}],"time":{"total":0.104},"memory":14}
(if there is not something to fix)
[
"fix",
"--using-cache=no",
"--format=json",
"--config=f:\\Files\\Git\\myrepo/..\\myrepo\\phpcsfixer.php",
"--allow-risky=yes",
"--path-mode=override",
"C:\\Users\\myuser\\AppData\\Local\\Temp/myfile.php"
]
{"files":[],"time":{"total":0.079},"memory":14}
Loaded config default from "f:\Files\Git\myrepo/..\myrepo\phpcsfixer.php".
Paths from configuration file have been overridden by paths provided as command arguments.
But when it stops working, there’s no output at all, and the issues stay on the file.
Any ideas why? Or where I can check for any errors.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Errors no longer clearing · Issue #1036 · microsoft/vscode-go
Restarting visual code; Disabling coverOnSave; Deleting the test file (coverage still shows up in the editor, can't seem to clear it); ps aux...
Read more >save not doing anything - Visual Studio Feedback
After closing vs2015 and restarting visual studio 2017 the problem seems to have gone away. ... it randomly starts to work again (though...
Read more >VS Code - Intellisense stopped working, takes 4-5 seconds ...
go to File > Preferences > Settings (macOS: Code > Preferences > Settings), search for update mode and change the setting to none....
Read more >So, my development experience is just getting worse after ...
Intellisense freezing is something that always happened to VS, ever since old versions. To fix that, just call the "Restart TS Server" command....
Read more >How to Format Code on Save in VS Code with ESlint
This reloads your VS Code window rather than restarting the JavaScript and TypeScript language servers. ESLint Still Not Formatting on Save? I' ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
open the developer tools, can you see some error logs? please upload next time, otherwise i can’t find the problem.
if you enable
"php-cs-fixer.onsave": true
, you must make sure"editor.formatOnSave": false
firstso i think the best way to format code on save, it enables formattingProvider, settings like these:
you can try
the onsave setting is compatible with early versions.
@junstyle same here, it seems things are good with your suggestions. Thanks!