aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-07-22 16:43:33 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-23 09:08:22 +0200
commit1611998ca95816a5eb92e73af076279b22f56225 (patch)
treefb90d51b5dc9658b7ca07925cab7c4fca6eaebe6
parentFix #213: Add parser for dart (diff)
downloadnvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar.gz
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar.bz2
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar.lz
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar.xz
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.tar.zst
nvim-treesitter-1611998ca95816a5eb92e73af076279b22f56225.zip
Dart highlights: Add some basic queries
-rw-r--r--queries/dart/highlights.scm104
1 files changed, 104 insertions, 0 deletions
diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm
new file mode 100644
index 000000000..67663fc83
--- /dev/null
+++ b/queries/dart/highlights.scm
@@ -0,0 +1,104 @@
+(dotted_identifier_list) @string
+
+; Methods
+
+(function_type
+ name: (identifier) @method)
+(super) @function
+
+; Annotations
+; TODO: highlight??
+(annotation
+ name: (identifier) @attribute)
+(marker_annotation
+ name: (identifier) @attribute)
+
+; TODO: operators
+[
+ "@"
+ (additive_operator)
+] @operator
+; TODO: delimiers/punctuation
+
+; Types
+
+(class_definition
+ name: (identifier) @type)
+(constructor_signature
+ name: (identifier) @type)
+(type_identifier
+ (identifier) @type)
+(scoped_identifier
+ scope: (identifier) @type)
+(function_signature
+ name: (identifier) @method)
+(enum_declaration
+ name: (identifier) @type)
+(enum_constant
+ name: (identifier) @type)
+(type_identifier) @type
+(void_type) @type
+
+((scoped_identifier
+ scope: (identifier) @type
+ name: (identifier) @type)
+ (#match? @type "^[a-zA-Z]"))
+
+(type_identifier) @type
+
+; Variables
+
+((identifier) @constant
+ (#match? @constant "^_*[A-Z][A-Z\d_]+"))
+
+(this) @constant.builtin
+
+;; Parameters
+
+(formal_parameter
+ name: (identifier) @parameter)
+
+;; Literals
+
+(hex_integer_literal) @number
+(decimal_integer_literal) @number
+(decimal_floating_point_literal) @float
+
+(string_literal) @string
+(true) @boolean
+(false) @boolean
+(null_literal) @constant.builtin
+
+(comment) @comment
+
+; Keywords
+
+["import" "library" "export"] @include
+
+[
+ "abstract"
+ "assert"
+ "break"
+ "on"
+ "class"
+ "default"
+ "enum"
+ "extends"
+ "final"
+ "implements"
+ "is"
+ "as"
+ "mixin"
+ "external"
+ "new"
+ "return"
+ "static"
+ ] @keyword
+;TODO: var, async, await
+; "rethrow" @keyword
+
+["if" "else" "switch" "case"] @conditional
+
+["try" "throw" "catch" "finally"] @exception
+
+["do" "while" "continue" "for"] @repeat