aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/htmldjango
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/htmldjango
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/htmldjango')
-rw-r--r--runtime/queries/htmldjango/folds.scm4
-rw-r--r--runtime/queries/htmldjango/highlights.scm73
-rw-r--r--runtime/queries/htmldjango/indents.scm5
-rw-r--r--runtime/queries/htmldjango/injections.scm9
4 files changed, 91 insertions, 0 deletions
diff --git a/runtime/queries/htmldjango/folds.scm b/runtime/queries/htmldjango/folds.scm
new file mode 100644
index 000000000..5e8f17c78
--- /dev/null
+++ b/runtime/queries/htmldjango/folds.scm
@@ -0,0 +1,4 @@
+[
+ (paired_statement)
+ (paired_comment)
+] @fold
diff --git a/runtime/queries/htmldjango/highlights.scm b/runtime/queries/htmldjango/highlights.scm
new file mode 100644
index 000000000..3992b826d
--- /dev/null
+++ b/runtime/queries/htmldjango/highlights.scm
@@ -0,0 +1,73 @@
+; adapted from https://github.com/interdependence/tree-sitter-htmldjango
+[
+ (unpaired_comment)
+ (paired_comment)
+] @comment @spell
+
+[
+ "{{"
+ "}}"
+ "{%"
+ "%}"
+ (end_paired_statement)
+] @punctuation.special
+
+(tag_name) @function
+
+((tag_name) @keyword.conditional
+ (#any-of? @keyword.conditional "if" "elif" "else" "endif"))
+
+((tag_name) @keyword.repeat
+ (#any-of? @keyword.repeat "for" "endfor"))
+
+(variable_name) @variable
+
+(unpaired_statement
+ (tag_name)
+ (variable
+ (variable_name) @variable.parameter)
+ .
+ "="
+ .
+ (_))
+
+(filter_name) @function.method
+
+(filter_argument) @variable.parameter
+
+(keyword) @keyword
+
+[
+ "|"
+ "="
+ (operator)
+] @operator
+
+(keyword_operator) @keyword.operator
+
+(string) @string
+
+(filter
+ [
+ "'"
+ "\""
+ ]
+ .
+ (filter_argument) @string)
+
+(number) @number
+
+((filter
+ (filter_argument) @number)
+ (#lua-match? @number "^%d+$"))
+
+(boolean) @boolean
+
+((filter
+ (filter_argument) @boolean)
+ (#any-of? @boolean "True" "False"))
+
+[
+ ":"
+ ","
+] @punctuation.delimiter
diff --git a/runtime/queries/htmldjango/indents.scm b/runtime/queries/htmldjango/indents.scm
new file mode 100644
index 000000000..d671f045d
--- /dev/null
+++ b/runtime/queries/htmldjango/indents.scm
@@ -0,0 +1,5 @@
+(paired_statement) @indent.begin
+
+(end_paired_statement) @indent.end
+
+(branch_statement) @indent.branch
diff --git a/runtime/queries/htmldjango/injections.scm b/runtime/queries/htmldjango/injections.scm
new file mode 100644
index 000000000..2d3bdb6cd
--- /dev/null
+++ b/runtime/queries/htmldjango/injections.scm
@@ -0,0 +1,9 @@
+([
+ (paired_comment)
+ (unpaired_comment)
+] @injection.content
+ (#set! injection.language "comment"))
+
+((content) @injection.content
+ (#set! injection.language "html")
+ (#set! injection.combined))