From aba2914a31615ecd153cd23be035e6cdfa967a42 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 6 Mar 2023 15:38:12 -0800 Subject: [PATCH] Fix constant highlighting in JS, TypeScript Previously, SCREAMING_SNAKE_CASE identifiers were highlighted as types due to a mistake in the order of patterns in the highlight queries. --- crates/zed/src/languages/javascript/highlights.scm | 14 ++++---------- crates/zed/src/languages/typescript/highlights.scm | 13 +++++-------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/crates/zed/src/languages/javascript/highlights.scm b/crates/zed/src/languages/javascript/highlights.scm index 9dc3af4eae..36ab21ca1e 100644 --- a/crates/zed/src/languages/javascript/highlights.scm +++ b/crates/zed/src/languages/javascript/highlights.scm @@ -43,8 +43,10 @@ ; Special identifiers -((identifier) @constructor - (#match? @constructor "^[A-Z]")) +((identifier) @type + (#match? @type "^[A-Z]")) +(type_identifier) @type +(predefined_type) @type.builtin ([ (identifier) @@ -192,14 +194,6 @@ "${" @punctuation.special "}" @punctuation.special) @embedded -; Types - -(type_identifier) @type -(predefined_type) @type.builtin - -((identifier) @type - (#match? @type "^[A-Z]")) - (type_arguments "<" @punctuation.bracket ">" @punctuation.bracket) diff --git a/crates/zed/src/languages/typescript/highlights.scm b/crates/zed/src/languages/typescript/highlights.scm index 4b744c3a80..bf086ea156 100644 --- a/crates/zed/src/languages/typescript/highlights.scm +++ b/crates/zed/src/languages/typescript/highlights.scm @@ -46,6 +46,11 @@ ((identifier) @constructor (#match? @constructor "^[A-Z]")) +((identifier) @type + (#match? @type "^[A-Z]")) +(type_identifier) @type +(predefined_type) @type.builtin + ([ (identifier) (shorthand_property_identifier) @@ -193,14 +198,6 @@ "${" @punctuation.special "}" @punctuation.special) @embedded -; Types - -(type_identifier) @type -(predefined_type) @type.builtin - -((identifier) @type - (#match? @type "^[A-Z]")) - (type_arguments "<" @punctuation.bracket ">" @punctuation.bracket)