question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider using a better maintained shellscript grammar

See original GitHub issue

Please search existing issues to avoid creating duplicates.

Duplicate of locked https://github.com/microsoft/vscode/issues/40956 , which redirected the discussion to https://github.com/atom/language-shellscript/issues/100 , where I was told it’s no longer their problem:

VSCode is still using the old TextMate grammar, which the Atom team no longer maintains as we have moved many grammars (including this one) over to Tree-sitter.

·

Also please test using the latest insiders build to make sure your issue has not already been fixed:

Can’t do that right now, maybe next week. In case it was really fixed, please consider this issue as a request to annotate the locked thread with updated info.

  • VSCode Version: 1.36.1
  • OS Version: Ubuntu 16.04 LTS (xenial)

Steps to Reproduce:

  1. Create a bash file moo.sh:
#!/bin/bash
nl <(sed -nre 's!^\s+!!p' <<'  __FOO__'
  ########################
  ## Dummy Message      ##
  ########################
  __FOO__
  )
echo bar
  1. Compare with my screenshot.
  2. Run it and observe that bash considers “echo” a command of its own.
  3. Unident __FOO__ to see the flipside of this bug: VSCode now thinks everything is ok.
  4. Run again, see that in reality, unindenting broke it:
./moo.sh: line 2: unexpected EOF while looking for matching `)'
./moo.sh: line 9: syntax error: unexpected end of file

Does this issue occur when all extensions are disabled?: Yes

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
marcelbruecknercommented, Aug 28, 2019

Probably the same issue here. I have an intended Heredoc whose delimiter isn’t recognized correctly because of indentation. Although I’m using the <<- syntax as stated in man bash

If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion.

if true; then
    cat <<-'EOF' > /tmp/file
        # My script here
    EOF
fi
3reactions
robmontecommented, Oct 2, 2019

I have found that it seems to break with the standard EOF too:

echo "here is some $SYNTAX coloring"
cat << EOF > myfile.txt
multiple line
output into
a file
EOF
echo "here is some more $SYNTAX coloring"

As you can see, this works on Github itself. While it works here, this breaks in VSCode: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linux Shell / Shell Script Best Practices
Linux Shell / Shell Script Best Practices. This page lists best practices, based on industry standards and first-hand experience. Use simple shell scripts ......
Read more >
Technical Note TN2065: do shell script in AppleScript
This Technote answers frequently asked questions about AppleScript's do shell script command. This technical note addresses common questions ...
Read more >
How to Use if-else in Shell Scripts? - DigitalOcean
We use if-else in shell scripts when we wish to evaluate a condition, then decide to execute one set between two or more...
Read more >
3.4. Shell script and command line tips - AFNI
More general math operations, via bc (shell) ... It assumes that you are comfortable with basic shell syntax and commands, such as with...
Read more >
Bash grammar manual - shell script - Unix Stack Exchange
I'm not sure there are good enough formal grammars for Bash. In a few days (September 18 th 2017), there are two Gallium...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found