jeff-hykin / better-shell-syntax

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

Wrong syntax highlight for declare and local when specifying a variable with an attribute #69

Closed aeschli closed 3 months ago

aeschli commented 7 months ago

From https://github.com/microsoft/vscode/issues/198284

Setup:

Steps to Reproduce:

Problems:

When specifying a variable attribute (like -r) with declare and local, the syntax highlight breaks (see screenshot above):

(for clarification, any option in declare & local breaks the syntax highlight, not just -g and -r)

Reference (full list of options):

Related:

Example:

# REFERENCE

FUNCTION_CALL

correct="ok"
export correct="ok"

declare correct="ok"
declare correct=(
    "all"
    "good"
)

local correct="ok"
local correct=(
    "ok"
    "works"
)

# PROBLEM

declare -g wrong="bad"
declare -g wrong=(
    "even"
    "worse"
)

local -r wrong="bad"
local -r wrong=(
    "bad"
)