Skip to content

Feature: Normalize spaces - #14

Merged
GB609 merged 4 commits into
masterfrom
feature/normalize-spaces
Aug 24, 2026
Merged

GB609 merged 4 commits into
masterfrom
feature/normalize-spaces

Conversation

@GB609

@GB609 GB609 commented Aug 24, 2026

Copy link
Copy Markdown
Owner

This PR changes how spaces are handled to simply all the matching rules and thus reduce code clutter.

  • any space before # is now stripped
  • spaces between # and @ will be normalized to exactly one space
  • Since multiline annotations depend on indentation level, the blank text AFTER # up to (and not including) the first none-space character is 'saved' for pattern matching when a multiline annotion is encountered.

The last normalization step will break current behaviour for multiline annotations in one special case:

# @description With multiline
# NOTE: Spaces BEFORE '#' are discarded long before annotations are evaluated.
     #    @requires This is a working case
     #     'count' of blanks starts at the same column and second line is at least one space deeper
   #    @requires Correctly ignored
   #    Same start column, but no deeper nesting
 #    @requires Incorrectly ignored
   #    The block is indendented optically, but the 'distance' to the starting '#' is identical (4)
   #    Thus it is not considered to be indented
someFunc() {
  #...
}

I think keeping '#' aligned would help reability much more than allowing to place it literally anywhere. It's not too hard to keep it consistent for one block at least. As such, i'm not going to add the complexity to deal with this.

closes: #11

GB609 added 4 commits August 24, 2026 10:16
Spaces in 2 places are trimmed automatically for every comment line:
- at the beginning, everything matching `^[[:space:]]*#`
- in between the comment start and the `@`, with `^#[[:space:]]+@`:
  This runs after the first and only, where there is more than one space
@GB609
GB609 merged commit 6d88543 into master Aug 24, 2026
2 checks passed
@GB609
GB609 deleted the feature/normalize-spaces branch August 24, 2026 11:10
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.

Generalize handling of leading spaces

1 participant