-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using a better maintained shellscript grammar #77675
Comments
Leaving open to check on if we decided to update the old shell script grammar. |
Probably the same issue here. I have an intended Heredoc whose delimiter isn't recognized correctly because of indentation. Although I'm using the
if true; then
cat <<-'EOF' > /tmp/file
# My script here
EOF
fi |
Sorry for my wrong gist a moment ago. I then noticed it's limited to tabs. |
Related: #102958 (Wrong syntax highlighting when using \. in regex inside HEREDOC) |
Hi, Please consider that type of code too (var=` ... ) #!/bin/sh
if [ -d "$directory" ]
then
# syntax broken after
mount_script=`/usr/bin/osascript <<EOF
tell application "Finder"
activate
mount volume "smb://$myshare"
end tell
EOF`
else
echo blah
fi
echo another code here
exit 0 The script is running but it's a pain to working on it (the real one counts ~400 lines). The only fix I found (during script editing only) is to move "EOF`" at the very begin of the line AND remove the ending "`" char. #!/bin/sh
if [ -d "$directory" ]
then
mount_script=`/usr/bin/osascript <<EOF
tell application "Finder"
activate
mount volume "smb://$myshare"
end tell
EOF
else
echo blah
fi
echo another code here
exit 0 Despite the coloration is broken, VSCODE is correctly find the <<EOF .... EOF delimiters as it highlights the both when I select one. VS Code version: Code 1.52.1 (ea3859d, 2020-12-16T16:30:02.420Z) System Info
Extensions (6)
A/B Experiments
|
In this script cat <<- HEREDOC > $variable1/filename
text="some=$variable2"
HEREDOC |
One more to add to the list of issues with bash syntax highlighting: close_t='"2011-04-22T13:33:48Z"'
if [[ "${close_t}" =~ ^\"([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})T(([0-9]{1,2}:){2}[0-9]{1,2}Z)\" ]]; then
echo "It is in expected format."
else
echo "It is not in the expected format."
fi But it breaks highlight just the next line in vscode. The broken behavior is triggered by the GitHub's syntax highlight goes a bit farther and breaks the syntax highlighting in the remainder of the code block. :) This is how it looks in VSCode 1.59.1: Just in case, vim's sh syntax handles this case well (tested version 189 of that file, it is currently at 198). |
One more to add to the list of issues with bash syntax highlighting: Code: header <wine-pca.txt -a pc1,pc2 |
paste -d, - <(xsv select type wine-scaled.csv) |
tee wine-pca.csv | csvlook All codes after this command lose syntax highlighting (shown as the same color as comments). |
Another more current example: function get_source() {
if [[ -z ${RTM_TPL_SOURCE-} ]]
then
RTM_TPL_SOURCE="$(enquirer select --cancel --default --selected 1 --message 'Install RTM from?' -- crates.io github.com)"
export RTM_TPL_SOURCE
fi
verbose_print "RTM source: ${RTM_TPL_SOURCE}"
} Version: 1.68.0 |
That seems an issue with the It happens even here in github: function get_source() {
if [[ -z ${RTM_TPL_SOURCE-} ]]
then
RTM_TPL_SOURCE="$(a select b c)"
export RTM_TPL_SOURCE
fi
verbose_print "RTM source: ${RTM_TPL_SOURCE}"
} |
@alexr00 not sure if this helps or is noise, but it appears the only bash language server implementation points to the tree-sitter grammar for bash. That grammar repository does appear to be maintained, but there would appear to be some setup required to test if that resolves the issues reported here. Its not clear to me what additional VSCode setup would be required.... Maybe all this? |
@taqtiqa-mark I appreciate the pointer, but we don't currently have syntax highlighting support with treesitter: #50140 |
Rewrite code to add root CA certificate to Helm values files. Fixes longstanding issue where VSCode does not syntax highlight subsequent lines properly: microsoft/vscode#77675
Rewrite code to add root CA certificate to Helm values files. Fixes longstanding issue where VSCode does not syntax highlight subsequent lines properly: microsoft/vscode#77675
Rewrite code to add root CA certificate to Helm values files. Fixes longstanding issue where VSCode does not syntax highlight subsequent lines properly: microsoft/vscode#77675
@jeff-hykin do you plan to continue to maintain https://github.com/jeff-hykin/better-shell-syntax? I'm considering trying it out as the default grammar for shell script as the current one hasn't been touched in a long time. |
@alexr00 over the last week (in response to this) I cleaned up the better shell syntax and stablized it. @people-on-this-thread please do install/test the extension. It should ready for VS Code insiders, but it'd be nice to get some feedback to confirm there are no regressions. There's known bugs, but currently no known regressions. #156054 is already fixed #147673 is not |
@jeff-hykin this is great news, thank you! I'll pull your grammar into VS Code now. We're not having a December release so it will have lots of time in VS Code insiders for folks to notice if there are regressions before we release. |
You can see a visual comparison of the differences in the new grammar in #169118. |
The new grammar has been in VS Code insiders for 3 weeks with no issues reported. Closing as fixed! |
This has been verified by the integration tests. |
Duplicate of locked #40956 , which redirected the discussion to atom/language-shellscript#100 , where I was told it's no longer their problem:
·
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.
Steps to Reproduce:
moo.sh
:__FOO__
to see the flipside of this bug: VSCode now thinks everything is ok.Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: