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

[FORMATTING] Missing indent level of comment after CASE

Open karlhorky opened this issue 1 year ago • 1 comments

Input data

Which SQL and options did you provide as input?

SELECT
  a,
  CASE
    -- one
    WHEN a = 1 THEN 'one'
    -- two
    WHEN a = 2 THEN 'two'
    ELSE 'other'
  END
FROM
  test;

Expected Output

(unchanged)

SELECT
  a,
  CASE
    -- one
    WHEN a = 1 THEN 'one'
    -- two
    WHEN a = 2 THEN 'two'
    ELSE 'other'
  END
FROM
  test;

Actual Output

-- one is indented one level lesser than expected

SELECT
  a,
  CASE
  -- one
    WHEN a = 1 THEN 'one'
    -- two
    WHEN a = 2 THEN 'two'
    ELSE 'other'
  END
FROM
  test;

Usage

  • How are you calling / using the library? Demo on website
  • What SQL language(s) does this apply to? PostgreSQL
  • Which SQL Formatter version are you using? 15.0.2

karlhorky avatar Jan 07 '24 03:01 karlhorky

Thanks for reporting. This is essentially the same issue as #660

nene avatar Jan 07 '24 09:01 nene