linguist icon indicating copy to clipboard operation
linguist copied to clipboard

Shell: Combining here string & line continuation breaks bash highlighting

Open mbs-c opened this issue 1 year ago • 1 comments

Describe the bug

Bash script highlighting completely breaks for the rest of the file if you use a here string in combination with line continuation:

#!/usr/bin/env bash

# this works (here string)
ssh \
    "foo@bar" \
    "/usr/bin/bash" -sl <<< 'echo "test"'

# this doesn't (here string + line continuation)
ssh \
    "foo@bar" \
    "/usr/bin/bash" -sl <<< \
    'echo "test"'

echo 'now highlighting is completely broken and does not recover for the rest of the file'

Expected behaviour

Here string syntax is recognized and highlighted correctly even when followed by a line continuation.

Additional notes

I read the comment in https://github.com/github-linguist/linguist/blob/master/vendor/README.md, but it's impossible to report this bug in the grammar upstream, since that repository is now archived and unmaintained: https://github.com/atom/language-shellscript

mbs-c avatar Mar 22 '24 07:03 mbs-c

Unfortunately, the only options are to find a new grammar that doesn't experience this issue or fork the current grammar and fix it yourself and then open a PR to change grammars.

lildude avatar Mar 22 '24 08:03 lildude