You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
new treesitter syntax highlighting fails to correctly handle indented heredoc limitstring when redirection operator is <<- #127
Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
I think there's been a regression. I'm not sure when it started, since I've been doing pretty much only python for quite a few months, but I just opened a shell script in atom-1.32.0-beta0 and immediately noticed the syntax highlighting was off. Someone else mentioned to me that the change might have been due to the new "Tree-sitter parsing system".
As the subject says, syntax highlighting fails to allow a tab-indented "limit string" (commonly something like EOF) when the here-document redirection operator is <<-. The BASH man page makes it crystal clear this should be allowed.
$ man bash | grep -A2 'If the redirection operator is <<-'
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.
Steps to Reproduce
Start a heredoc with <<-EOF
Finish it off with a tab-indented EOF
Expected behavior: [What you expect to happen]
When a heredoc uses a dash in its redirection operator (i.e., <<-), the limit string must be allowed to be tab-indented.
Actual behavior: [What actually happens]
When a heredoc uses a dash in its redirection operator (i.e., <<-), atom currently requires the limit string to be at the beginning of a line.
Reproduces how often: [What percentage of the time does it reproduce?]
100%
Versions
1.32.0-beta1 on Fedora 28
Additional Information
The following example code with an indented limit string (and only << redir operator) is invalid. Notice that Github's colorization correctly sees it as a problem (as does vim and atom).
The next code block has it fixed, by adding the -. Note that this is a very common idiom for bash scripts -- the following script will execute just fine. Both github and vim's colorization handle this perfectly; however, atom freaks out and thinks everything after the 2nd EOF should still be quoted -- basically, it acts as if the - isn't there at all.
Activity
maxbrunsfeld commentedon Oct 19, 2018
Yeah, that bug looks real annoying. Thanks for the report! The fix will go out in Atom 1.32, which will enable Tree-sitter by default.
Handle heredocs w/ indented close delimiters
Handle heredocs w/ indented close delimiters