Closed
Description
I'm getting the message Syntax error: expected "word" somewhere in the file
when I have statements like if ! myvar="$( some_func )"; then
A minimal, complete example:
#! /usr/bin/env bash
bar() {
echo "bar"
return 1
}
foo=''
if ! foo="$(bar)"; then # <-- Syntax error: expected "word" somewhere in the file
echo "ok."
fi
If I change it to just
if foo="$( bar )"; then
, then it doesn't bark. It's the!
that makes it angry.
this is valid bash and executes without issue. This also didn't happen in an older version of bash-language-server
. I upgraded the other day, but I'm not sure what the old version I had running was. I use this structure in my code all the time so it's kinda annoying to constantly see this syntax error.