snakefmt icon indicating copy to clipboard operation
snakefmt copied to clipboard

introduce `# fmt: off` and `# fmt: on` tags to skip formatting within files

Open dlaehnemann opened this issue 3 years ago • 0 comments

This is a follow-up feature request to issue #85 that deals with comment formatting. Handling of one of the test cases there, with aligned comments across multiple lines to hide these lines during docs rendering, cannot be implemented easily within snakefmt.

As suggested in that issue's discussion, one workaround could be comment tags before and after respective sections that turn formatting off and then back on.

black has this and uses # fmt: off and #fmt: on, requiring both comments to be on the same indentation level. I think it would make sense to use exactly the same syntax, so that black users will already know it. And the naming makes perfect sense for snakefmt, as well. In black, you should find the relevant code by searching for FMT_OFF in: https://github.com/psf/black/blob/dea81b7ad5cfa04c3572771c34af823449d0a8f3/src/black/init.py

dlaehnemann avatar Dec 01 '20 12:12 dlaehnemann