vscode-sqltools icon indicating copy to clipboard operation
vscode-sqltools copied to clipboard

format.linesBetweenQueries "preserve" is not working?

Open abcfy2 opened this issue 4 years ago • 2 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. edit a sql
  2. format sql
  3. "preserve" is not working, and linesBetweenQueries seems not correct.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

ezgif-2-cd3033ced553.zip

From the video:

  • "format.linesBetweenQueries": "preserve" --> No lines
  • "format.linesBetweenQueries": 1 --> No lines
  • "format.linesBetweenQueries": 2 --> 1 line
  • "format.linesBetweenQueries": 3 --> 2 lines

Desktop (please complete the following information):

  • SQLTools Version [e.g. v0.17.x] 0.23.0
  • VSCode Version: [e.g 1.x.y] 1.51.1
  • OS: [e.g. Windows, Linux, Mac] Linux
  • Driver:
    • [ ] PostgreSQL/Redshift
    • [ ] MySQL/MariaDB
    • [ ] MSSQL/Azure
    • [ ] SQLite
    • [ ] Other? Which...
  • Database version: [e.g. MySQL v5.6, PostgreSQL vX...]

abcfy2 avatar Dec 11 '20 04:12 abcfy2

Same issue here

  • SQLTools Version: 0.23.0
  • VSCode Version: 1.67.0
  • OS: Linux

luni3359 avatar May 08 '22 03:05 luni3359

just a bystander note: Regarding the "linesBetweenQueries seems not correct" (e.g. 2 becomes 1 etc.), that is misunderstanding of the property. It is not number of empty lines between queries, but number of line breaks. Thus 1 line break means each query is on separate lines without any empty lines between them. 2 means 2 line breaks, meaning 1 empty line between queries and so on.

The config name is confusing here :) I actually stumbled on this when looking at similar problem in (I guess) original library https://github.com/sql-formatter-org/sql-formatter which this repo forked :)

ladariha avatar Sep 06 '23 10:09 ladariha