aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/c-sharp/highlights.scm238
-rw-r--r--runtime/queries/java/highlights.scm2
-rw-r--r--runtime/queries/php/highlights.scm2
-rw-r--r--runtime/queries/tsq/highlights.scm46
-rw-r--r--runtime/queries/vue/highlights.scm21
-rw-r--r--runtime/queries/vue/injections.scm17
6 files changed, 324 insertions, 2 deletions
diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm
new file mode 100644
index 00000000..b76f4e60
--- /dev/null
+++ b/runtime/queries/c-sharp/highlights.scm
@@ -0,0 +1,238 @@
+;; Methods
+(method_declaration (identifier) @type (identifier) @function)
+
+;; Types
+(interface_declaration name: (identifier) @type)
+(class_declaration name: (identifier) @type)
+(enum_declaration name: (identifier) @type)
+(struct_declaration (identifier) @type)
+(record_declaration (identifier) @type)
+(namespace_declaration name: (identifier) @type)
+
+(constructor_declaration name: (identifier) @type)
+
+[
+ (implicit_type)
+ (nullable_type)
+ (pointer_type)
+ (function_pointer_type)
+ (predefined_type)
+] @type.builtin
+
+;; Enum
+(enum_member_declaration (identifier) @variable.property)
+
+;; Literals
+[
+ (real_literal)
+ (integer_literal)
+] @number
+
+[
+ (character_literal)
+ (string_literal)
+ (verbatim_string_literal)
+ (interpolated_string_text)
+ (interpolated_verbatim_string_text)
+ "\""
+ "$\""
+ "@$\""
+ "$@\""
+ ] @string
+
+[
+ (boolean_literal)
+ (null_literal)
+ (void_keyword)
+] @constant.builtin
+
+;; Comments
+(comment) @comment
+
+;; Tokens
+[
+ ";"
+ "."
+ ","
+] @punctuation.delimiter
+
+[
+ "--"
+ "-"
+ "-="
+ "&"
+ "&&"
+ "+"
+ "++"
+ "+="
+ "<"
+ "<<"
+ "="
+ "=="
+ "!"
+ "!="
+ "=>"
+ ">"
+ ">>"
+ "|"
+ "||"
+ "?"
+ "??"
+ "^"
+ "~"
+ "*"
+ "/"
+ "%"
+ ":"
+] @operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+;; Keywords
+(modifier) @keyword
+(this_expression) @keyword
+(escape_sequence) @keyword
+
+[
+ "as"
+ "base"
+ "break"
+ "case"
+ "catch"
+ "checked"
+ "class"
+ "continue"
+ "default"
+ "delegate"
+ "do"
+ "else"
+ "enum"
+ "event"
+ "explicit"
+ "finally"
+ "for"
+ "foreach"
+ "goto"
+ "if"
+ "implicit"
+ "interface"
+ "is"
+ "lock"
+ "namespace"
+ "operator"
+ "params"
+ "return"
+ "sizeof"
+ "stackalloc"
+ "struct"
+ "switch"
+ "throw"
+ "try"
+ "typeof"
+ "unchecked"
+ "using"
+ "while"
+ "new"
+ "await"
+ "in"
+ "yield"
+ "get"
+ "set"
+ "when"
+ "out"
+ "ref"
+ "from"
+ "where"
+ "select"
+ "record"
+ "init"
+ "with"
+ "let"
+] @keyword
+
+
+;; Linq
+(from_clause (identifier) @variable)
+(group_clause)
+(order_by_clause)
+(select_clause (identifier) @variable)
+(query_continuation (identifier) @variable) @keyword
+
+;; Record
+(with_expression
+ (with_initializer_expression
+ (simple_assignment_expression
+ (identifier) @variable)))
+
+;; Exprs
+(binary_expression (identifier) @variable (identifier) @variable)
+(binary_expression (identifier)* @variable)
+(conditional_expression (identifier) @variable)
+(prefix_unary_expression (identifier) @variable)
+(postfix_unary_expression (identifier)* @variable)
+(assignment_expression (identifier) @variable)
+(cast_expression (identifier) @type (identifier) @variable)
+
+;; Class
+(base_list (identifier) @type)
+(property_declaration (generic_name))
+(property_declaration
+ type: (nullable_type) @type
+ name: (identifier) @variable)
+(property_declaration
+ type: (predefined_type) @type
+ name: (identifier) @variable)
+(property_declaration
+ type: (identifier) @type
+ name: (identifier) @variable)
+
+;; Lambda
+(lambda_expression) @variable
+
+;; Attribute
+(attribute) @type
+
+;; Parameter
+(parameter
+ type: (identifier) @type
+ name: (identifier) @variable.parameter)
+(parameter (identifier) @variable.parameter)
+(parameter_modifier) @keyword
+
+;; Typeof
+(type_of_expression (identifier) @type)
+
+;; Variable
+(variable_declaration (identifier) @type)
+(variable_declarator (identifier) @variable)
+
+;; Return
+(return_statement (identifier) @variable)
+(yield_statement (identifier) @variable)
+
+;; Type
+(generic_name (identifier) @type)
+(type_parameter (identifier) @variable.parameter)
+(type_argument_list (identifier) @type)
+
+;; Type constraints
+(type_parameter_constraints_clause (identifier) @variable.parameter)
+(type_constraint (identifier) @type)
+
+;; Exception
+(catch_declaration (identifier) @type (identifier) @variable)
+(catch_declaration (identifier) @type)
+
+;; Switch
+(switch_statement (identifier) @variable)
+(switch_expression (identifier) @variable)
+
+;; Lock statement
+(lock_statement (identifier) @variable)
diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm
index 3f8ae0d5..e7d793df 100644
--- a/runtime/queries/java/highlights.scm
+++ b/runtime/queries/java/highlights.scm
@@ -47,7 +47,7 @@
; Variables
((identifier) @constant
- (#match? @constant "^_*[A-Z][A-Z\d_]+"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
(identifier) @variable
diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm
index 83850403..02904555 100644
--- a/runtime/queries/php/highlights.scm
+++ b/runtime/queries/php/highlights.scm
@@ -42,7 +42,7 @@
(relative_scope) @variable.builtin
((name) @constant
- (#match? @constant "^_?[A-Z][A-Z\d_]+$"))
+ (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
((name) @constructor
(#match? @constructor "^[A-Z]"))
diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm
new file mode 100644
index 00000000..9ba5699a
--- /dev/null
+++ b/runtime/queries/tsq/highlights.scm
@@ -0,0 +1,46 @@
+; mark the string passed #match? as a regex
+(((predicate_name) @function
+ (capture)
+ (string) @string.regexp)
+ (#eq? @function "#match?"))
+
+; highlight inheritance comments
+((query . (comment) @keyword.directive)
+ (#match? @keyword.directive "^;\ +inherits *:"))
+
+[
+ "("
+ ")"
+ "["
+ "]"
+] @punctuation.bracket
+
+":" @punctuation.delimiter
+
+[
+ (one_or_more)
+ (zero_or_one)
+ (zero_or_more)
+] @operator
+
+[
+ (wildcard_node)
+ (anchor)
+] @constant.builtin
+
+[
+ (anonymous_leaf)
+ (string)
+] @string
+
+(comment) @comment
+
+(field_name) @property
+
+(capture) @label
+
+(predicate_name) @function
+
+(escape_sequence) @escape
+
+(node_name) @variable
diff --git a/runtime/queries/vue/highlights.scm b/runtime/queries/vue/highlights.scm
new file mode 100644
index 00000000..f90ae429
--- /dev/null
+++ b/runtime/queries/vue/highlights.scm
@@ -0,0 +1,21 @@
+(tag_name) @tag
+(end_tag) @tag
+
+(directive_name) @keyword
+(directive_argument) @constant
+
+(attribute
+ (attribute_name) @attribute
+ (quoted_attribute_value
+ (attribute_value) @string)
+)
+
+(comment) @comment
+
+[
+ "<"
+ ">"
+ "</"
+ "{{"
+ "}}"
+] @punctuation.bracket \ No newline at end of file
diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm
new file mode 100644
index 00000000..8ee34ffb
--- /dev/null
+++ b/runtime/queries/vue/injections.scm
@@ -0,0 +1,17 @@
+(directive_attribute
+ (directive_name) @keyword
+ (quoted_attribute_value
+ (attribute_value) @injection.content)
+ (#set! injection.language "javascript"))
+
+((interpolation
+ (raw_text) @injection.content)
+ (#set! injection.language "javascript"))
+
+((script_element
+ (raw_text) @injection.content)
+ (#set! injection.language "javascript"))
+
+((style_element
+ (raw_text) @injection.content)
+ (#set! injection.language "css"))