jeff-hykin / better-shell-syntax

💾 📦 ♻️ An improvement to the shell syntax for VS Code
MIT License
52 stars 4 forks source link

Regression: Latest version breaks highlighting from nested quotes inside braces after semi-colon on same line in sh mode. #29

Closed MarximusMaximus closed 1 year ago

MarximusMaximus commented 1 year ago

VSCode Version: 1.74.1 better-shell-syntax version: 1.2.9 OS: macOS 12.6

Previously was working. Seems to be when there is a command separated by a semi-colon on the same line as a function definition with cuddled braces and a quoted parameter expansion with quotes inside.

Example Code:

#!/usr/bin/env sh

# works:
a="${-:+"-$-"}"

# works:
date() {
    a="${-:+"-$-"}"
    set +x; if [ -n "${a}" ]; then set -x; else set +x; fi

    if [ "$(uname)" = "Darwin" ]; then
        command date -j "$@"
    else
        command date "$@"
    fi

    set +x ${a}
    unset a
}

# works:
nulldef; date()
{
    a="${-:+"-$-"}"
    set +x; if [ -n "${a}" ]; then set -x; else set +x; fi

    if [ "$(uname)" = "Darwin" ]; then
        command date -j "$@"
    else
        command date "$@"
    fi

    set +x ${a}
    unset a
}

# does not work:
nulldef; date() {
    a="${-:+"-$-"}"
    set +x; if [ -n "${a}" ]; then set -x; else set +x; fi

    if [ "$(uname)" = "Darwin" ]; then
        command date -j "$@"
    else
        command date "$@"
    fi

    set +x ${a}
    unset a
}

Results: Screen Shot 2022-12-15 at 18 19 12

Expected similar to: Screen Shot 2022-12-15 at 18 19 24

jeff-hykin commented 1 year ago

Should be fixed now with v1.3.0