-
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
This is an interesting one. Neither ShellCheck or shfmt suggest using quotes inside this default value but using quotes is the only way to prevent TS from throwing an error.
I'm using the latest Treesitter inside of Neovim v0.11.0.
This works with 1 pipe and no quotes but still throws a TS error
#!/usr/bin/env bash
HELLO="${HELLO:-YES|NO}"
echo "cool"(program ; [0, 0] - [5, 0]
(comment) ; [0, 0] - [0, 19]
(variable_assignment ; [2, 0] - [2, 24]
name: (variable_name) ; [2, 0] - [2, 5]
value: (string ; [2, 6] - [2, 24]
(expansion ; [2, 7] - [2, 23]
(variable_name) ; [2, 9] - [2, 14]
(ERROR ; [2, 16] - [2, 20]
(word)) ; [2, 16] - [2, 19]
(word)))) ; [2, 20] - [2, 22]
(command ; [4, 0] - [4, 11]
name: (command_name ; [4, 0] - [4, 4]
(word)) ; [4, 0] - [4, 4]
argument: (string ; [4, 5] - [4, 11]
(string_content)))) ; [4, 6] - [4, 10]This fails with 2 or more pipes and no quotes but breaks syntax highlighting
#!/usr/bin/env bash
HELLO="${HELLO:-YES|NO|MAYBE}"
echo "cool"(program ; [0, 0] - [5, 0]
(comment) ; [0, 0] - [0, 19]
(ERROR ; [2, 0] - [4, 11]
(variable_name) ; [2, 0] - [2, 5]
(variable_name) ; [2, 9] - [2, 14]
(ERROR ; [2, 16] - [2, 30]
(word) ; [2, 16] - [2, 19]
(word)) ; [2, 20] - [2, 28]
(word) ; [4, 0] - [4, 4]
(string ; [4, 5] - [4, 11]
(string_content)))) ; [4, 6] - [4, 10]This works with 2 or more pipes with quotes and has no errors
#!/usr/bin/env bash
HELLO="${HELLO:-"YES|NO|MAYBE"}"
echo "cool"(program ; [0, 0] - [5, 0]
(comment) ; [0, 0] - [0, 19]
(variable_assignment ; [2, 0] - [2, 32]
name: (variable_name) ; [2, 0] - [2, 5]
value: (string ; [2, 6] - [2, 32]
(expansion ; [2, 7] - [2, 31]
(variable_name) ; [2, 9] - [2, 14]
(string ; [2, 16] - [2, 30]
(string_content))))) ; [2, 17] - [2, 29]
(command ; [4, 0] - [4, 11]
name: (command_name ; [4, 0] - [4, 4]
(word)) ; [4, 0] - [4, 4]
argument: (string ; [4, 5] - [4, 11]
(string_content)))) ; [4, 6] - [4, 10]Metadata
Metadata
Assignees
Labels
No labels


