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

Better formatting of inline block-comments #462

Merged
merged 3 commits into from
Sep 27, 2022
Merged

Conversation

nene
Copy link
Collaborator

@nene nene commented Sep 26, 2022

Previously all block-comments were formatted on a separate line, like:

SELECT 1 /*com1*/ + 2 /*com2*/;

would get formatted as:

SELECT
  1
  /*com1*/
  + 2
  /*com2*/;

After this change the result is more like one would expect:

SELECT
  1 /*com1*/ + 2 /*com2*/;

Only when the block-comment spans multiple lines or is preceded by a newline will it be formatted as before: on a separate line of its own.

The formatting is still not ideal, but it should work well for most common scenarios. Sometimes the comments don't get nicely padded by spaces on both sides, as one can see in the tests, but these are some pretty odd scenarios, like placing comments between table and column name table /* */ . /* */ col, something one really rarely does in real world.

@nene nene requested a review from inferrinizzard September 26, 2022 16:19
@nene nene force-pushed the block-comment-positions branch from 960ead8 to 392f537 Compare September 26, 2022 16:50
Base automatically changed from comment-attachment to master September 27, 2022 08:27
@nene nene merged commit 1e21065 into master Sep 27, 2022
@nene nene deleted the block-comment-positions branch September 27, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant