aboutsummaryrefslogtreecommitdiffstats
path: root/queries/wing
diff options
context:
space:
mode:
authorGlib Shpychka <23005347+gshpychka@users.noreply.github.com>2023-06-29 13:34:46 +0300
committerGitHub <noreply@github.com>2023-06-29 10:34:46 +0000
commitf460cc8ee7cb0e7ff1512b238d07029afca3d958 (patch)
treec976326a42e3099ac0e3624c166cc3e845367758 /queries/wing
parentUpdate parsers: gitcommit, html, kotlin (diff)
downloadnvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar.gz
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar.bz2
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar.lz
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar.xz
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.tar.zst
nvim-treesitter-f460cc8ee7cb0e7ff1512b238d07029afca3d958.zip
feat(wing): add parser (#5021)
Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Diffstat (limited to 'queries/wing')
-rw-r--r--queries/wing/folds.scm18
-rw-r--r--queries/wing/highlights.scm86
-rw-r--r--queries/wing/locals.scm5
3 files changed, 109 insertions, 0 deletions
diff --git a/queries/wing/folds.scm b/queries/wing/folds.scm
new file mode 100644
index 000000000..17fc7b95f
--- /dev/null
+++ b/queries/wing/folds.scm
@@ -0,0 +1,18 @@
+[
+ (class_definition)
+ (class_implementation)
+ (resource_definition)
+ (resource_implementation)
+ (interface_definition)
+ (interface_implementation)
+ (for_in_loop)
+ (while_statement)
+ (if_statement)
+ (if_let_statement)
+ (elif_block)
+ (struct_definition)
+ (enum_definition)
+ (try_catch_statement)
+ (method_definition)
+ (inflight_method_definition)
+] @fold
diff --git a/queries/wing/highlights.scm b/queries/wing/highlights.scm
new file mode 100644
index 000000000..7fdf3a8f3
--- /dev/null
+++ b/queries/wing/highlights.scm
@@ -0,0 +1,86 @@
+(identifier) @variable
+(reference_identifier) @variable
+(member_identifier) @property
+
+; Classes
+
+(custom_type) @type
+(class_field
+ name: (identifier) @field)
+(class_definition
+ name: (identifier) @type)
+(method_definition
+ name: (identifier) @method)
+(inflight_method_definition
+ name: (identifier) @method)
+
+; Functions
+
+(keyword_argument_key) @parameter
+(call
+ caller: (reference
+ (nested_identifier
+ property: (member_identifier) @method.call)))
+(call
+ caller: (reference
+ (reference_identifier) @method.call))
+
+; Primitives
+
+(number) @number
+(duration) @constant
+(string) @string
+(bool) @boolean
+(builtin_type) @type.builtin
+(json_container_type) @type.builtin
+
+; Special
+
+(comment) @comment
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "-"
+ "+"
+ "*"
+ "/"
+ "%"
+ "<"
+ "<="
+ "="
+ "=="
+ "!"
+ "!="
+ ">"
+ ">="
+ "&&"
+ "??"
+ "||"
+] @operator
+
+[
+ ";"
+ "."
+ ","
+] @punctuation.delimiter
+
+[
+ "as"
+ "bring"
+ "class"
+ "else"
+ "for"
+ "if"
+ "in"
+ "init"
+ "let"
+ "new"
+ "return"
+ (inflight_specifier)
+] @keyword
diff --git a/queries/wing/locals.scm b/queries/wing/locals.scm
new file mode 100644
index 000000000..a467939bd
--- /dev/null
+++ b/queries/wing/locals.scm
@@ -0,0 +1,5 @@
+(block) @scope
+(variable_definition_statement
+ name: (identifier) @definition)
+
+; TODO: Missing "@local.reference" usage tuned for each relevant identifier location