diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 1544c7683..cc9e0e62d 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -105,6 +105,7 @@ | hoon | ✓ | | | | | hosts | ✓ | | | | | html | ✓ | | | `vscode-html-language-server`, `superhtml` | +| htmldjango | ✓ | | | `djlsp`, `vscode-html-language-server`, `superhtml` | | hurl | ✓ | ✓ | ✓ | | | hyprlang | ✓ | | ✓ | `hyprls` | | idris | | | | `idris2-lsp` | diff --git a/languages.toml b/languages.toml index 9827db8de..5c37a0b7f 100644 --- a/languages.toml +++ b/languages.toml @@ -32,6 +32,7 @@ csharp-ls = { command = "csharp-ls" } cuelsp = { command = "cuelsp" } dart = { command = "dart", args = ["language-server", "--client-id=helix"] } dhall-lsp-server = { command = "dhall-lsp-server" } +djlsp = { command = "djlsp" } docker-langserver = { command = "docker-langserver", args = ["--stdio"] } docker-compose-langserver = { command = "docker-compose-langserver", args = ["--stdio"]} dot-language-server = { command = "dot-language-server", args = ["--stdio"] } @@ -956,6 +957,25 @@ indent = { tab-width = 2, unit = " " } name = "html" source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "cbb91a0ff3621245e890d1c50cc811bffb77a26b" } +[[language]] +name = "htmldjango" +scope = "source.htmldjango" +injection-regex = "htmldjango" +language-servers = ["djlsp", "vscode-html-language-server", "superhtml"] +file-types = [] + +[language.auto-pairs] +'"' = '"' +'(' = ')' +'[' = ']' +'{' = '}' +'%' = '%' +'<' = '>' + +[[grammar]] +name = "htmldjango" +source = { git = "https://github.com/interdependence/tree-sitter-htmldjango", rev = "3a643167ad9afac5d61e092f08ff5b054576fadf" } + [[language]] name = "python" scope = "source.python" diff --git a/runtime/queries/htmldjango/highlights.scm b/runtime/queries/htmldjango/highlights.scm new file mode 100644 index 000000000..c8077f948 --- /dev/null +++ b/runtime/queries/htmldjango/highlights.scm @@ -0,0 +1,26 @@ +[ + (unpaired_comment) + (paired_comment) +] @comment + +[ + "{{" + "}}" + "{%" + "%}" + (end_paired_statement) +] @punctuation.bracket + +[ + (tag_name) +] @function + +(variable_name) @variable +(filter_name) @function +(filter_argument) @variable.parameter +(keyword) @keyword +(operator) @operator +(keyword_operator) @keyword.operator +(number) @constant.numeric +(boolean) @constant.builtin.boolean +(string) @string diff --git a/runtime/queries/htmldjango/injections.scm b/runtime/queries/htmldjango/injections.scm new file mode 100644 index 000000000..f08227342 --- /dev/null +++ b/runtime/queries/htmldjango/injections.scm @@ -0,0 +1,3 @@ +((content) @injection.content + (#set! injection.language "html") + (#set! injection.combined))