aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/wing
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/wing
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/wing')
-rw-r--r--runtime/queries/wing/folds.scm17
-rw-r--r--runtime/queries/wing/highlights.scm179
-rw-r--r--runtime/queries/wing/injections.scm15
-rw-r--r--runtime/queries/wing/locals.scm6
4 files changed, 217 insertions, 0 deletions
diff --git a/runtime/queries/wing/folds.scm b/runtime/queries/wing/folds.scm
new file mode 100644
index 000000000..0acd8adeb
--- /dev/null
+++ b/runtime/queries/wing/folds.scm
@@ -0,0 +1,17 @@
+[
+ (class_definition)
+ (class_implementation)
+ (interface_definition)
+ (interface_implementation)
+ (for_in_loop)
+ (while_statement)
+ (if_statement)
+ (if_let_statement)
+ (else_if_block)
+ (struct_definition)
+ (enum_definition)
+ (try_catch_statement)
+ (method_definition)
+ (import_statement)+
+ (initializer)
+] @fold
diff --git a/runtime/queries/wing/highlights.scm b/runtime/queries/wing/highlights.scm
new file mode 100644
index 000000000..31e914f07
--- /dev/null
+++ b/runtime/queries/wing/highlights.scm
@@ -0,0 +1,179 @@
+(identifier) @variable
+
+(reference_identifier) @variable
+
+(member_identifier) @variable.member
+
+; Classes
+(custom_type) @type
+
+(class_field
+ name: (identifier) @property)
+
+(struct_field
+ name: (identifier) @property)
+
+(class_definition
+ name: (identifier) @type)
+
+(struct_definition
+ name: (identifier) @type)
+
+(interface_definition
+ name: (identifier) @type)
+
+(method_definition
+ name: (identifier) @function.method)
+
+(json_literal_member
+ (identifier) @property)
+
+; Functions
+(keyword_argument_key) @variable.parameter
+
+(parameter_definition
+ name: (identifier) @variable.parameter)
+
+(variadic) @variable.parameter.builtin
+
+(call
+ caller: (reference
+ (nested_identifier
+ property: (member_identifier) @function.method.call)))
+
+(call
+ caller: (reference
+ (reference_identifier) @function.method.call))
+
+; Primitives
+(number) @number
+
+(duration) @constant
+
+(string) @string
+
+(bool) @boolean
+
+[
+ (builtin_type)
+ "MutSet"
+ "MutMap"
+ "MutArray"
+ "Json"
+ "Set"
+ "Map"
+ "Array"
+ "MutJson"
+] @type.builtin
+
+(json_container_type) @type.builtin
+
+; Special
+(comment) @comment @spell
+
+[
+ "-"
+ "-="
+ "+"
+ "+="
+ "*"
+ "**"
+ "/"
+ "%"
+ "<"
+ "<="
+ "="
+ "=="
+ "!"
+ "!="
+ ">"
+ ">="
+ "&&"
+ "??"
+ "||"
+ "?"
+] @operator
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(mutable_container_type
+ [
+ "<"
+ ">"
+ ] @punctuation.bracket)
+
+(immutable_container_type
+ [
+ "<"
+ ">"
+ ] @punctuation.bracket)
+
+[
+ ";"
+ "."
+ ","
+ ":"
+ "=>"
+] @punctuation.delimiter
+
+[
+ "as"
+ "let"
+ "new"
+ (phase_specifier)
+ "impl"
+ "test"
+] @keyword
+
+"bring" @keyword.import
+
+[
+ "class"
+ "struct"
+ "interface"
+] @keyword.type
+
+[
+ "for"
+ "in"
+] @keyword.repeat
+
+[
+ "if"
+ "else"
+] @keyword.conditional
+
+[
+ "pub"
+ "protected"
+ "internal"
+ "extern"
+ (static)
+] @keyword.modifier
+
+"return" @keyword.return
+
+(import_statement
+ module_name: (identifier) @module)
+
+(import_statement
+ alias: (identifier) @module)
+
+(call
+ (reference
+ (nested_identifier
+ object: (reference) @_ref
+ property: (member_identifier) @_ident))
+ (argument_list
+ (positional_argument
+ (string) @string.regexp))
+ (#eq? @_ref "regex")
+ (#eq? @_ident "compile")
+ (#offset! @string.regexp 0 1 0 -1))
diff --git a/runtime/queries/wing/injections.scm b/runtime/queries/wing/injections.scm
new file mode 100644
index 000000000..bd3fdaec5
--- /dev/null
+++ b/runtime/queries/wing/injections.scm
@@ -0,0 +1,15 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+(call
+ (reference
+ (nested_identifier
+ object: (reference) @_ref
+ property: (member_identifier) @_ident))
+ (argument_list
+ (positional_argument
+ (string) @injection.content))
+ (#eq? @_ref "regex")
+ (#eq? @_ident "compile")
+ (#offset! @injection.content 0 1 0 -1)
+ (#set! injection.language "regex"))
diff --git a/runtime/queries/wing/locals.scm b/runtime/queries/wing/locals.scm
new file mode 100644
index 000000000..9a860c5f2
--- /dev/null
+++ b/runtime/queries/wing/locals.scm
@@ -0,0 +1,6 @@
+(block) @local.scope
+
+(variable_definition_statement
+ name: (identifier) @local.definition)
+
+; TODO: Missing "@local.reference" usage tuned for each relevant identifier location