zsh-syntax-highlighting icon indicating copy to clipboard operation
zsh-syntax-highlighting copied to clipboard

"unknown-token" is overloaded

Open danielshahaf opened this issue 4 years ago • 3 comments

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?

danielshahaf avatar Mar 15 '20 17:03 danielshahaf

I thought there was already an issue for this, but perhaps all the discussion was on IRC. I think we need at least four new styles: parse-error for when zsh will error before attempting to run anything, unknown-arg0 for command not found, command-error for things like [ -n foo; or sudo;, and lint-warning for things like #691 and ; ;. All three (or more) can fallback to unknown-token to maintain backwards compat.

Unopposed to further splitting past those so that each error style is distinct.

phy1729 avatar Mar 15 '20 17:03 phy1729

Sounds good to me. Labelled "good first issue".

danielshahaf avatar Mar 15 '20 18:03 danielshahaf

Triage: incomplete, new feature (as opposed to bugfix), but referenced by many other issues so presumed a popular feature request, 0.8.0 has plenty of content already merged, redrawhook is the next priority: remilestone 0.9.0.

danielshahaf avatar May 22 '20 02:05 danielshahaf