When I save file, VSCode auto cleans the not used code, How to Disable it? I want to make VSCode not to delete any line of my code.
Asked
Active
Viewed 3,620 times
9
-
See https://stackoverflow.com/a/74964368/80428 – Jay Wick Jun 23 '23 at 01:08
2 Answers
1
Go to Visual Studio Code's settings page in JSON format then remove the line
"source.fixAll": true,
this line you will find inside of this object
"editor.codeActionsOnSave": {
},

Md. Shakil Mahmud Shahan
- 29
- 1
- 5
-3
After finding and testing, it can be configured at Workspace Settings > Go configurartion
, override "go.formatOnSave": false,
on the right side, disable formatting then the code will not be auto cleaned.
EDIT: Later then I meet this issue .

yu yang Jian
- 6,680
- 7
- 55
- 80
-
8
-
4This also happens in JavaScript for any code following a `return` statement. – Qwerty Oct 26 '20 at 16:50