-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Broken syntax highlighting for Bash associative arrays (VS Code v1.75.0) #173216
Comments
Can confirm it working correctly in 1.72.2
related: #173224 |
I had the same issue (highlighting of associative arrays was broken after upgrading to 1.75.0). |
To @tikkanz's point, jeff-hykin/better-shell-syntax does help a bit, although it's still not perfect. |
@caleb531 can you share a copy/pastable snippet of what you're seeing in #173216 (comment) so we can reproduce the issue easily? VS Code insiders will have the latest from https://github.com/jeff-hykin/better-shell-syntax tomorrow, and the recovery release of 1.75.1 will bring back the grammar from 1.74 (#173336). |
@alexr00 When better-shell-syntax is enabled, the issue is fixed if I assign to the variable on the same line as the declare -A build_cmd_map=(
['gulp:build']='gulp build'
['gulp:clean']='gulp clean'
['gulp:develop']='gulp serve'
['gulp:watch']='gulp build:watch'
# this is a comment
['node:start']='npm start'
['node:build']='npm run build'
['node:watch']='npm run watch'
['node:develop']='npm run dev'
['node:preview']='npm run preview'
['jekyll:build']='jekyll build'
['jekyll:develop']='jekyll serve'
['jekyll:watch']='jekyll build --watch'
) However, if I assign separately (which still executes fine in my shell), then the syntax breaks: #!/usr/bin/env bash
declare -A build_cmd_map=
build_cmd_map=(
['gulp:build']='gulp build'
['gulp:clean']='gulp clean'
['gulp:develop']='gulp serve'
['gulp:watch']='gulp build:watch'
# this is a comment
['node:start']='npm start'
['node:build']='npm run build'
['node:watch']='npm run watch'
['node:develop']='npm run dev'
['node:preview']='npm run preview'
['jekyll:build']='jekyll build'
['jekyll:develop']='jekyll serve'
['jekyll:watch']='jekyll build --watch'
) |
Thanks @caleb531. I pulled the latest changes from the folks in jeff-hykin/better-shell-syntax into VS Code yesterday and I see both of your examples work now. If you want to use VS Code insiders then the issue should be resolved there. Or, I assume that jeff-hykin/better-shell-syntax will have another release of the extension with the fix at some point in the near future. |
This is still broken. Build 1.77.0-insiders (just updated today). Doing this breaks syntax highlighting. The only way for me to stop breaking it is if I put a escape the second entry in the array which is not valid syntax. The issue is that second red bracket. If I escape it then the colors are fine but again thats not valid. declare -A fileKeyFileMap=(["${VAR1}"]="${VAL1}" ["${VAR2}"]="${VAL2}") I moved back down to 1.7.6 stable and its working ok there. So is this fixed in the insiders build with the default shell syntax highlighter or do we need to download another one? Thanks |
@cipherdmg your issue is not yet fixed. I have opened jeff-hykin/better-shell-syntax#53 on the upstream repo for it. |
@cipherdmg the folks over in jeff-hykin/better-shell-syntax#53 have added a short term fix for your issue. You should see it in the next VS Code insiders build. |
Does this issue occur when all extensions are disabled?: Yes
Today, when I upgraded to VS Code 1.75.0, I noticed that the syntax highlighting for one of my shell files was broken, even though the syntax is correct (please see screenshots below). I do not recall this issue being present in releases prior to 1.75.0 (although all my devices have upgraded, so I am unable to confirm this).
I have disabled all my extensions, and the issue is still reproducible.
Steps to Reproduce:
You can also see a real-world example of this by pasting https://github.com/caleb531/dotfiles/blob/main/terminal/bash/build_cmds.sh into VS Code.
Screenshots
The text was updated successfully, but these errors were encountered: