From eb71d2f1a8a606ac467e56c8d22e2d46818f87cf Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 25 Sep 2024 10:03:10 +0200 Subject: [PATCH] zig: Fix highlighting of keywords like `orelse`, `or`, `and` (#18323) This changes the Zig highlights.scm to tag all keywords with `@keyword` and not with `@keyword.`, so the highlighting works properly. Closes #9355 Release Notes: - N/A Demo: ![screenshot-2024-09-25-09 32 20@2x](https://github.com/user-attachments/assets/567b8817-a522-4741-af7f-dcb1a79ddd40) --- extensions/zig/languages/zig/highlights.scm | 78 +++++++-------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/extensions/zig/languages/zig/highlights.scm b/extensions/zig/languages/zig/highlights.scm index 152a66b670b44226de01b43d3f61cd09b057ed19..aea2d34addb822b2578bfcf6134136baf25c000f 100644 --- a/extensions/zig/languages/zig/highlights.scm +++ b/extensions/zig/languages/zig/highlights.scm @@ -103,6 +103,7 @@ field_constant: (IDENTIFIER) @constant (BlockLabel (IDENTIFIER) @tag) [ + "fn" "asm" "defer" "errdefer" @@ -112,84 +113,53 @@ field_constant: (IDENTIFIER) @constant "enum" "opaque" "error" -] @keyword - -[ + "try" + "catch" + "for" + "while" + "break" + "continue" + "const" + "var" + "volatile" + "allowzero" + "noalias" + "addrspace" + "align" + "callconv" + "linksection" + "comptime" + "export" + "extern" + "inline" + "noinline" + "packed" + "pub" + "threadlocal" "async" "await" "suspend" "nosuspend" "resume" -] @keyword.coroutine - -[ - "fn" -] @keyword - -[ "and" "or" "orelse" -] @operator - -[ "return" -] @keyword.return - -[ "if" "else" "switch" -] @keyword.control - -[ - "for" - "while" - "break" - "continue" ] @keyword [ "usingnamespace" ] @constant -[ - "try" - "catch" -] @keyword - [ "anytype" "anyframe" (BuildinTypeExpr) ] @type -[ - "const" - "var" - "volatile" - "allowzero" - "noalias" -] @keyword - -[ - "addrspace" - "align" - "callconv" - "linksection" -] @keyword.storage - -[ - "comptime" - "export" - "extern" - "inline" - "noinline" - "packed" - "pub" - "threadlocal" -] @keyword - [ "null" "unreachable"