From e0bccd2c58a54b6a2ab4435cd1c019efa08eff40 Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Thu, 2 Jan 2025 15:37:18 -0500 Subject: [PATCH] tsq: Tune highlights to more closely match 24.07 release The changes in #12148 were a bit radical - this restores some customizations we had like using "label" for captures and not highlighting the '#' or '?'/'!' parts differently. Also the highlighting for predicates we do (not) support has been restored. --- runtime/queries/tsq/highlights.scm | 23 ++++++++--------------- runtime/queries/tsq/injections.scm | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm index 67d22744..856a1da6 100644 --- a/runtime/queries/tsq/highlights.scm +++ b/runtime/queries/tsq/highlights.scm @@ -11,11 +11,6 @@ "_" @constant -[ - "@" - "#" -] @punctuation.special - ":" @punctuation.delimiter [ @@ -27,8 +22,6 @@ "." @operator -(predicate_type) @punctuation.special - (quantifier) @operator (comment) @comment @@ -41,16 +34,16 @@ name: (identifier) @variable.other.member) (named_node - name: (identifier) @variable) + name: (identifier) @tag) -(predicate - name: (identifier) @function) +((predicate + "#" @function.builtin + name: (identifier) @function.builtin @_name + type: (predicate_type) @function.builtin) + (#any-of? @_name "eq" "match" "any-of" "not-any-of" "is" "is-not" "not-same-line" "not-kind-eq" "set" "select-adjacent" "strip")) +(predicate name: (identifier) @error) -(anonymous_node - (string) @string) - -(capture - (identifier) @type) +(capture) @label (escape_sequence) @constant.character.escape diff --git a/runtime/queries/tsq/injections.scm b/runtime/queries/tsq/injections.scm index 253a9bdb..9178ea5f 100644 --- a/runtime/queries/tsq/injections.scm +++ b/runtime/queries/tsq/injections.scm @@ -5,6 +5,6 @@ name: (identifier) @_name parameters: (parameters - (string) @injection.content)) + (string (string_content) @injection.content))) (#any-of? @_name "match" "not-match") (#set! injection.language "regex"))