inferrinizzard / prettier-sql

[ARCHIVED] Please use https://github.com/sql-formatter-org/sql-formatter
https://github.com/sql-formatter-org/sql-formatter
MIT License
21 stars 5 forks source link

[FORMATTING] Space is inserted before bracket for Map keys with . and - #85

Open drrcool opened 2 years ago

drrcool commented 2 years ago

Describe the bug When formatting code with MAP keys that have . in them, the formatter adds a space between map name and index.

Expected Output

SELECT
    id,
    measures_map['bucket.lower'] AS bucket_lower,
    SUM(1) as cnt
FROM some.table
GROUP BY
    id,
    measures_map['bucket.lower']

Actual Output

SELECT
    id,
    measures_map ['bucket.lower'] AS bucket_lower,
    SUM(1) as cnt
FROM some.table
GROUP BY
   id,
   measures_map ['bucket_lower']

Note: if I cared about measuresmap['somekey'] the formatter behaves perfectly as expected. I have not done an exhaustive search, but I see that `are treated correctly, but.and-` are not.

Usage