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

Empty comment at end of file gets mis-formatted #1197

Open DavidS-ovm opened 11 months ago

DavidS-ovm commented 11 months ago

Describe the bug

Files with an empty comment at the end get mis-formatted.

To Reproduce Steps to reproduce the behavior:

  1. Create a SQL file with the following contents:
    --foo
    --
  2. Format Document twice
  3. File contents will now be
    --foo
    - -
  4. Sadness

Expected behavior The last comment is preserved without the additional space

Screenshots

2023-08-03_10MS+0200_519x194

Desktop (please complete the following information):

Additional context Setting files.insertFinalNewline to true works around the issue.