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

Fix printing of indented block comments #3225

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Dec 4, 2024

The formatting of block comments has changed slightly.
A comment block has the syntax {- multi-line-text -}.
The rules are:

  1. The first line, i.e. the line that starts with {- is trimmed of trailing space.
  2. The last line, i.e. the line that ends with -} is trimmed of prefix space.
  3. Lines in the middle are trimmed of prefix and trailing space.

This makes it impossible to have such a comment:

{-
  indented
-}

The reasoning is that if we don't want to have an indentation sensitive parser we have two choices.

  1. Print all comments flushed to the left
  2. Do not have indentation in the middle lines.

I thought 2. was better

@janmasrovira janmasrovira self-assigned this Dec 4, 2024
@janmasrovira janmasrovira force-pushed the 3143-repeated-reformatting-of-multi-line-comments-resulting-in-them-moving-to-the-right branch from 0076853 to 716fa8e Compare December 4, 2024 12:45
@janmasrovira janmasrovira requested a review from lukaszcz December 4, 2024 12:45
@janmasrovira janmasrovira marked this pull request as ready for review December 4, 2024 12:45
@janmasrovira janmasrovira marked this pull request as draft December 4, 2024 12:45
@janmasrovira janmasrovira force-pushed the 3143-repeated-reformatting-of-multi-line-comments-resulting-in-them-moving-to-the-right branch from 716fa8e to ce6d87a Compare December 4, 2024 13:01
@janmasrovira janmasrovira force-pushed the 3143-repeated-reformatting-of-multi-line-comments-resulting-in-them-moving-to-the-right branch from ce6d87a to 4546bc5 Compare December 5, 2024 13:53
@janmasrovira janmasrovira marked this pull request as ready for review December 5, 2024 13:54
@janmasrovira janmasrovira added this to the 0.6.9 milestone Dec 5, 2024
lukaszcz
lukaszcz previously approved these changes Dec 6, 2024
@janmasrovira janmasrovira merged commit 936045f into main Dec 6, 2024
4 checks passed
@janmasrovira janmasrovira deleted the 3143-repeated-reformatting-of-multi-line-comments-resulting-in-them-moving-to-the-right branch December 6, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeated reformatting of multi-line comments resulting in them moving to the right
2 participants