summaryrefslogtreecommitdiffstats
path: root/queries
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-11-24 10:25:47 +0100
committerChristian Clason <c.clason@uni-graz.at>2023-11-26 15:24:26 +0100
commit1e74c34b668d0bbdd14492fc220974e4fc38dc6b (patch)
tree849c90e2e8115a58180a29089655058a92d8fe03 /queries
parenttwig queries: add combined injections (#5721) (diff)
downloadnvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar.gz
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar.bz2
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar.lz
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar.xz
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.tar.zst
nvim-treesitter-1e74c34b668d0bbdd14492fc220974e4fc38dc6b.zip
feat: add angular parser and queries
Diffstat (limited to 'queries')
-rw-r--r--queries/angular/highlights.scm67
-rw-r--r--queries/html_tags/injections.scm21
2 files changed, 88 insertions, 0 deletions
diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm
new file mode 100644
index 000000000..98c6f76e9
--- /dev/null
+++ b/queries/angular/highlights.scm
@@ -0,0 +1,67 @@
+(identifier) @variable
+(pipe_sequence "|" @operator)
+(string) @string
+(number) @number
+(pipe_call
+ name: (identifier) @function)
+(pipe_call
+ arguments: (pipe_arguments
+ (identifier) @parameter))
+
+(structural_assignment
+ operator: (identifier) @keyword)
+
+(member_expression
+ property: (identifier) @property)
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: ((identifier) @function.builtin
+ (#eq? @function.builtin "$any")))
+
+[
+"let"
+"as"
+] @keyword
+
+[
+"("
+")"
+"["
+"]"
+"{"
+"}"
+] @punctuation.bracket
+
+[
+";"
+"."
+","
+"?."
+] @punctuation.delimiter
+
+((identifier) @boolean
+ (#vim-match? @boolean "^(true|false)$"))
+((identifier) @variable.builtin
+ (#vim-match? @variable.builtin "^(this|\$event|null)$"))
+
+[
+ "-"
+ "&&"
+ "+"
+ "<"
+ "<="
+ "="
+ "=="
+ "==="
+ "!="
+ "!=="
+ ">"
+ ">="
+ "*"
+ "/"
+ "||"
+ "%"
+] @operator
diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm
index 563e7453d..cef63ad8d 100644
--- a/queries/html_tags/injections.scm
+++ b/queries/html_tags/injections.scm
@@ -74,3 +74,24 @@
(#lua-match? @_name "^on[a-z]+$")
(quoted_attribute_value (attribute_value) @injection.content)
(#set! injection.language "javascript"))
+
+(attribute
+ ((attribute_name) @_name
+ (#lua-match? @_name "[%[%(].*[%)%]]"))
+ (quoted_attribute_value
+ (attribute_value) @injection.content)
+ (#set! injection.language "angular"))
+
+(attribute
+ ((attribute_name) @_name
+ (#lua-match? @_name "^%*"))
+ (quoted_attribute_value
+ ((attribute_value) @injection.content))
+ (#set! injection.language "angular"))
+
+(element
+ ((text) @injection.content
+ (#lua-match? @injection.content "%{%{.*%}%}")
+ (#offset! @injection.content 0 2 0 -2))
+ (#set! injection.language "angular"))
+