Skip to content

Conversation

avh4
Copy link
Contributor

@avh4 avh4 commented Oct 3, 2022

  • retain comments between import keyword and module name
  • retain comments between module name and ...
    • as keyword
    • exposing keyword
    • next freshline
    • do not attach subsequent comments that are indented less than 1 column
  • retain comments between as keyword and module alias name
  • retain comments between module alias name and ...
    • exposing keyword
    • next freshline
    • do not attach subsequent comments that are indented less than 1 column
  • retain comments between exposing keyword and exposing listing
  • retain comments between exposing listing and next freshline
    • do not attach subsequent comments that are indented less than 1 column

Not included in this PR (will be in a future PR):

  • retain freshline (column zero) comments between import statements
  • retain freshline (column zero) comments between the last import and the first top-level definition (part of format: retain top-level comments #153)

Note: After thinking through how trailing comments will want to be attached to AST nodes in other places, the approach taken here of adding a Space.chompIndentedAtLeast seems like the best approach and also seems to be the simplest and most flexible of the different options I came up with.

@avh4 avh4 changed the title WIP: format: retain comments in import statements format: retain comments in import statements Nov 12, 2022
@avh4 avh4 marked this pull request as ready for review November 12, 2022 21:01
@avh4 avh4 mentioned this pull request Nov 14, 2022
5 tasks
@robinheghan
Copy link
Member

Code looks good to me. Ready to merge?

@avh4
Copy link
Contributor Author

avh4 commented Nov 25, 2022 via email

@robinheghan robinheghan merged commit ea20df5 into gren-lang:main Nov 26, 2022
@avh4 avh4 deleted the retain-comments-2 branch November 26, 2022 16:14
@avh4 avh4 mentioned this pull request Nov 28, 2022
31 tasks
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.

2 participants