Skip to content

Add inline_comment_spaces formatter option - #883

Open
ChrisJr404 wants to merge 1 commit into
tamasfe:masterfrom
ChrisJr404:inline-comment-spaces
Open

Add inline_comment_spaces formatter option#883
ChrisJr404 wants to merge 1 commit into
tamasfe:masterfrom
ChrisJr404:inline-comment-spaces

Conversation

@ChrisJr404

Copy link
Copy Markdown

Closes #469.

Adds an inline_comment_spaces formatter option to control how many spaces go before a trailing comment on the same line as an entry or array item, similar to PEP 8's two-space convention. It defaults to 1, so existing output is unchanged, and it only kicks in when the comment isn't being aligned by align_comments (the alignment logic already handles spacing in that case).

The spacing is applied in format_rows by overriding the separator used before the comment column, so it covers both entry comments and array item comments. Added two formatter tests (one for the new spacing, one asserting the default stays a single space) and a row in the formatter options docs.

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.

FEAT: Add the option to have 2 spaces before inline comment like PEP 8 of Python

1 participant