nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst

Home Page:https://nene.github.io/prettier-sql-playground/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potential Bug Report: Multiline STRUCT type arguments are not indented

Anthony-Fiddes opened this issue · comments

I noticed when I was creating a long struct today that the type arguments are automatically wrapped, but do not have some form of indentation to make it clear that they are a nested field. Example below.

Language: BigQuery

Input text:

CREATE TEMP TABLE blah
(
  date DATE NOT NULL,
  nested STRUCT<hey STRING, there STRING, friend STRING, how STRING, are STRING, you STRING, this STRING, iss STRING, getting STRING, long STRING>
) AS
  (
    SELECT
      bleep
    FROM bloop
  );

Expected output:

CREATE TEMP TABLE blah (
  date DATE NOT NULL,
  nested STRUCT<
    hey STRING,
    there STRING,
    friend STRING,
    how STRING,
    are STRING,
    you STRING,
    this STRING,
    iss STRING,
    getting STRING,
    long STRING
  >
) AS
  (
    SELECT
      bleep
    FROM bloop
  );

Actual output:

CREATE TEMP TABLE blah (
  date DATE NOT NULL,
  nested STRUCT<hey STRING,
  there STRING,
  friend STRING,
  how STRING,
  are STRING,
  you STRING,
  this STRING,
  iss STRING,
  getting STRING,
  long STRING>
) AS
  (
    SELECT
      bleep
    FROM bloop
  );

Thanks for reporting.

Should be fixed in 0.8.3 release.