foxundermoon / vs-shell-format

the shellscript、Dockerfile、properties ...... format extension
MIT License
450 stars 50 forks source link

Command arguments are being indented at the same level as the parent #372

Closed unacceptable closed 10 months ago

unacceptable commented 10 months ago

I've noticed an issue with how vs-shell-format handles the indentation of command arguments. Currently, arguments are indented at the same level as their parent command, which reduces the overall readability and clarity of the script. This formatting style makes it challenging to distinguish between the primary command and its subsequent arguments or sub-commands, especially in complex scripts.

For example, currently formatted code looks like this:

foo | \
    bar | \
    sed \
    -e '<something>' \
    -e '<something else>'

I propose adjusting the formatter to indent arguments at a different level from their parent command, like so:

foo | \
    bar | \
    sed \
        -e '<something>' \
        -e '<something else>'

This change would align with common scripting conventions, enhance readability, and make maintenance and debugging more straightforward. It would also provide a clear visual hierarchy in the script, making it easier to parse and understand at a glance.

unacceptable commented 10 months ago

After reviewing the code, I opened this under the wrong project.