#!/bin/sh
case "$1" in
case1)
cmd1 cmd1_arg1 cmd1_arg2 cmd1_arg3;;
case2) cmd2 cmd2_arg1 cmd2_arg2 cmd2_arg3;;
esac
In a shell script case statement:
1) when the case pattern and command are placed on separate lines, the highlighter correctly recognizes the commands/arguments and colors them appropriately; they get placed into appropriate scopes.
2) When the case pattern and command are placed on the same line, the command and arguments are not recognized as such and are simply placed in a scope for a case clause body, which has no special highlighting.
On line 4:
cmd1 is placed in the "entity.name.command.shell" textmate scope, with its own foreground color (for me '#DCDCAA')
cmd1_arg1, cmd1_arg2, and cmd1_arg3 are each placed into "string.unquoted.argument.shell" scope with a foreground color set (for me '#CE9178')
On line 5:
Everything on this line displays with the default foreground color (for me '#D4D4D4')
This is because " cmd2 cmd2_arg1 cmd2_arg2 cmd2_arg3" is placed into the "meta.scope.case-clause-body.shell" scope, which has no foreground color set.
#!/bin/sh
#shellcheck disable=SC2034
case "$1" in
i) id="$OPTARG";;
*)
esac
case "$1" in
i)
id="$OPTARG";;
*)
esac
Same thing happens for keyword highlighting.
On line 4:
" id" is placed into the meta.scope.case-clause-body.shell texmate scope, which has no foreground color set (so it displays with the default ('#D4D4D4')
On line 10, "id" is placed into the variable.other.assignment.shell scope and is highlighted as a variable (for me set to '#9CDCFE')
The code with a problem is:
In a shell script case statement: 1) when the case pattern and command are placed on separate lines, the highlighter correctly recognizes the commands/arguments and colors them appropriately; they get placed into appropriate scopes.
2) When the case pattern and command are placed on the same line, the command and arguments are not recognized as such and are simply placed in a scope for a case clause body, which has no special highlighting.
On line 4:
On line 5:
Same thing happens for keyword highlighting.
On line 4: " id" is placed into the meta.scope.case-clause-body.shell texmate scope, which has no foreground color set (so it displays with the default ('#D4D4D4')
On line 10, "id" is placed into the variable.other.assignment.shell scope and is highlighted as a variable (for me set to '#9CDCFE')
It looks like:
It should look like:
description of ideal
Originally from @slycordinator in https://github.com/microsoft/vscode/issues/207666