mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat!: add @keyword.coroutine capture
This commit is contained in:
parent
1bf4be0441
commit
33ba346e60
17 changed files with 137 additions and 78 deletions
|
|
@ -337,8 +337,6 @@
|
|||
"implicit"
|
||||
"explicit"
|
||||
"override"
|
||||
"async"
|
||||
"await"
|
||||
"class"
|
||||
"delegate"
|
||||
"enum"
|
||||
|
|
@ -358,6 +356,11 @@
|
|||
"fixed"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"const"
|
||||
"extern"
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@
|
|||
"deftype"))
|
||||
((sym_lit) @keyword
|
||||
(#eq? @keyword "declare"))
|
||||
((sym_name) @keyword.coroutine
|
||||
(#any-of? @keyword.coroutine
|
||||
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
|
||||
((sym_lit) @keyword.function
|
||||
(#match? @keyword.function "^(defn|defn-|fn|fn[*])$"))
|
||||
|
||||
|
|
@ -148,13 +151,13 @@
|
|||
(#any-of? @function.macro
|
||||
"." ".." "->" "->>" "amap" "areduce" "as->" "assert"
|
||||
"binding" "bound-fn" "delay" "do" "dosync"
|
||||
"doto" "extend-protocol" "extend-type" "future"
|
||||
"doto" "extend-protocol" "extend-type"
|
||||
"gen-class" "gen-interface" "io!" "lazy-cat"
|
||||
"lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter"
|
||||
"monitor-exit" "proxy" "proxy-super" "pvalues"
|
||||
"refer-clojure" "reify" "set!" "some->" "some->>" "sync"
|
||||
"refer-clojure" "reify" "set!" "some->" "some->>"
|
||||
"time" "unquote" "unquote-splicing" "var" "vswap!"
|
||||
"ex-cause" "ex-data" "ex-message"))
|
||||
"ex-cause" "ex-data" "ex-message"))
|
||||
((sym_lit) @function.macro
|
||||
(#match? @function.macro "^with\\-.*$"))
|
||||
|
||||
|
|
@ -175,9 +178,8 @@
|
|||
"any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte"
|
||||
"aset-char" "aset-double" "aset-float" "aset-int"
|
||||
"aset-long" "aset-short" "assoc" "assoc!" "assoc-in"
|
||||
"associative?" "atom" "await" "await-for" "await1"
|
||||
"bases" "bean" "bigdec" "bigint" "biginteger" "bit-and"
|
||||
"bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
|
||||
"associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger"
|
||||
"bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
|
||||
"bit-set" "bit-shift-left" "bit-shift-right" "bit-test"
|
||||
"bit-xor" "boolean" "boolean-array" "boolean?"
|
||||
"booleans" "bound-fn*" "bound?" "bounded-count"
|
||||
|
|
|
|||
|
|
@ -143,11 +143,19 @@
|
|||
"template"
|
||||
"typename"
|
||||
"using"
|
||||
"co_await"
|
||||
"concept"
|
||||
"requires"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"co_await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"co_yield"
|
||||
"co_return"
|
||||
] @keyword.coroutine.return
|
||||
|
||||
[
|
||||
"public"
|
||||
"private"
|
||||
|
|
@ -156,11 +164,6 @@
|
|||
"final"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"co_yield"
|
||||
"co_return"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"new"
|
||||
"delete"
|
||||
|
|
|
|||
|
|
@ -195,14 +195,12 @@
|
|||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
|
||||
|
||||
; Built in identifiers:
|
||||
; alone these are marked as keywords
|
||||
[
|
||||
"await"
|
||||
"deferred"
|
||||
"factory"
|
||||
"get"
|
||||
|
|
@ -216,17 +214,22 @@
|
|||
"typedef"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"async*"
|
||||
"sync*"
|
||||
"await"
|
||||
"yield"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
(const_builtin)
|
||||
(final_builtin)
|
||||
"abstract"
|
||||
"async"
|
||||
"async*"
|
||||
"covariant"
|
||||
"dynamic"
|
||||
"external"
|
||||
"static"
|
||||
"sync*"
|
||||
] @type.qualifier
|
||||
|
||||
; when used as an identifier:
|
||||
|
|
|
|||
|
|
@ -210,15 +210,15 @@
|
|||
;----------
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"import"
|
||||
"from"
|
||||
"import"
|
||||
"from"
|
||||
] @include
|
||||
|
||||
(export_specifier "as" @include)
|
||||
|
|
@ -227,53 +227,56 @@
|
|||
(namespace_import "as" @include)
|
||||
|
||||
[
|
||||
"for"
|
||||
"of"
|
||||
"do"
|
||||
"while"
|
||||
"continue"
|
||||
"for"
|
||||
"of"
|
||||
"do"
|
||||
"while"
|
||||
"continue"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"class"
|
||||
"const"
|
||||
"debugger"
|
||||
"export"
|
||||
"extends"
|
||||
"get"
|
||||
"in"
|
||||
"instanceof"
|
||||
"let"
|
||||
"set"
|
||||
"static"
|
||||
"target"
|
||||
"typeof"
|
||||
"var"
|
||||
"with"
|
||||
"break"
|
||||
"class"
|
||||
"const"
|
||||
"debugger"
|
||||
"export"
|
||||
"extends"
|
||||
"get"
|
||||
"in"
|
||||
"instanceof"
|
||||
"let"
|
||||
"set"
|
||||
"static"
|
||||
"target"
|
||||
"typeof"
|
||||
"var"
|
||||
"with"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"function"
|
||||
"function"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"new"
|
||||
"delete"
|
||||
"new"
|
||||
"delete"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"throw"
|
||||
"try"
|
||||
"catch"
|
||||
"finally"
|
||||
"throw"
|
||||
"try"
|
||||
"catch"
|
||||
"finally"
|
||||
] @exception
|
||||
|
||||
(export_statement
|
||||
|
|
|
|||
|
|
@ -159,12 +159,15 @@
|
|||
"func" @keyword.function
|
||||
|
||||
[
|
||||
"await"
|
||||
"return"
|
||||
] @keyword.return
|
||||
|
||||
(call (identifier) @keyword.return
|
||||
(#eq? @keyword.return "yield"))
|
||||
[
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
(call (identifier) @keyword.coroutine
|
||||
(#eq? @keyword.coroutine "yield"))
|
||||
|
||||
|
||||
;; Builtins
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
"function" @keyword.function
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
"type"
|
||||
"interface"
|
||||
"implements"
|
||||
|
|
@ -31,6 +29,11 @@
|
|||
"insteadof"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"use"
|
||||
"include"
|
||||
|
|
|
|||
|
|
@ -307,7 +307,13 @@
|
|||
; "typeof" ; NOTE: It is reserved for future use
|
||||
] @keyword
|
||||
|
||||
("fun") @keyword.function
|
||||
[
|
||||
"suspend"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"fun"
|
||||
] @keyword.function
|
||||
|
||||
(jump_expression) @keyword.return
|
||||
|
||||
|
|
|
|||
|
|
@ -240,8 +240,6 @@
|
|||
|
||||
[
|
||||
"assert"
|
||||
"async"
|
||||
"await"
|
||||
"class"
|
||||
"exec"
|
||||
"global"
|
||||
|
|
@ -252,6 +250,11 @@
|
|||
"as"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
|
|
|
|||
|
|
@ -169,8 +169,6 @@
|
|||
(use_as_clause "as" @include)
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
"default"
|
||||
"dyn"
|
||||
"enum"
|
||||
|
|
@ -188,6 +186,11 @@
|
|||
"where"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"ref"
|
||||
(mutable_specifier)
|
||||
|
|
|
|||
|
|
@ -228,6 +228,11 @@
|
|||
"as"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
(as)
|
||||
] @keyword
|
||||
|
||||
((special_block_keyword) @keyword.coroutine
|
||||
(#eq? @keyword.coroutine "await"))
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
(function_declaration (simple_identifier) @method)
|
||||
(function_declaration ["init" @constructor])
|
||||
(throws) @keyword
|
||||
"async" @keyword
|
||||
(where_keyword) @keyword
|
||||
(parameter external_name: (simple_identifier) @parameter)
|
||||
(parameter name: (simple_identifier) @parameter)
|
||||
|
|
@ -47,6 +46,11 @@
|
|||
"some"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
(getter_specifier)
|
||||
(setter_specifier)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@
|
|||
"include"
|
||||
"interaction"
|
||||
"namespace"
|
||||
"oneway"
|
||||
"optional"
|
||||
"required"
|
||||
"senum"
|
||||
|
|
@ -96,10 +95,13 @@
|
|||
"union"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"oneway"
|
||||
] @keyword.coroutine
|
||||
|
||||
; Deprecated Keywords
|
||||
|
||||
[
|
||||
"async"
|
||||
"cocoa_prefix"
|
||||
"cpp_namespace"
|
||||
"csharp_namespace"
|
||||
|
|
@ -118,7 +120,12 @@
|
|||
"xsd_optional"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
] @keyword.coroutine
|
||||
|
||||
; Extended Keywords
|
||||
|
||||
[
|
||||
"client"
|
||||
"idempotent"
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@
|
|||
(pcal_algorithm_start)
|
||||
"algorithm"
|
||||
"assert"
|
||||
"await"
|
||||
"begin"
|
||||
"call"
|
||||
"define"
|
||||
|
|
@ -98,6 +97,9 @@
|
|||
"when"
|
||||
"with"
|
||||
] @keyword
|
||||
[
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
(pcal_with ("=") @keyword)
|
||||
(pcal_process ("=") @keyword)
|
||||
[
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@
|
|||
|
||||
[
|
||||
"abstract"
|
||||
"async"
|
||||
"class"
|
||||
"construct"
|
||||
"continue"
|
||||
|
|
@ -114,6 +113,11 @@
|
|||
"with"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"yield"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"const"
|
||||
"dynamic"
|
||||
|
|
@ -183,7 +187,6 @@
|
|||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -95,10 +95,17 @@ field_constant: (IDENTIFIER) @constant
|
|||
"asm"
|
||||
"defer"
|
||||
"errdefer"
|
||||
"nosuspend"
|
||||
"test"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
"suspend"
|
||||
"nosuspend"
|
||||
"resume"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"fn"
|
||||
] @keyword.function
|
||||
|
|
@ -111,10 +118,6 @@ field_constant: (IDENTIFIER) @constant
|
|||
|
||||
[
|
||||
"return"
|
||||
"async"
|
||||
"await"
|
||||
"suspend"
|
||||
"resume"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue