Skip to content

Commit

Permalink
Add tree-sitter-htmldjango
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire committed Jul 29, 2022
1 parent 14eca31 commit 159d879
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
| hcl || || `terraform-ls` |
| heex ||| | |
| html || | | `vscode-html-language-server` |
| htmldjango |||| |
| idris | | | | `idris2-lsp` |
| iex || | | |
| java || | | `jdtls` |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,18 @@ indent = { tab-width = 2, unit = " " }
name = "html"
source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "d93af487cc75120c89257195e6be46c999c6ba18" }

[[language]]
name = "htmldjango"
scope = "source.htmldjango"
injection-regex = "htmldjango"
file-types = ["html"]
roots = ["manage.py"]
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "htmldjango"
source = { git = "https://github.com/interdependence/tree-sitter-htmldjango", rev = "184a50456186c2ff49b9b410f7060a176e2a3080" }

[[language]]
name = "python"
scope = "source.python"
Expand Down
25 changes: 25 additions & 0 deletions runtime/queries/htmldjango/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
(unpaired_comment)
(paired_comment)
] @comment

[
"{{"
"}}"
"{%"
"%}"
(end_paired_statement)
] @tag

"end" @keyword.return

(variable_name) @variable
(filter_name) @function.macro
(filter_argument) @variable.parameter
(tag_name) @function
(keyword) @keyword
(operator) @operator
(keyword_operator) @keyword.directive
(number) @constant.numeric
(boolean) @constant.builtin.boolean
(string) @string
3 changes: 3 additions & 0 deletions runtime/queries/htmldjango/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(paired_statement) @indent
(end_paired_statement) @indent_end
(branch_statement) @branch
6 changes: 6 additions & 0 deletions runtime/queries/htmldjango/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
((content) @injection.content
(#set! injection.language "html")
(#set! injection.combined))

([(unpaired_comment) (paired_comment)] @injection.content
(#set! injection.language "comment"))
7 changes: 7 additions & 0 deletions runtime/queries/htmldjango/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
"{{"
"}}"
"{%"
"%}"
(end_paired_statement)
] @tag
2 changes: 2 additions & 0 deletions runtime/themes/monokai_pro_spectrum.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@
# operator, tags, units, punctuations
"operator" = "red"
"variable.other.member" = "base8"
"tag" = "yellow"

# keywords, special
"keyword" = { fg = "red" }
"keyword.directive" = "blue"
"keyword.function" = "blue"
"variable.parameter" = "#f59762"

# error
Expand Down

0 comments on commit 159d879

Please sign in to comment.