Prevent VSCode auto format on save from removing final newline
autoformatting, visual-studio-code
Solution
This option has been added since the release 1.8 of November 2016:
New editor settings
- `files.insertFinalNewline` - automatically add a newline at the end of files when saving.
Problem
I am using the last feature of VSCode called formatOnSave, which is super cool. I have one tiny problem, the formatter tends to delete the new line at the end of `json` files like `packages.json` for example. My linter want those new lines at the end of the file, and me too. Is there a setting or a method that allows me to tell the formatter to keep new lines at the end of files? Related issue: - Provide an option to insert a final newline #1666 - Add "new line at end of file" option #12076