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

prettier-plugin-toml removes blank lines after comments #74

Closed
EvgenyOrekhov opened this issue Nov 22, 2023 · 5 comments · Fixed by un-ts/prettier#314 or un-ts/prettier#316
Closed

Comments

@EvgenyOrekhov
Copy link

Example:

# This is a TOML comment

# This is a multiline
# TOML comment

str1 = "I'm a string."

Expected: code should not be changed.

Actual:

# This is a TOML comment
# This is a multiline
# TOML comment
str1 = "I'm a string."
@JounQin
Copy link
Member

JounQin commented Nov 22, 2023

Why not

@EvgenyOrekhov
Copy link
Author

Comment that immediately precedes a line of code is meant for that specific line of code. Comment that has a blank line is either a global comment, or a comment for a section in the file.

# This is a global comment for the file
# blah blah

# This is a comment specifically for the next line
foo = "bar"

# This is a comment for the next section

bar = "baz"
baz = "qux"

# Another section

...

@EvgenyOrekhov
Copy link
Author

Also because Prettier preserves blank lines between comments for other languages, like JS.

@JounQin
Copy link
Member

JounQin commented Nov 23, 2023

A PR would be appreciated.

@JounQin
Copy link
Member

JounQin commented Nov 27, 2023

Please try prettier-plugin-toml@v2

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