diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
| commit | 5a8dbc6347b3541e84fe669b22c17ad3b715e258 (patch) | |
| tree | b148c450939688caaaeb4adac6f2faa1eaffe649 /queries | |
| download | qwe-editor-5a8dbc6347b3541e84fe669b22c17ad3b715e258.tar.gz | |
Engage!
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/bash.scm | 56 | ||||
| -rw-r--r-- | queries/c.scm | 81 | ||||
| -rw-r--r-- | queries/cpp.scm | 74 | ||||
| -rw-r--r-- | queries/css.scm | 76 | ||||
| -rw-r--r-- | queries/dockerfile.scm | 56 | ||||
| -rw-r--r-- | queries/go.scm | 148 | ||||
| -rw-r--r-- | queries/html.scm | 13 | ||||
| -rw-r--r-- | queries/javascript.scm | 36 | ||||
| -rw-r--r-- | queries/lua.scm | 172 | ||||
| -rw-r--r-- | queries/markdown.scm | 47 | ||||
| -rw-r--r-- | queries/php.scm | 136 | ||||
| -rw-r--r-- | queries/python.scm | 137 | ||||
| -rw-r--r-- | queries/sql.scm | 440 | ||||
| -rw-r--r-- | queries/tsx.scm | 76 | ||||
| -rw-r--r-- | queries/typescript.scm | 71 |
15 files changed, 1619 insertions, 0 deletions
diff --git a/queries/bash.scm b/queries/bash.scm new file mode 100644 index 0000000..ad9a404 --- /dev/null +++ b/queries/bash.scm @@ -0,0 +1,56 @@ +[ + (string) + (raw_string) + (heredoc_body) + (heredoc_start) +] @string + +(command_name) @function + +(variable_name) @property + +[ + "case" + "do" + "done" + "elif" + "else" + "esac" + "export" + "fi" + "for" + "function" + "if" + "in" + "select" + "then" + "unset" + "until" + "while" +] @keyword + +(comment) @comment + +(function_definition name: (word) @function) + +(file_descriptor) @number + +[ + (command_substitution) + (process_substitution) + (expansion) +]@embedded + +[ + "$" + "&&" + ">" + ">>" + "<" + "|" +] @operator + +( + (command (_) @constant) + (#match? @constant "^-") +)
\ No newline at end of file diff --git a/queries/c.scm b/queries/c.scm new file mode 100644 index 0000000..c04efe1 --- /dev/null +++ b/queries/c.scm @@ -0,0 +1,81 @@ +(identifier) @variable + +((identifier) @constant + (#match? @constant "^[A-Z][A-Z\\d_]*$")) + +"break" @keyword +"case" @keyword +"const" @keyword +"continue" @keyword +"default" @keyword +"do" @keyword +"else" @keyword +"enum" @keyword +"extern" @keyword +"for" @keyword +"if" @keyword +"inline" @keyword +"return" @keyword +"sizeof" @keyword +"static" @keyword +"struct" @keyword +"switch" @keyword +"typedef" @keyword +"union" @keyword +"volatile" @keyword +"while" @keyword + +"#define" @keyword +"#elif" @keyword +"#else" @keyword +"#endif" @keyword +"#if" @keyword +"#ifdef" @keyword +"#ifndef" @keyword +"#include" @keyword +(preproc_directive) @keyword + +"--" @operator +"-" @operator +"-=" @operator +"->" @operator +"=" @operator +"!=" @operator +"*" @operator +"&" @operator +"&&" @operator +"+" @operator +"++" @operator +"+=" @operator +"<" @operator +"==" @operator +">" @operator +"||" @operator + +"." @delimiter +";" @delimiter + +(string_literal) @string +(system_lib_string) @string + +(null) @constant +(number_literal) @number +(char_literal) @number + +(field_identifier) @property +(statement_identifier) @label +(type_identifier) @type +(primitive_type) @type +(sized_type_specifier) @type + +(call_expression + function: (identifier) @function) +(call_expression + function: (field_expression + field: (field_identifier) @function)) +(function_declarator + declarator: (identifier) @function) +(preproc_function_def + name: (identifier) @function.special) + +(comment) @comment
\ No newline at end of file diff --git a/queries/cpp.scm b/queries/cpp.scm new file mode 100644 index 0000000..fedc40a --- /dev/null +++ b/queries/cpp.scm @@ -0,0 +1,74 @@ +; Inherit C queries +(function_declarator (identifier) @function) +(call_expression (identifier) @function) +(parameter_declaration (primitive_type) @type) +(parameter_declaration (identifier) @variable) +(declaration (primitive_type) @type) +(declaration (identifier) @variable) +(string_literal) @string +(number_literal) @number +(char_literal) @string +(comment) @comment +(field_identifier) @property +((identifier) @boolean (#eq? @boolean "true")) +((identifier) @boolean (#eq? @boolean "false")) +(null) @null +((identifier) @keyword (#match? @keyword "^(static_cast|dynamic_cast|const_cast|reinterpret_cast|friend|inline|decltype|explicit|export|mutable|asm|auto|bool|nullptr)$")) + +; C++ specific +(template_declaration) @type +(virtual) @keyword +(this) @keyword +(class_specifier name: (type_identifier) @type) +(namespace_definition name: (namespace_identifier) @type) +(using_declaration (qualified_identifier) @type) +(destructor_name) @function +(function_declarator (field_identifier) @function) +(function_definition declarator: (function_declarator declarator: (field_identifier) @function)) + +[ + "return" + "if" + "else" + "for" + "while" + "do" + "switch" + "case" + "default" + "break" + "continue" + "struct" + "enum" + "union" + "typedef" + "extern" + "static" + "const" + "signed" + "unsigned" + "volatile" + + ; C++ keywords + "new" + "delete" + "operator" + "throw" + "try" + "catch" + "class" + "constexpr" + "template" + "typename" + "using" + "namespace" + "public" + "private" + "protected" + + "#include" + "#define" + "#ifdef" + "#ifndef" + "#endif" +] @keyword
\ No newline at end of file diff --git a/queries/css.scm b/queries/css.scm new file mode 100644 index 0000000..96ab1c3 --- /dev/null +++ b/queries/css.scm @@ -0,0 +1,76 @@ +(comment) @comment + +(tag_name) @tag +(nesting_selector) @tag +(universal_selector) @tag + +"~" @operator +">" @operator +"+" @operator +"-" @operator +"*" @operator +"/" @operator +"=" @operator +"^=" @operator +"|=" @operator +"~=" @operator +"$=" @operator +"*=" @operator + +"and" @operator +"or" @operator +"not" @operator +"only" @operator + +(attribute_selector (plain_value) @string) + +((property_name) @variable + (#match? @variable "^--")) +((plain_value) @variable + (#match? @variable "^--")) + +(class_name) @property +(id_name) @property +(namespace_name) @property +(property_name) @property +(feature_name) @property + +(pseudo_element_selector (tag_name) @attribute) +(pseudo_class_selector (class_name) @attribute) +(attribute_name) @attribute + +(function_name) @function + +"@media" @keyword +"@import" @keyword +"@charset" @keyword +"@namespace" @keyword +"@supports" @keyword +"@keyframes" @keyword +(at_keyword) @keyword +(to) @keyword +(from) @keyword +(important) @keyword + +(string_value) @string +(color_value) @string.special + +(integer_value) @number +(float_value) @number +(unit) @type + +[ + "#" + "," + "." + ":" + "::" + ";" +] @punctuation.delimiter + +[ + "{" + ")" + "(" + "}" +] @punctuation.bracket
\ No newline at end of file diff --git a/queries/dockerfile.scm b/queries/dockerfile.scm new file mode 100644 index 0000000..7f9dc83 --- /dev/null +++ b/queries/dockerfile.scm @@ -0,0 +1,56 @@ +[ + "FROM" + "AS" + "RUN" + "CMD" + "LABEL" + "EXPOSE" + "ENV" + "ADD" + "COPY" + "ENTRYPOINT" + "VOLUME" + "USER" + "WORKDIR" + "ARG" + "ONBUILD" + "STOPSIGNAL" + "HEALTHCHECK" + "SHELL" + "MAINTAINER" + "CROSS_BUILD" + (heredoc_marker) + (heredoc_end) +] @keyword + +[ + ":" + "@" +] @operator + +(comment) @comment + + +(image_spec + (image_tag + ":" @punctuation.special) + (image_digest + "@" @punctuation.special)) + +[ + (double_quoted_string) + (single_quoted_string) + (json_string) + (heredoc_line) +] @string + +(expansion + [ + "$" + "{" + "}" + ] @punctuation.special +) @none + +((variable) @constant + (#match? @constant "^[A-Z][A-Z_0-9]*$"))
\ No newline at end of file diff --git a/queries/go.scm b/queries/go.scm new file mode 100644 index 0000000..99e1ca1 --- /dev/null +++ b/queries/go.scm @@ -0,0 +1,148 @@ +; Function calls + +(call_expression + function: (identifier) @function) + +(call_expression + function: (identifier) @function.builtin + (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$")) + +(call_expression + function: (selector_expression + field: (field_identifier) @function.method)) + +; Function definitions + +(function_declaration + name: (identifier) @function) + +(method_declaration + name: (field_identifier) @function.method) + +; Identifiers + +(type_identifier) @type +(field_identifier) @property +(identifier) @variable + +; Operators + +[ + "--" + "-" + "-=" + ":=" + "!" + "!=" + "..." + "*" + "*" + "*=" + "/" + "/=" + "&" + "&&" + "&=" + "%" + "%=" + "^" + "^=" + "+" + "++" + "+=" + "<-" + "<" + "<<" + "<<=" + "<=" + "=" + "==" + ">" + ">=" + ">>" + ">>=" + "|" + "|=" + "||" + "~" +] @operator + +; Keywords + +[ + "break" + "case" + "chan" + "const" + "continue" + "default" + "defer" + "else" + "fallthrough" + "for" + "func" + "go" + "goto" + "if" + "import" + "interface" + "map" + "package" + "range" + "return" + "select" + "struct" + "switch" + "type" + "var" +] @keyword + +; Literals + +[ + (interpreted_string_literal) + (raw_string_literal) + (rune_literal) +] @string + +(escape_sequence) @escape + +[ + (int_literal) + (float_literal) + (imaginary_literal) +] @number + +[ + (true) + (false) + (nil) + (iota) +] @constant.builtin + +(comment) @comment + +(call_expression + function: [ + (identifier) @name + (parenthesized_expression (identifier) @name) + (selector_expression field: (field_identifier) @name) + (parenthesized_expression (selector_expression field: (field_identifier) @name)) + ]) @reference.call + +(type_spec + name: (type_identifier) @name) @definition.type + +(type_identifier) @name @reference.type + +(package_clause "package" (package_identifier) @name) + +(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) + +(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) + +(import_declaration (import_spec) @name) + +(var_declaration (var_spec name: (identifier) @name)) + +(const_declaration (const_spec name: (identifier) @name))
\ No newline at end of file diff --git a/queries/html.scm b/queries/html.scm new file mode 100644 index 0000000..ab1399a --- /dev/null +++ b/queries/html.scm @@ -0,0 +1,13 @@ +(tag_name) @tag +(erroneous_end_tag_name) @tag.error +(doctype) @constant +(attribute_name) @attribute +(attribute_value) @string +(comment) @comment + +[ + "<" + ">" + "</" + "/>" +] @punctuation.bracket
\ No newline at end of file diff --git a/queries/javascript.scm b/queries/javascript.scm new file mode 100644 index 0000000..f58999b --- /dev/null +++ b/queries/javascript.scm @@ -0,0 +1,36 @@ +(function_declaration name: (identifier) @function) +(method_definition name: (property_identifier) @function) +(call_expression function: (identifier) @function) +(call_expression function: (member_expression property: (property_identifier) @function)) +(string) @string +(number) @number +(comment) @comment +[ + "function" + "return" + "if" + "else" + "for" + "while" + "do" + "switch" + "case" + "default" + "break" + "continue" + "var" + "let" + "const" + "try" + "catch" + "finally" + "class" + "extends" + "import" + "export" + "default" + "from" + "async" + "await" + "new" +] @keyword diff --git a/queries/lua.scm b/queries/lua.scm new file mode 100644 index 0000000..f5c042c --- /dev/null +++ b/queries/lua.scm @@ -0,0 +1,172 @@ +;;; Highlighting for lua + +;;; Builtins +;; Keywords + +[(if_start) + (if_then) + (if_elseif) + (if_else) + (if_end)] @keyword.conditional + +[(for_start) + (for_in) + (for_do) + (for_end)] @keyword.repeat + +[(while_start) + (while_do) + (while_end)] @keyword.repeat + +[(repeat_start) + (repeat_until)] @keyword.repeat + +(break_statement) @keyword.repeat + +[(return_statement) + (module_return_statement)] @keyword.return + +[(do_start) + (do_end)] @keyword + +; [ +; "goto" +; ] @keyword + +;; Operators + +; TODO: I think I've made a bunch of these nodes. +; we might be able to just use those! + +[ + "not" + "and" + "or"] @keyword.operator + +["=" + "~=" + "==" + "<=" + ">=" + "<" + ">" + "+" + "-" + "%" + "/" + "//" + "*" + "^" + "&" + "~" + "|" + ">>" + "<<" + ".." + "#"] @operator + + + +;; Punctuation +["," "."] @punctuation.delimiter + +;; Brackets +[(left_paren) + (right_paren) + "[" + "]" + "{" + "}"] @punctuation.bracket + +;; Variables +(identifier) @variable +( + (identifier) @variable.builtin + (#match? @variable.builtin "self")) + +; (preproc_call +; directive: (preproc_directive) @_u +; argument: (_) @constant +; (#eq? @_u "#undef")) + +;; Constants +(boolean) @boolean +(nil) @constant.builtin +(ellipsis) @constant ;; "..." +(local) @keyword + +;; Functions +(function_call_paren) @function.bracket + +[ + (function_start) + (function_end)] @keyword.function + +(emmy_type) @type +(emmy_literal) @string +(emmy_parameter + (identifier) @parameter + description: (_)? @comment) @comment + +(emmy_class) @comment +(emmy_field name: (_) @property) @comment +(emmy_function_parameter + name: (_) @parameter) + +(emmy_type_dictionary_value key: (identifier) @property) + +(emmy_note) @comment +(emmy_see) @comment + +; TODO: Make the container so we can still highlight the beginning of the line +; (emmy_eval_container) @comment +; (_emmy_eval_container) @comment + +(emmy_return) @comment + +; TODO: returns + +(emmy_header) @comment +(emmy_ignore) @comment +(documentation_brief) @comment + +(documentation_command) @comment + +(function_call + [ + ((identifier)+ @identifier . (identifier) @function.call . (function_call_paren)) + ((identifier) @function.call.lua . (function_call_paren))]) + +(function_call + prefix: (identifier) @function.call.lua + args: (string_argument) @string) + +(function_call + prefix: (identifier) @function.call.lua + args: (table_argument)) + +; (function [(function_name) (identifier)] @function) +; (function ["function" "end"] @keyword.function) +; (local_function [(function_name) (identifier)] @function) +; (local_function ["function" "end"] @keyword.function) +; (function_definition ["function" "end"] @keyword.function) + +; TODO: Do I have replacements for these. +; (property_identifier) @property +; (method) @method + +; (function_call (identifier) @function . (arguments)) +; (function_call (field (property_identifier) @function) . (arguments)) + +;; Parameters +; (parameters (identifier) @parameter) + +;; Nodes +; (table ["{" "}"] @constructor) +(comment) @comment +(string) @string +(number) @number +; (label_statement) @label + +;; Error +(ERROR) @error
\ No newline at end of file diff --git a/queries/markdown.scm b/queries/markdown.scm new file mode 100644 index 0000000..1326e23 --- /dev/null +++ b/queries/markdown.scm @@ -0,0 +1,47 @@ +;From nvim-treesitter/nvim-treesitter +(atx_heading + (inline) @text.title) + +(setext_heading + (paragraph) @text.title) + +[ + (atx_h1_marker) + (atx_h2_marker) + (atx_h3_marker) + (atx_h4_marker) + (atx_h5_marker) + (atx_h6_marker) + (setext_h1_underline) + (setext_h2_underline) +] @punctuation.special + +[ + (link_title) + (indented_code_block) + (fenced_code_block) +] @text.literal + +(fenced_code_block_delimiter) @punctuation.delimiter + +(code_fence_content) @none + +(link_destination) @text.uri + +(link_label) @text.reference + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) + (thematic_break) +] @punctuation.special + +[ + (block_continuation) + (block_quote_marker) +] @punctuation.special + +(backslash_escape) @string.escape
\ No newline at end of file diff --git a/queries/php.scm b/queries/php.scm new file mode 100644 index 0000000..fc2a5f6 --- /dev/null +++ b/queries/php.scm @@ -0,0 +1,136 @@ +; Keywords + +[ + "and" + "as" + "break" + "case" + "catch" + "class" + "clone" + "const" + "continue" + "declare" + "default" + "do" + "echo" + "else" + "elseif" + "enddeclare" + "endfor" + "endforeach" + "endif" + "endswitch" + "endwhile" + "enum" + "exit" + "extends" + "finally" + "fn" + "for" + "foreach" + "function" + "global" + "goto" + "if" + "implements" + "include" + "include_once" + "instanceof" + "insteadof" + "interface" + "match" + "namespace" + "new" + "or" + "print" + "require" + "require_once" + "return" + "switch" + "throw" + "trait" + "try" + "use" + "while" + "xor" + (abstract_modifier) + (final_modifier) + (readonly_modifier) + (static_modifier) + (visibility_modifier) +] @keyword + +(function_static_declaration "static" @keyword) + +; Namespace + +(namespace_definition + name: (namespace_name + (name) @module)) + +(namespace_name + (name) @module) + +; Variables + +(relative_scope) @variable.builtin + +(variable_name) @variable + +(method_declaration name: (name) @constructor + (#eq? @constructor "__construct")) + +((name) @constant + (#match? @constant "^_?[A-Z][A-Z\\d_]+$")) +((name) @constant.builtin + (#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$")) +(const_declaration (const_element (name) @constant)) + +; Functions + +(array_creation_expression "array" @function.builtin) +(list_literal "list" @function.builtin) +(exit_statement "exit" @function.builtin "(") + +(method_declaration + name: (name) @function.method) + +(scoped_call_expression + name: (name) @function) + +(member_call_expression + name: (name) @function.method) + +(function_definition + name: (name) @function) + +; Member + +(property_element + (variable_name) @property) + +(member_access_expression + name: (variable_name (name)) @property) +(member_access_expression + name: (name) @property) + +; Basic tokens +[ + (string) + (string_content) + (encapsed_string) + (heredoc) + (heredoc_body) + (nowdoc_body) +] @string +(boolean) @constant.builtin +(null) @constant.builtin +(integer) @number +(float) @number +(comment) @comment + +((name) @variable.builtin + (#eq? @variable.builtin "this")) + +"$" @operator
\ No newline at end of file diff --git a/queries/python.scm b/queries/python.scm new file mode 100644 index 0000000..94f28c5 --- /dev/null +++ b/queries/python.scm @@ -0,0 +1,137 @@ +; Identifier naming conventions + +(identifier) @variable + +((identifier) @constructor + (#match? @constructor "^[A-Z]")) + +((identifier) @constant + (#match? @constant "^[A-Z][A-Z_]*$")) + +; Function calls + +(decorator) @function +(decorator + (identifier) @function) + +(call + function: (attribute attribute: (identifier) @function.method)) +(call + function: (identifier) @function) + +; Builtin functions + +((call + function: (identifier) @function.builtin) + (#match? + @function.builtin + "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$")) + +; Function definitions + +(function_definition + name: (identifier) @function) + +(attribute attribute: (identifier) @property) +(type (identifier) @type) + +; Literals + +[ + (none) + (true) + (false) +] @constant.builtin + +[ + (integer) + (float) +] @number + +(comment) @comment +(string) @string +(escape_sequence) @escape + +(interpolation + "{" @punctuation.special + "}" @punctuation.special) @embedded + +[ + "-" + "-=" + "!=" + "*" + "**" + "**=" + "*=" + "/" + "//" + "//=" + "/=" + "&" + "&=" + "%" + "%=" + "^" + "^=" + "+" + "->" + "+=" + "<" + "<<" + "<<=" + "<=" + "<>" + "=" + ":=" + "==" + ">" + ">=" + ">>" + ">>=" + "|" + "|=" + "~" + "@=" + "and" + "in" + "is" + "not" + "or" + "is not" + "not in" +] @operator + +[ + "as" + "assert" + "async" + "await" + "break" + "class" + "continue" + "def" + "del" + "elif" + "else" + "except" + "exec" + "finally" + "for" + "from" + "global" + "if" + "import" + "lambda" + "nonlocal" + "pass" + "print" + "raise" + "return" + "try" + "while" + "with" + "yield" + "match" + "case" +] @keyword
\ No newline at end of file diff --git a/queries/sql.scm b/queries/sql.scm new file mode 100644 index 0000000..d3d6213 --- /dev/null +++ b/queries/sql.scm @@ -0,0 +1,440 @@ +(object_reference + name: (identifier) @type) + +(invocation + (object_reference + name: (identifier) @function.call)) + +[ + (keyword_gist) + (keyword_btree) + (keyword_hash) + (keyword_spgist) + (keyword_gin) + (keyword_brin) + (keyword_array) +] @function.call + +(relation + alias: (identifier) @variable) + +(field + name: (identifier) @field) + +(term + alias: (identifier) @variable) + +((term + value: (cast + name: (keyword_cast) @function.call + parameter: [(literal)]?))) + +(literal) @string +(comment) @comment @spell +(marginalia) @comment + +((literal) @number + (#match? @number "^[-+]?%d+$")) + +((literal) @float + (#match? @float "^[-+]?%d*\.%d*$")) + +(parameter) @parameter + +[ + (keyword_true) + (keyword_false) +] @boolean + +[ + (keyword_asc) + (keyword_desc) + (keyword_terminated) + (keyword_escaped) + (keyword_unsigned) + (keyword_nulls) + (keyword_last) + (keyword_delimited) + (keyword_replication) + (keyword_auto_increment) + (keyword_default) + (keyword_collate) + (keyword_concurrently) + (keyword_engine) + (keyword_always) + (keyword_generated) + (keyword_preceding) + (keyword_following) + (keyword_first) + (keyword_current_timestamp) + (keyword_immutable) + (keyword_atomic) + (keyword_parallel) + (keyword_leakproof) + (keyword_safe) + (keyword_cost) + (keyword_strict) +] @attribute + +[ + (keyword_materialized) + (keyword_recursive) + (keyword_temp) + (keyword_temporary) + (keyword_unlogged) + (keyword_external) + (keyword_parquet) + (keyword_csv) + (keyword_rcfile) + (keyword_textfile) + (keyword_orc) + (keyword_avro) + (keyword_jsonfile) + (keyword_sequencefile) + (keyword_volatile) +] @storageclass + +[ + (keyword_case) + (keyword_when) + (keyword_then) + (keyword_else) +] @conditional + +[ + (keyword_select) + (keyword_from) + (keyword_where) + (keyword_index) + (keyword_join) + (keyword_primary) + (keyword_delete) + (keyword_create) + (keyword_insert) + (keyword_merge) + (keyword_distinct) + (keyword_replace) + (keyword_update) + (keyword_into) + (keyword_overwrite) + (keyword_matched) + (keyword_values) + (keyword_value) + (keyword_attribute) + (keyword_set) + (keyword_left) + (keyword_right) + (keyword_outer) + (keyword_inner) + (keyword_full) + (keyword_order) + (keyword_partition) + (keyword_group) + (keyword_with) + (keyword_without) + (keyword_as) + (keyword_having) + (keyword_limit) + (keyword_offset) + (keyword_table) + (keyword_tables) + (keyword_key) + (keyword_references) + (keyword_foreign) + (keyword_constraint) + (keyword_force) + (keyword_use) + (keyword_for) + (keyword_if) + (keyword_exists) + (keyword_column) + (keyword_columns) + (keyword_cross) + (keyword_lateral) + (keyword_natural) + (keyword_alter) + (keyword_drop) + (keyword_add) + (keyword_view) + (keyword_end) + (keyword_is) + (keyword_using) + (keyword_between) + (keyword_window) + (keyword_no) + (keyword_data) + (keyword_type) + (keyword_rename) + (keyword_to) + (keyword_schema) + (keyword_owner) + (keyword_authorization) + (keyword_all) + (keyword_any) + (keyword_some) + (keyword_returning) + (keyword_begin) + (keyword_commit) + (keyword_rollback) + (keyword_transaction) + (keyword_only) + (keyword_like) + (keyword_similar) + (keyword_over) + (keyword_change) + (keyword_modify) + (keyword_after) + (keyword_before) + (keyword_range) + (keyword_rows) + (keyword_groups) + (keyword_exclude) + (keyword_current) + (keyword_ties) + (keyword_others) + (keyword_zerofill) + (keyword_format) + (keyword_fields) + (keyword_row) + (keyword_sort) + (keyword_compute) + (keyword_comment) + (keyword_location) + (keyword_cached) + (keyword_uncached) + (keyword_lines) + (keyword_stored) + (keyword_virtual) + (keyword_partitioned) + (keyword_analyze) + (keyword_explain) + (keyword_verbose) + (keyword_truncate) + (keyword_rewrite) + (keyword_optimize) + (keyword_vacuum) + (keyword_cache) + (keyword_language) + (keyword_called) + (keyword_conflict) + (keyword_declare) + (keyword_filter) + (keyword_function) + (keyword_input) + (keyword_name) + (keyword_oid) + (keyword_oids) + (keyword_precision) + (keyword_regclass) + (keyword_regnamespace) + (keyword_regproc) + (keyword_regtype) + (keyword_restricted) + (keyword_return) + (keyword_returns) + (keyword_separator) + (keyword_setof) + (keyword_stable) + (keyword_support) + (keyword_tblproperties) + (keyword_trigger) + (keyword_unsafe) + (keyword_admin) + (keyword_connection) + (keyword_cycle) + (keyword_database) + (keyword_encrypted) + (keyword_increment) + (keyword_logged) + (keyword_none) + (keyword_owned) + (keyword_password) + (keyword_reset) + (keyword_role) + (keyword_sequence) + (keyword_start) + (keyword_restart) + (keyword_tablespace) + (keyword_until) + (keyword_user) + (keyword_valid) + (keyword_action) + (keyword_definer) + (keyword_invoker) + (keyword_security) + (keyword_extension) + (keyword_version) + (keyword_out) + (keyword_inout) + (keyword_variadic) + (keyword_session) + (keyword_isolation) + (keyword_level) + (keyword_serializable) + (keyword_repeatable) + (keyword_read) + (keyword_write) + (keyword_committed) + (keyword_uncommitted) + (keyword_deferrable) + (keyword_names) + (keyword_zone) + (keyword_immediate) + (keyword_deferred) + (keyword_constraints) + (keyword_snapshot) + (keyword_characteristics) + (keyword_off) + (keyword_follows) + (keyword_precedes) + (keyword_each) + (keyword_instead) + (keyword_of) + (keyword_initially) + (keyword_old) + (keyword_new) + (keyword_referencing) + (keyword_statement) + (keyword_execute) + (keyword_procedure) + (keyword_copy) + (keyword_delimiter) + (keyword_encoding) + (keyword_escape) + (keyword_force_not_null) + (keyword_force_null) + (keyword_force_quote) + (keyword_freeze) + (keyword_header) + (keyword_match) + (keyword_program) + (keyword_quote) + (keyword_stdin) + (keyword_extended) + (keyword_main) + (keyword_plain) + (keyword_storage) + (keyword_compression) +] @keyword + +[ + (keyword_restrict) + (keyword_unbounded) + (keyword_unique) + (keyword_cascade) + (keyword_delayed) + (keyword_high_priority) + (keyword_low_priority) + (keyword_ignore) + (keyword_nothing) + (keyword_check) + (keyword_option) + (keyword_local) + (keyword_cascaded) + (keyword_wait) + (keyword_nowait) + (keyword_metadata) + (keyword_incremental) + (keyword_bin_pack) + (keyword_noscan) + (keyword_stats) + (keyword_statistics) + (keyword_maxvalue) + (keyword_minvalue) +] @type.qualifier + +[ + (keyword_int) + (keyword_null) + (keyword_boolean) + (keyword_binary) + (keyword_varbinary) + (keyword_image) + (keyword_bit) + (keyword_inet) + (keyword_character) + (keyword_smallserial) + (keyword_serial) + (keyword_bigserial) + (keyword_smallint) + (keyword_mediumint) + (keyword_bigint) + (keyword_tinyint) + (keyword_decimal) + (keyword_float) + (keyword_double) + (keyword_numeric) + (keyword_real) + (double) + (keyword_money) + (keyword_smallmoney) + (keyword_char) + (keyword_nchar) + (keyword_varchar) + (keyword_nvarchar) + (keyword_varying) + (keyword_text) + (keyword_string) + (keyword_uuid) + (keyword_json) + (keyword_jsonb) + (keyword_xml) + (keyword_bytea) + (keyword_enum) + (keyword_date) + (keyword_datetime) + (keyword_time) + (keyword_datetime2) + (keyword_datetimeoffset) + (keyword_smalldatetime) + (keyword_timestamp) + (keyword_timestamptz) + (keyword_geometry) + (keyword_geography) + (keyword_box2d) + (keyword_box3d) + (keyword_interval) +] @type.builtin + +[ + (keyword_in) + (keyword_and) + (keyword_or) + (keyword_not) + (keyword_by) + (keyword_on) + (keyword_do) + (keyword_union) + (keyword_except) + (keyword_intersect) +] @keyword.operator + +[ + "+" + "-" + "*" + "/" + "%" + "^" + ":=" + "=" + "<" + "<=" + "!=" + ">=" + ">" + "<>" + (op_other) + (op_unary_other) +] @operator + +[ + "(" + ")" +] @punctuation.bracket + +[ + ";" + "," + "." +] @punctuation.delimiter
\ No newline at end of file diff --git a/queries/tsx.scm b/queries/tsx.scm new file mode 100644 index 0000000..d5207a0 --- /dev/null +++ b/queries/tsx.scm @@ -0,0 +1,76 @@ +(function_declaration name: (identifier) @function) +(method_definition name: (property_identifier) @function) +(call_expression function: (identifier) @function) +(call_expression function: (member_expression property: (property_identifier) @function)) + +(type_identifier) @type +(predefined_type) @type + +(string) @string +(number) @number +(comment) @comment +(regex) @string +(template_string) @string + +(true) @boolean +(false) @boolean +(null) @null + +(property_signature name: (property_identifier) @property) +(public_field_definition name: (property_identifier) @property) + +[ + "function" + "return" + "if" + "else" + "for" + "while" + "do" + "switch" + "case" + "default" + "break" + "continue" + "var" + "let" + "const" + "try" + "catch" + "finally" + "class" + "extends" + "implements" + "import" + "export" + "from" + "async" + "await" + "new" + "interface" + "type" + "enum" + "public" + "private" + "protected" + "readonly" + "declare" + "module" + "namespace" + "abstract" + "as" + "keyof" + "typeof" + "instanceof" + "void" + "debugger" + "yield" +] @keyword + +(this) @keyword +(super) @keyword + +(jsx_opening_element name: (_) @function) +(jsx_closing_element name: (_) @function) +(jsx_self_closing_element name: (_) @function) +(jsx_attribute (property_identifier) @property) diff --git a/queries/typescript.scm b/queries/typescript.scm new file mode 100644 index 0000000..c8db11e --- /dev/null +++ b/queries/typescript.scm @@ -0,0 +1,71 @@ +(function_declaration name: (identifier) @function) +(method_definition name: (property_identifier) @function) +(call_expression function: (identifier) @function) +(call_expression function: (member_expression property: (property_identifier) @function)) + +(type_identifier) @type +(predefined_type) @type + +(string) @string +(number) @number +(comment) @comment +(regex) @string +(template_string) @string + +(true) @boolean +(false) @boolean +(null) @null + +(property_signature name: (property_identifier) @property) +(public_field_definition name: (property_identifier) @property) + +[ + "function" + "return" + "if" + "else" + "for" + "while" + "do" + "switch" + "case" + "default" + "break" + "continue" + "var" + "let" + "const" + "try" + "catch" + "finally" + "class" + "extends" + "implements" + "import" + "export" + "from" + "async" + "await" + "new" + "interface" + "type" + "enum" + "public" + "private" + "protected" + "readonly" + "declare" + "module" + "namespace" + "abstract" + "as" + "keyof" + "typeof" + "instanceof" + "void" + "debugger" + "yield" +] @keyword + +(this) @keyword +(super) @keyword |
