vscode-sql-formatter icon indicating copy to clipboard operation
vscode-sql-formatter copied to clipboard

unnecessary spaces added after $ and {

Open chapmanjacobd opened this issue 5 years ago • 4 comments

I really like using this extension but there is one thing that keeps me from using it

I use pg-promise and it substitutes variables using something like this:

where
  id = ${k}

but the formatter will turn it into this:

where
    id = $ { k }

and this breaks pg-promise.

Also I use dbt and it has macros that look like this:

{#- comment #}
    {{ ref('table') }}

sql-formatter turns it into

{ #- comment #}
    { { ref('table') } }

I would prefer without the space after { and $ if possible :dango:

chapmanjacobd avatar Jan 01 '20 16:01 chapmanjacobd

actually it breaks dbt too I just realized

I guess I will just do sed -i 's/{ {/{{/g' *; and sed -i 's/} }/}}/g' * for the time being

chapmanjacobd avatar Jan 03 '20 07:01 chapmanjacobd

The extra spaces are breaking my (postgress) function definitions :

    root_id numeric,
    id numeric,
    level int,
    name text,
    root boolean
) language sql as $$ with ...etc.```

BFJonk avatar Jun 05 '20 08:06 BFJonk

Hi, I'm having this same problem with TSQL using the Merge statement where $Action is a valid/required token. The formatter insists on putting a space after the $, breaking that part of my code.

exactmike avatar Sep 04 '20 19:09 exactmike

Same issue, If this was fixed it would make the plugin usable. 400k downloads and it hasn't been updated in 3 years. @kufii what gives?

shadoath avatar May 11 '22 15:05 shadoath