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] TransactSQL incorrectly formats some block comments, leading to broken statements #747

Closed
wylieconlon opened this issue Jun 14, 2024 · 2 comments · Fixed by #751
Labels

Comments

@wylieconlon
Copy link

Input data

/** block comment **/

Expected Output

/** block comment **/

Actual Output

/ * * block comment * * /

Usage

This example reproduces on the sql-formatter playground. The only option that fixes the bug is enabling "dense operators", which produces this output:

/**block comment**/
@nene
Copy link
Collaborator

nene commented Jun 18, 2024

Thanks for reporting.

Looks like this bug is related to the parsing of nested block-comments. Affects Transact-SQL, Postgres, DB2 for IMBi.

The the final **/ seems to trigger it:

/* block comment **/

results in:

/ * block comment ** /

nene added a commit that referenced this issue Jun 20, 2024
@nene nene closed this as completed in #751 Jun 20, 2024
nene added a commit that referenced this issue Jun 20, 2024
Don't try to be too clever with matching lots of characters with that
funky MIDDLE regex. Just match a single char.

Fixes #747
@nene
Copy link
Collaborator

nene commented Jun 20, 2024

The fix for this is now out in 15.3.2

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