sh icon indicating copy to clipboard operation
sh copied to clipboard

Comments in a subshell are moved every time the formatter runs

Open Ashymad opened this issue 1 year ago • 0 comments

Example file.sh:

#!/bin/sh
( # Comment
    true
)

Running shfmt -w -l 1st time produces (2 spaces in front of the comment):

#!/bin/sh
(  # Comment
    true
)

Running shfmt -w -l 2nd time produces (3 spaces in front of the comment):

#!/bin/sh
(   # Comment
    true
)

Every time you run shfmt adds another space in front of the comment, never satisfied with the amount of them.

Ashymad avatar Jul 18 '24 13:07 Ashymad