Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FORMATTING] var := value Token for Snowflake is Parsed as var: = value. #775

Closed
chiefupstart opened this issue Sep 5, 2024 · 2 comments
Labels

Comments

@chiefupstart
Copy link

chiefupstart commented Sep 5, 2024

Input SQL

DECLARE
 profit NUMBER(38, 2);
 revenue NUMBER(38, 2);
 cost NUMBER(38, 2);
BEGIN
 let profit := revenue - cost;
RETURN profit;

Expected Output
I would expect sql-formatter to honor the := symbol for Snowflake.

Actual Output

Parse error at token: = at line 6 column 13 <-- notice the space in the token.
Unexpected OPERATOR token: {"type":"OPERATOR","raw":"=","text":"=","start":91}. Instead, I was expecting to see one of the following:
A LINE_COMMENT token based on: ...
A BLOCK_COMMENT token based on: ...
A DISABLE_COMMENT token based on: ...
Etc etc.

Usage

      let serverLanguage: SqlLanguage = 'snowflake';
      formattedSql = format(sqlText, {
        language: serverLanguage,
        tabWidth: 2,
        keywordCase: 'upper',
        linesBetweenQueries: 1,
      });

Version: "sql-formatter": "^15.4.1"

@nene
Copy link
Collaborator

nene commented Sep 6, 2024

Thanks for reporting.

@nene nene closed this as completed in b4d574a Sep 6, 2024
@nene
Copy link
Collaborator

nene commented Sep 6, 2024

Fixed in 15.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants