Skip to content
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 shell script highlighting for array elements used as an array index #101716

Closed
foreignmeloman opened this issue Jul 4, 2020 · 2 comments
Closed
Assignees
Labels
grammar Syntax highlighting grammar upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@foreignmeloman
Copy link

Version: 1.47.0-insider (user setup)
Commit: 376d9d9
Date: 2020-07-03T10:27:06.804Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.16299

Steps to Reproduce:

Seems like vscode struggles with highlighting bash syntax correctly when array elements are used as an array index.
Example code:

echo ${a[${b[0]}]}

As you can see the last two symbols are not colored correctly:
image

This will only be visible with themes that have additional highlighting of some elements like the default Dark+.
I think that the closing square bracket in ${b[0]} is causing the issue, since when you remove the square brackets the highlighting goes back to normal:
image

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

@alexr00
Copy link
Member

alexr00 commented Jul 6, 2020

Thank you for filing this issue. It is a problem with the grammar we use for shell script syntax highlighting. Specifically, this tokenization is incorrect:
image

However, the repository we get the shell script grammar from is no longer maintaining the grammar. I'll leave this bug open so that if we adopt a new grammar it can be addressed.

@alexr00 alexr00 added grammar Syntax highlighting grammar upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Jul 6, 2020
@alexr00
Copy link
Member

alexr00 commented Nov 5, 2020

Linking and closing in favor of #77675, which tracks considering a new shellscript grammar.

@alexr00 alexr00 closed this as completed Nov 5, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants