Skip to content

feature_request(comments): comments inside block notation #49

@Kristinita

Description

@Kristinita

1. Summary

It would be nice, if would be possible add comments between lines for block notation.

2. Example

yaml:
  Kira
  # Comment
  Goddess

It would be nice, if this code will be valid.

3. Argumentation

User can have numerous lines, between which it would be nice to place comments. See real example of my YAML file (part of my release-it config):

before:release:
  # [INFO] Commit and push CHANGELOG changes:
  # [INFO] Overwrite master branch from SashaDevelop branch:
  # https://stackoverflow.com/a/2763118/5951529
  # https://github.com/Kristinita/SashaGitHub/commit/016ea890a1f8a7facfb357e2f244c22ee5aff94c
  # [NOTE] Checkout force required, because you can have an error:
  # “error: Your local changes to the following files would be overwritten by checkout”
  # https://stackoverflow.com/a/32556166/5951529
  # [INFO] Use “--no-ff”, that merge with commit:
  # https://ru.stackoverflow.com/a/573773/199934
  git commit -m "Changelog ${version}" &&
  git push origin HEAD &&
  git merge --no-ff --strategy=ours master &&
  git checkout -f master &&
  git merge --no-ff SashaDevelop

Not all comments for line git commit -m "Changelog ${version}" &&, it would be more correct to do so:

before:release:
  # [INFO] Commit and push CHANGELOG changes:
  git commit -m "Changelog ${version}" &&
  git push origin HEAD &&
  # [INFO] Overwrite master branch from SashaDevelop branch:
  # https://stackoverflow.com/a/2763118/5951529
  # https://github.com/Kristinita/SashaGitHub/commit/016ea890a1f8a7facfb357e2f244c22ee5aff94c
  git merge --no-ff --strategy=ours master &&
  # [NOTE] Checkout force required, because you can have an error:
  # “error: Your local changes to the following files would be overwritten by checkout”
  # https://stackoverflow.com/a/32556166/5951529
  git checkout -f master &&
  # [INFO] Use “--no-ff”, that merge with commit:
  # https://ru.stackoverflow.com/a/573773/199934
  git merge --no-ff SashaDevelop

Second variant have a more usability. It comments on specific lines; users will be better understand comments.

Currently, the larger the size of the examples, the more difficult it is for users to understand exactly which lines the comments.

4. Expected behavior

  1. Example from section 2 of this issue is valid YAML.
  2. # Comment line — comment.

5. Current behavior

ERROR:

while parsing a block mapping
  in "<unicode string>", line 1, column 1:
    yaml:
    ^
expected <block end>, but found '<scalar>'
  in "<unicode string>", line 4, column 3:
      Goddess

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions