sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.37k stars 405 forks source link

[VSCODE] Inconsistent formatting between VSCode extension and CLI #759

Closed pokey closed 4 months ago

pokey commented 4 months ago

Describe the bug When I run sql-formatter from CLI I get a different format from the VSCode extension

To Reproduce Steps to reproduce the behavior:

  1. Create the following file in test.sql:

    CREATE TABLE IF NOT EXISTS log (data TEXT NOT NULL) STRICT;
  2. Run the Format Document VSCode command. Note that it will change the file to:

    CREATE TABLE
      IF NOT EXISTS log (data TEXT NOT NULL) STRICT;
  3. Run the formatter from the CLI:

    npm exec sql-formatter -- --fix test.sql
  4. Note that it has changed back to the original format

Expected behavior I would expect consistent behaviour

Screenshots N/A

Usage

Additional context Add any other context about the problem here.

Extension version: 1.6.0 VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:07:46.768Z) OS version: Darwin arm64 23.3.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M2 Max (12 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 3, 3| |Memory (System)|32.00GB (0.22GB free)| |Process Argv|--crash-reporter-id 0612ff11-8268-45d4-8d18-fe6461af3cbc| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 945dj816:31013170 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31094925 refactort:31098051 1iic9185:31097392 ```

sql-formatter npm version for CLI: 15.3.2

nene commented 4 months ago

Guessing from the version number 1.6.0, you seem to be using the Prettier SQL VSCode extension. There's nothing I can do about this.

Please read the FAQ.

pokey commented 4 months ago

yep that was it thank you!