Skip to content

Add :indent-rich-comments? option#387

Open
jramosg wants to merge 1 commit intoweavejester:masterfrom
jramosg:feature/indent-rich-comments
Open

Add :indent-rich-comments? option#387
jramosg wants to merge 1 commit intoweavejester:masterfrom
jramosg:feature/indent-rich-comments

Conversation

@jramosg
Copy link
Contributor

@jramosg jramosg commented Jan 15, 2026

Rich comments are often used as a scratchpad where forms are added and removed frequently. Allowing the closing parenthesis to be placed on a new line, aligned with the indentation of the block, makes these edits cleaner and keeps the diffs focused on the actual code changes.

This commit adds the :indent-rich-comments? option, which:

  • Ensures a trailing newline exists in rich comments when enabled.
  • Prevents the removal of this newline during whitespace cleanup.
  • Aligns the closing parenthesis with the block's indentation.

Fixes #365.

Rich comments are often used as a scratchpad where forms are added and
removed frequently. Allowing the closing parenthesis to be placed on a
new line, aligned with the indentation of the block, makes these
edits cleaner and keeps the diffs focused on the actual code changes.

This commit adds the :indent-rich-comments? option, which:
- Ensures a trailing newline exists in rich comments when enabled.
- Prevents the removal of this newline during whitespace cleanup.
- Aligns the closing parenthesis with the block's indentation.

Fixes weavejester#365.
@jramosg jramosg force-pushed the feature/indent-rich-comments branch from e1a9437 to 1cab794 Compare January 15, 2026 18:07
@weavejester
Copy link
Owner

This option should default to false, as we don't want it to reformat existing code.

I'm also unsure if this is the right way to go about this feature. Let me give it some thought, but my initial idea is it might be worth having a list of forms that ignore certain rules.

@jramosg
Copy link
Contributor Author

jramosg commented Jan 29, 2026

we could have something like:

{:rule-exceptions {comment #{:gather-trailing-parens}}}

what do you think?

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.

Put rich comment's closing parenthesis on a new line

2 participants