mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
6.97k stars 332 forks source link

Exclude formatting for code between `# @formatter:off` and `# @formatter:on` #1030

Closed AlexSkrypnyk closed 10 months ago

AlexSkrypnyk commented 10 months ago

Can we please have a new feature to exclude code formatting for lines between # @formatter:off and # @formatter:on

mvdan commented 10 months ago

Duplicate of https://github.com/mvdan/sh/issues/963, https://github.com/mvdan/sh/issues/933, https://github.com/mvdan/sh/issues/700.

If there is a bug, please file a bug. Otherwise, the tool isn't meant to be used for chunks of code. You can always split your scripts into multiple files, and choose to only format some of them.