From 070c4bc503b752b2632f34f8313bf2e71439eb64 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 7 Oct 2022 12:44:20 -0700 Subject: [PATCH] Add color for 'variable.special' and use it in highlight queries --- crates/zed/src/languages/cpp/highlights.scm | 2 +- crates/zed/src/languages/css/highlights.scm | 11 +++++++---- crates/zed/src/languages/javascript/highlights.scm | 4 ++-- crates/zed/src/languages/rust/highlights.scm | 2 +- crates/zed/src/languages/typescript/highlights.scm | 4 ++-- styles/src/themes/common/base16.ts | 4 ++++ 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/crates/zed/src/languages/cpp/highlights.scm b/crates/zed/src/languages/cpp/highlights.scm index 2dd9188308..b832fb4e2d 100644 --- a/crates/zed/src/languages/cpp/highlights.scm +++ b/crates/zed/src/languages/cpp/highlights.scm @@ -41,7 +41,7 @@ (field_identifier) @property (statement_identifier) @label -(this) @variable.builtin +(this) @variable.special [ "break" diff --git a/crates/zed/src/languages/css/highlights.scm b/crates/zed/src/languages/css/highlights.scm index 3638837af7..aba156633a 100644 --- a/crates/zed/src/languages/css/highlights.scm +++ b/crates/zed/src/languages/css/highlights.scm @@ -41,10 +41,13 @@ (function_name) @function -((property_name) @variable - (#match? @variable "^--")) -((plain_value) @variable - (#match? @variable "^--")) +( + [ + (property_name) + (plain_value) + ] @variable.special + (#match? @variable.special "^--") +) [ "@media" diff --git a/crates/zed/src/languages/javascript/highlights.scm b/crates/zed/src/languages/javascript/highlights.scm index d3921cdbc8..773780a8e0 100644 --- a/crates/zed/src/languages/javascript/highlights.scm +++ b/crates/zed/src/languages/javascript/highlights.scm @@ -55,8 +55,8 @@ ; Literals -(this) @variable.builtin -(super) @variable.builtin +(this) @variable.special +(super) @variable.special [ (true) diff --git a/crates/zed/src/languages/rust/highlights.scm b/crates/zed/src/languages/rust/highlights.scm index 72482b4073..f4a451529e 100644 --- a/crates/zed/src/languages/rust/highlights.scm +++ b/crates/zed/src/languages/rust/highlights.scm @@ -1,6 +1,6 @@ (type_identifier) @type (primitive_type) @type.builtin -(self) @variable.builtin +(self) @variable.special (field_identifier) @property (call_expression diff --git a/crates/zed/src/languages/typescript/highlights.scm b/crates/zed/src/languages/typescript/highlights.scm index d3921cdbc8..773780a8e0 100644 --- a/crates/zed/src/languages/typescript/highlights.scm +++ b/crates/zed/src/languages/typescript/highlights.scm @@ -55,8 +55,8 @@ ; Literals -(this) @variable.builtin -(super) @variable.builtin +(this) @variable.special +(super) @variable.special [ (true) diff --git a/styles/src/themes/common/base16.ts b/styles/src/themes/common/base16.ts index 326928252e..1811167719 100644 --- a/styles/src/themes/common/base16.ts +++ b/styles/src/themes/common/base16.ts @@ -185,6 +185,10 @@ export function createTheme( color: sample(ramps.neutral, 7), weight: fontWeights.normal, }, + "variable.special": { + color: sample(ramps.blue, 0.80), + weight: fontWeights.normal, + }, comment: { color: sample(ramps.neutral, 5), weight: fontWeights.normal,