I've setup the Debugging with Chrome and it works reasonably well. However, every time I make a change & save the .htm file, I have to click the Restart icon in the toolbar for the changes to propagate to the instance of Chrome.
Is there a way for VS Code to "restart" when I save the file?
P.S. I am editing a local file (no web servers involved).
Click the (...) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.
The easiest way to turn on Auto Save is with the File > Auto Save toggle that turns on and off save after a delay. For more control over Auto Save , open User or Workspace settings and find the associated settings: files.autoSave : Can have the values: off - to disable auto save.
I wanted to do exactly the same thing and accomplished it by installing an extension that allows me to execute a VS Code extension command when a file is saved.
The extension is Save and Run Ext and is a fork off of another extension but allows you to execute VS Code extension commands.
I added the following configuration to my settings.json
file:
{
"saveAndRunExt": {
"commands": [
{
"match": "\\.(css$|js$|html$)",
"isShellCommand": false,
"cmd": "workbench.action.debug.restart"
}
]
}
}
What this does is whenever a .css, .js, or .html file is saved, it will restart the debugger. You could of course configure it to do whatever you want.
An alternative (one step) solution is instead of saving the file, just restart the debugger, and it automatically saves all files and changes are propagated to Chrome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With