Skip to content

Highlight closing brackets #226

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

Closed
5 of 7 tasks
danielshahaf opened this issue Oct 30, 2015 · 2 comments
Closed
5 of 7 tasks

Highlight closing brackets #226

danielshahaf opened this issue Oct 30, 2015 · 2 comments
Milestone

Comments

@danielshahaf
Copy link
Member

In the following constructs, the opening parenthesis/bracket/brace is highlighted as a reserved word, and the closing one isn't, but should be.

  • (subshell) — done in c0dafd1
    • That kicked in for array assignments too (e.g., a=(foo bar)); fixed by b285c7b.
    • (pattern), part of the case syntax — punted.
  • { block } — done in c0dafd1
  • [[ test ]]
  • (( arithmetic evaluation )) — done in a59f442
  • [ test ] — note that this one is a builtin, unlike the others which are reserved words.
@danielshahaf
Copy link
Member Author

a59f442 handles arithmetic evaluation, which is different from all the other cases: for every other case, the closing } or ) or ]] is its own token, but the ${(z)} splitter gives the entire (( … )) statement as a single token.

@danielshahaf
Copy link
Member Author

c0dafd1 handles subshells and blocks, which are easy because ) and } tokens are special wherever they occur.

The test syntax isn't as simple, since ]] is not always special — e.g., echo ]] works and prints two closing brackets — so it will require remembering that "the current command is [[".

As mentioned above, [ is a builtin but [[ is a reserved word. That has various user-visible consequences at the language level. It also causes [[ to be highlighted in yellow and [ in green. How similarly or differently should [ and [[ statements be highlighted?

danielshahaf added a commit that referenced this issue Nov 16, 2015
…#226.)

Followup to c0dafd1, which changed the highlight of
those ')'s from <nothing> to [reserved-word].
phy1729 added a commit to phy1729/zsh-syntax-highlighting that referenced this issue Oct 21, 2018
phy1729 added a commit to phy1729/zsh-syntax-highlighting that referenced this issue Oct 21, 2018
@phy1729 phy1729 added this to the 0.7.0 milestone Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants