mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.43k stars 291 forks source link

Add newline at the end of a file #1192

Closed 20manas closed 10 months ago

20manas commented 11 months ago

Is your feature request related to a problem? Please describe. In the POSIX standard, a line is defined as: A sequence of zero or more non- <newline> characters plus a terminating <newline> character. The formatter should follow this standard and add a newline at the end of a file.

For example, in git diff, when a newline is not present at the end of a file, it shows up like this: image which is quite unnecessary.

With a newline at the end of a file, git diff shows this: image

Describe the solution you'd like Add a newline at the end of a file, following the POSIX standard (unless linesBetweenQueries is preserve?).

Describe alternatives you've considered None

Additional context https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

DavidS-ovm commented 11 months ago

You can set files.insertFinalNewline in VS Code settings to get this behaviour.

20manas commented 10 months ago

You can set files.insertFinalNewline in VS Code settings to get this behaviour.

Alright, this is working with the formatter. Thanks!