The shell syntax highlight is wrong after output redirection and a string #153
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
The shell syntax highlighting does not behave as expected after the first double quote of a string that follows an output redirection (line 200 on the screenshot below).
All the rest of the file is somewhat coloured as a string (green).
Please find the following screenshot from Atom:
For comparison, here's also a screenshot from gedit of the same file, to show how the syntax highlighting look:
(Copyright note: the code snippet shown in the screenshots above is from the script "multicrop" for ImageMagick by Fred Weinhaus, found at http://www.fmwconcepts.com/imagemagick/index.php)
After some trials, it seems that removing >&2
fixes the highlighting. So, the syntax is coloured correctly if that is deleted. In the steps below you find a snipped i used for trials.
Steps to Reproduce
- Take this snippet of code:
functs()
{
echo >&2 ""
echo >&2 "$USER:" "$PATH"
echo >&2 'this' "that"
}
- Paste it in Atom, select "Shell Script" as sysntax highlighitng
- You'll see that after the first double quote of the first string after
>&2
everything is green, a part from variables - To verify what should be the behaviour, paste the same snippet in gedit and highlighting for "sh" does hold the desired result
- When the string
>&2
is removed, sometimes the systax is highlighted correctly again.
Expected behavior:
See description
Actual behavior:
See description
Reproduces how often:
All the time, consistently
Versions
$ atom --version
Atom : 1.40.1
Electron: 3.1.10
Chrome : 66.0.3359.181
Node : 10.2.0
$ apm --version
apm 2.4.3
npm 6.2.0
node 10.2.1 x64
atom 1.40.1
python 2.7.15+
git 2.17.1
Additional Information
Ubuntu OS, 18.04
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic