zsh-users/zsh-syntax-highlighting

"unknown-token" is overloaded

Open

#695 opened on Mar 15, 2020

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Shell (22,617 stars) (1,371 forks)batch import
FeatureIdeaImprovementTaskcomponent:testsgood first issue

Description

Highlighting all errors the same way makes sense from a UI perspective (cough #691 cough), but it makes the tests weaker: when a test checks that an alias is highlighted as unknown-token, it can't easily check whether that's due to a syntax error (as in alias x='() ]]') or due to, say, a command word not being an existing alias/function/etc. (as fixed in 9931990b92a276c6ec69cdf6af9f9f3b65603cd1).

How about adding some new styles for more specific errors — e.g., unknown-token-not-a-command-name, unknown-token-parse-error, etc — that will be highlighted the same way by default, but will make the tests more specific?

Contributor guide