You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if [[ $-!=*i*&&# . ./main.sh$-!=*c*# sh -c '. ./main.sh'
]];thenecho$-fi
will be formatted to
if [[ $-!=*i*&&$-!=*c* ]] \
;then# . ./main.sh# sh -c '. ./main.sh'echo$-fi
I don't like the formatted code. I want $- != *i* means this script is run by . ./main.sh, $- != *c* means sh -c '. ./main.sh'. so I hope to keep the comment on the same line as the code. How to avoid this behavior?
The text was updated successfully, but these errors were encountered:
The formatter tries to keep comments where they are on a best-effort basis. This is probably an edge case that we should improve, although I admit it's the first time I ever see it, so it doesn't seem high priority. Patches with tests are always welcome, as long as you don't break the other test cases :)
mvdan
changed the title
[question] keep the comment on the same line as the code
syntax: keep inline comments inside test clauses in place
Jul 22, 2023
will be formatted to
I don't like the formatted code. I want
$- != *i*
means this script is run by. ./main.sh
,$- != *c*
meanssh -c '. ./main.sh'
. so I hope to keep the comment on the same line as the code. How to avoid this behavior?The text was updated successfully, but these errors were encountered: