diff --git a/runtime/queries/_typescript/highlights.scm b/runtime/queries/_typescript/highlights.scm index e828285b..8bbd1072 100644 --- a/runtime/queries/_typescript/highlights.scm +++ b/runtime/queries/_typescript/highlights.scm @@ -86,6 +86,7 @@ [ "abstract" + "accessor" "declare" "module" "infer" @@ -94,8 +95,12 @@ "namespace" "override" "satisfies" + "using" ] @keyword +; `asserts` in a return-type type predicate, e.g. `function f(x): asserts x is T` +"asserts" @keyword.operator + [ "export" "from" @@ -150,3 +155,17 @@ (import_require_clause (identifier) "=" ("require") @keyword) + +; Method signatures in interfaces / type literals, and function-typed +; property signatures (`foo(): void`, `bar: () => void`). +(method_signature + name: (property_identifier) @function.method) +(abstract_method_signature + name: (property_identifier) @function.method) +(property_signature + name: (property_identifier) @function.method + type: (type_annotation + [ + (function_type) + (union_type (parenthesized_type (function_type))) + ])) diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm index 41a67360..c15231c1 100644 --- a/runtime/queries/c-sharp/highlights.scm +++ b/runtime/queries/c-sharp/highlights.scm @@ -185,6 +185,16 @@ "init" "with" "let" + ;; LINQ query clauses + "group" + "by" + "into" + "join" + "on" + "equals" + "orderby" + "ascending" + "descending" ] @keyword [ @@ -195,6 +205,32 @@ "when" ] @keyword.control.conditional +;; Pattern matching combinators (`x is not null`, `> 0 and < 10`) + +[ + "and" + "or" + "not" +] @keyword.operator + +;; Preprocessor directives + +[ + "#define" + "#undef" + "#if" + "#elif" + "#else" + "#endif" + "#region" + "#endregion" + "#error" + "#warning" + "#line" + "#nullable" + "#pragma" +] @keyword.directive + ;; Attribute (attribute name: (identifier) @attribute) diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm index 624b876c..2daff9fb 100644 --- a/runtime/queries/php/highlights.scm +++ b/runtime/queries/php/highlights.scm @@ -165,10 +165,11 @@ "global" "implements" "insteadof" - "new" - "private" - "protected" - "public" + "new" + "print" + "private" + "protected" + "public" "clone" "unset" ] @keyword @@ -207,10 +208,11 @@ ] @keyword.control.import [ - "return" - "break" - "continue" + "return" + "break" + "continue" "yield" + "from" ; the `from` of `yield from` ] @keyword.control.return [ diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index ad45d495..3f0df1c0 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -289,6 +289,7 @@ (#match? @constant "^_*[A-Z][A-Z\\d_]*$")) (escape_sequence) @constant.character.escape +(escape_interpolation) @constant.character.escape ; the `{{` and `}}` literals in f-strings [ (true) @@ -306,3 +307,24 @@ (comment) @comment (string) @string + +; ------- +; Type aliases / type variables (after the generic identifier+type rules so they win) +; ------- + +; PEP 695: `type Alias = ...` +(type_alias_statement + left: (type (identifier) @type.definition)) + +; `X = TypeVar("X")` / `X = NewType("X", int)` +((assignment + left: (identifier) @type.definition + right: (call + function: (identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType" "ParamSpec" "TypeVarTuple")) + +; `X: TypeAlias = ...` +((assignment + left: (identifier) @type.definition + type: (type (identifier) @_ann)) + (#eq? @_ann "TypeAlias"))