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

Bash/Zsh syntax highlighting #1914

Closed
joezak11 opened this issue Apr 1, 2022 · 3 comments · Fixed by #1917
Closed

Bash/Zsh syntax highlighting #1914

joezak11 opened this issue Apr 1, 2022 · 3 comments · Fixed by #1917
Labels
C-bug Category: This is a bug

Comments

@joezak11
Copy link
Contributor

joezak11 commented Apr 1, 2022

Summary

I opened a zsh plugin and noticed that the highlighting was messed up

#                                   v
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"

if I remove the % character in (%) the string is highlighted correctly but with that character the start quote gets ignored and anything after the second quote is highlighted as a string.
this also affects bash files as it seems there is no zsh specific configuration by default.

Reproduction Steps

I tried this:

  1. hx any.zsh
  2. make a string with "${(%)}" or other special characters except #, $, or &

I expected this to happen:
to highlight the string normally even if it is invalid (although in this case it isn't).

Instead, this happened:
the start quote is ignored and the end quote is parsed as a start qoute

Helix log

No response

Platform

Linux

Terminal Emulator

wezterm 20220319-142410-0fcdea07

Helix Version

helix 22.05-dev (a963565)

@joezak11 joezak11 added the C-bug Category: This is a bug label Apr 1, 2022
@archseer
Copy link
Member

archseer commented Apr 1, 2022

Can you try bumping the tree-sitter-bash version and fetch/rebuild grammars? We're a bit behind the latest. If you still get the same issue consider reporting it upstream at https://github.com/tree-sitter/tree-sitter-bash

@joezak11
Copy link
Contributor Author

joezak11 commented Apr 1, 2022

it does work after updating tree-sitter-bash

@the-mikedavis
Copy link
Member

Would you mind submitting a PR with the update? You'll need to update the revision here:

source = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "a8eb5cb57c66f74c63ab950de081207cccf52017" }

And make a small modification to runtime/queries/bash/highlights.scm: tree-sitter/tree-sitter-bash@tree-sitter:a8eb5cb...tree-sitter:275effd#diff-d485a982e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants