lua: Update keyword operator highlighting (#26091)
Resolves #26032 This PR changes the highlighting for `and`, `not` and `or` in Lua from `operator` to `keyword.operator`. [VS Code also highlights these as keyword operators](https://github.com/LuaLS/lua.tmbundle/blob/1483add845ebfb3e1e631fe372603e5fed2cdd42/Syntaxes/Lua.plist#L277-L279) and Zed does this for other languages as well, like [Python](https://github.com/zed-industries/zed/blob/813e207514f76ec3f8bc8bbb649deaafa304de9e/crates/languages/src/python/highlights.scm#L221-L229) or [Zig](https://github.com/zed-industries/zed/blob/813e207514f76ec3f8bc8bbb649deaafa304de9e/extensions/zig/languages/zig/highlights.scm#L145-L149). Additionally, in 813e207514f76ec3f8bc8bbb649deaafa304de9e I removed duplicate matches for existing keywords to improve readability and align them to how keywords are generally matched across languages (see [Rust](https://github.com/zed-industries/zed/blob/813e207514f76ec3f8bc8bbb649deaafa304de9e/crates/languages/src/rust/highlights.scm#L79-L119) and [Typescript](https://github.com/zed-industies/zed/blob/813e207514f76ec3f8bc8bbb649deaafa304de9e/crates/languages/src/typescript/highlights.scm#L210-L269) for example). Whilst contributing to the majority of the diff, this does not change any existing highlights. | Before | After | | --- | --- | | <img width="309" alt="old" src="https://github.com/user-attachments/assets/7790817e-4a0d-442b-b176-9a84bcc6f3c4" /> | <img width="309" alt="PR" src="https://github.com/user-attachments/assets/34a57962-938a-4465-9406-288f5c456aa3" /> | Release Notes: - N/A --------- Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
co-authored by
Peter Tripp
parent
06a226dc32
commit
efaf358876
@@ -1,74 +1,23 @@
|
||||
;; Keywords
|
||||
|
||||
"return" @keyword
|
||||
|
||||
[
|
||||
"goto"
|
||||
"in"
|
||||
"local"
|
||||
] @keyword
|
||||
|
||||
(break_statement) @keyword
|
||||
|
||||
(do_statement
|
||||
[
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(repeat_statement
|
||||
[
|
||||
"repeat"
|
||||
"until"
|
||||
] @keyword)
|
||||
|
||||
(if_statement
|
||||
[
|
||||
"if"
|
||||
"elseif"
|
||||
"else"
|
||||
"then"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(elseif_statement
|
||||
[
|
||||
"elseif"
|
||||
"then"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(else_statement
|
||||
[
|
||||
"else"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_declaration
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_definition
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword)
|
||||
"goto"
|
||||
"if"
|
||||
"in"
|
||||
"local"
|
||||
"repeat"
|
||||
"return"
|
||||
"then"
|
||||
"until"
|
||||
"while"
|
||||
(break_statement)
|
||||
] @keyword
|
||||
|
||||
;; Operators
|
||||
|
||||
@@ -76,7 +25,7 @@
|
||||
"and"
|
||||
"not"
|
||||
"or"
|
||||
] @operator
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"+"
|
||||
|
||||
Reference in New Issue
Block a user