pappasam / toml-sort

Toml sorting library
https://toml-sort.readthedocs.io/en/latest/
MIT License
90 stars 18 forks source link

Leading spaces in comments should be preserved #61

Open justinchuby opened 1 year ago

justinchuby commented 1 year ago

The comment

# init_command = [
#     'python',
#     'examples/pytorch/s3_init.py',
#     '--config-json=examples/pytorch/s3_init_config.json',
#     '--linter=clang-format',
#     '--dry-run={{DRYRUN}}',
#     '--output-dir=.lintbin',
#     '--output-name=clang-format',
# ]

is formatted as

# init_command = [
# 'python',
# 'examples/pytorch/s3_init.py',
# '--config-json=examples/pytorch/s3_init_config.json',
# '--linter=clang-format',
# '--dry-run={{DRYRUN}}',
# '--output-dir=.lintbin',
# '--output-name=clang-format',
# ]

It would be great if the leading spaces are preserved.

edvardm commented 4 days ago

agreed, another related option could be "--no-comment-format" or similar to leave comments alone