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

Double Parentheses (arithmetic evaluation) - failed to parse expression.

Open iddinev opened this issue 4 years ago • 4 comments

I've just started using BLS on vim (through LanguageClient-neovim) and observed that BLS fails to parse hex conversions:

echo $((16#FF)) # prints 255

Which are valid, per-documentation expressions. I'd say this wouldn't be such a big deal, but when BLS encounters such a line it seems to be unable to parse/produce any other info for the whole file and all I get in vim is a single message 'Failed to parse expression' which is not even usually anchored on the actual line.

It is quite possible that this is not because of BLS, but as I am rather new to the whole language server deal, I thought I'd start this from the bottom up, hence this issue.

iddinev avatar Aug 11 '20 14:08 iddinev

The same issue happens to me. I found that there is a workaround to avoid "Failed to parse expression" error. For example:

expr="16#FF"
echo "$((expr))"

KevCui avatar Sep 02 '20 13:09 KevCui

@KevCui, on what IDE/editor did you observe the error?

iddinev avatar Sep 05 '20 05:09 iddinev

@iddinev neovim

KevCui avatar Sep 05 '20 06:09 KevCui

I also see this issue with VSCode's Bash IDE extension v1.14.0 which, according to its changelog, uses the bash language server version 3.0.3. The workaround by @KevCui works fine but makes the code a bit awkward.

treitmayr avatar Jul 12 '22 11:07 treitmayr

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

skovhus avatar Nov 25 '22 13:11 skovhus