From aef00a3ab640417f06dc9f59938283ffde5c451e Mon Sep 17 00:00:00 2001
From: Alexander Brevig <alexanderbrevig@gmail.com>
Date: Sat, 20 Aug 2022 02:16:54 +0200
Subject: [PATCH] feat: add taskwarrior to languages so `task N edit` is nice
 (#3468)

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---
 book/src/generated/lang-support.md  |  1 +
 languages.toml                      | 13 +++++++++++++
 runtime/queries/task/highlights.scm |  4 ++++
 runtime/queries/task/injections.scm |  2 ++
 4 files changed, 20 insertions(+)
 create mode 100644 runtime/queries/task/highlights.scm
 create mode 100644 runtime/queries/task/injections.scm

diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 941b7a7a..e9ef56cf 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -99,6 +99,7 @@
 | svelte | ✓ |  | ✓ | `svelteserver` |
 | swift | ✓ |  |  | `sourcekit-lsp` |
 | tablegen | ✓ | ✓ | ✓ |  |
+| task | ✓ |  |  |  |
 | tfvars |  |  |  | `terraform-ls` |
 | toml | ✓ |  |  | `taplo` |
 | tsq | ✓ |  |  |  |
diff --git a/languages.toml b/languages.toml
index 056fb9fa..eb4cc5d8 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1640,3 +1640,16 @@ language-server = { command = "slint-lsp", args = [] }
 [[grammar]]
 name = "slint"
 source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "0d4dda94f96623302dfc234e06be62a5717f47da" }
+
+[[language]]
+name = "task"
+scope = "source.task"
+injection-regex = "task"
+file-types = ["task"]
+roots = []
+comment-token = "#"
+indent = { tab-width = 2, unit = "  " }
+
+[[grammar]]
+name = "task"
+source = { git = "https://github.com/alexanderbrevig/tree-sitter-task", rev = "f2cb435c5dbf3ee19493e224485d977cb2d36d8b" }
diff --git a/runtime/queries/task/highlights.scm b/runtime/queries/task/highlights.scm
new file mode 100644
index 00000000..90441307
--- /dev/null
+++ b/runtime/queries/task/highlights.scm
@@ -0,0 +1,4 @@
+(comment) @comment
+(datetime) @type
+(identifier) @variable
+(keyword) @keyword
diff --git a/runtime/queries/task/injections.scm b/runtime/queries/task/injections.scm
new file mode 100644
index 00000000..321c90ad
--- /dev/null
+++ b/runtime/queries/task/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))