bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

Failed to parse expression on negated test

Open dseynhae opened this issue 5 years ago • 1 comments

I am not sure this is related to #135, as there is no assignment in my test:

if  ! { test -d /tmp  &&
       test -d /home ; }; then
  echo "Missing directories"
  return 1
fi

echo "All is well, let's get started..."

This runs as expected on WSL Ubuntu18.04LTS, CentOS 6.10, ... (the directories both exist, so the negation gives a false and skips the body of "then").

However I get Failed to parse expression from bash-language-server (as an extension in my VS Code).

Taking away the negation gets rid of the syntax error, but I don't see any issues with the original code that should lead to parse errors? I'm using a group based on: https://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html

dseynhae avatar Sep 10 '19 17:09 dseynhae

Thanks for reporting this issue. It seems to be a grammar issue.

Can you create an issue over here: https://github.com/tree-sitter/tree-sitter-bash

skovhus avatar Sep 23 '19 19:09 skovhus

This seems to have been fixed in the newer version of the grammar

skovhus avatar Nov 25 '22 13:11 skovhus