What is the magic configuration for allowing a file to be auto-formatted upon a Save operation, but stop / disable / prevent VSCode from deleting dead code?
Sometimes I want to deliberately throw an exception in the middle of a function, for debugging purposes but am forced to comment out all following code in order not to get it deleted.
What's worse is that sometime I save while the editor didn't yet recover from some error in the code, thinks the code still contains an error, and causes code deletions which should not happen in the first place. I found myself too many times pulling up git in order to restore good code which was wrongly deleted.
Is there a clear "do not delete dead code" option to switch on?
UPDATE:
source.fixAll activates also TS fixes, which are somehow too aggressive to use on save. Only enabling eslint fixes with source.fixAll.eslint is a good compromise - it will still report dead code (no-unreachable) but not delete it.
https://github.com/microsoft/vscode/issues/109530
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