aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-06-02 23:41:17 +0000
committerGitHub2022-06-02 23:41:17 +0000
commit42d780b1037f36bd37e2a8dc40b5e9bb95fb5be7 (patch)
treea09f476a2f9dfd77714d1deeb62d4542d215525f
parent4f3d0a77064aac18cc4386df5c43c312c3b03f69 (diff)
add tree-sitter-edoc (#2640)
* add tree-sitter-edoc * fix escape character capture in markdown queries * add field negation operator "!" to tsq highlights
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml14
-rw-r--r--runtime/queries/edoc/highlights.scm50
-rw-r--r--runtime/queries/edoc/injections.scm20
-rw-r--r--runtime/queries/erlang/injections.scm4
-rw-r--r--runtime/queries/markdown/highlights.scm2
-rw-r--r--runtime/queries/tsq/highlights.scm1
7 files changed, 88 insertions, 4 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index c4e60245..3f8bc0a4 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -12,6 +12,7 @@
| dart | ✓ | | ✓ | `dart` |
| devicetree | ✓ | | ✓ | |
| dockerfile | ✓ | | | `docker-langserver` |
+| edoc | ✓ | | | |
| eex | ✓ | | | |
| ejs | ✓ | | | |
| elixir | ✓ | | | `elixir-ls` |
diff --git a/languages.toml b/languages.toml
index 3e679365..b29efc19 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1049,7 +1049,7 @@ language-server = { command = "erlang_ls" }
[[grammar]]
name = "erlang"
-source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "6cd8f956ada445b277de1581b5328ae8e8be9aac" }
+source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "481e7f8ddf27f07a47d1531b6e2b154b89ece31d" }
[[language]]
name = "kotlin"
@@ -1409,3 +1409,15 @@ injection-regex = "verilog"
[[grammar]]
name = "verilog"
source = { git = "https://github.com/andreytkachenko/tree-sitter-verilog", rev = "514d8d70593d29ef3ef667fa6b0e504ae7c977e3" }
+
+[[language]]
+name = "edoc"
+scope = "source.edoc"
+file-types = ["edoc", "edoc.in"]
+injection-regex = "edoc"
+roots = []
+indent = { tab-width = 4, unit = " " }
+
+[[grammar]]
+name = "edoc"
+source = { git = "https://github.com/the-mikedavis/tree-sitter-edoc", rev = "1691ec0aa7ad1ed9fa295590545f27e570d12d60" }
diff --git a/runtime/queries/edoc/highlights.scm b/runtime/queries/edoc/highlights.scm
new file mode 100644
index 00000000..3a309960
--- /dev/null
+++ b/runtime/queries/edoc/highlights.scm
@@ -0,0 +1,50 @@
+((section
+ (section_marker) @markup.heading.marker
+ (section_content) @markup.heading.1
+ (section_marker) @markup.heading.marker)
+ (#eq? @markup.heading.marker "=="))
+
+((section
+ (section_marker) @markup.heading.marker
+ (section_content) @markup.heading.2
+ (section_marker) @markup.heading.marker)
+ (#eq? @markup.heading.marker "==="))
+
+((section
+ (section_marker) @markup.heading.marker
+ (section_content) @markup.heading.3
+ (section_marker) @markup.heading.marker)
+ (#eq? @markup.heading.marker "===="))
+
+(macro (tag) @function.macro)
+(tag) @keyword
+(macro_escape) @constant.character.escape
+(inline_quote) @markup.raw.inline
+(email_address) @markup.link.url
+
+(em_xhtml_tag
+ (open_xhtml_tag) @tag
+ (xhtml_tag_content) @markup.italic
+ (close_xhtml_tag) @tag)
+
+(strong_xhtml_tag
+ (open_xhtml_tag) @tag
+ (xhtml_tag_content) @markup.bold
+ (close_xhtml_tag) @tag)
+
+(module) @namespace
+(function) @function
+(type) @type
+
+; could be @constant.numeric.integer but this looks similar to a capture
+(arity) @operator
+
+[":" "/"] @operator
+["(" ")"] @punctuation.delimiter
+["{" "}"] @function.macro
+
+[
+ (quote_marker)
+ (language_identifier)
+ (quote_content)
+] @markup.raw.block
diff --git a/runtime/queries/edoc/injections.scm b/runtime/queries/edoc/injections.scm
new file mode 100644
index 00000000..9630995b
--- /dev/null
+++ b/runtime/queries/edoc/injections.scm
@@ -0,0 +1,20 @@
+((xhtml_tag) @injection.content
+ (#set! injection.combined)
+ (#set! injection.include-children)
+ (#set! injection.language "html"))
+
+((block_quote
+ !language
+ (quote_content) @injection.content)
+ (#set! injection.language "erlang"))
+
+(block_quote
+ language: (language_identifier) @injection.language
+ (quote_content) @injection.content)
+
+((macro
+ (tag) @_tag
+ (argument) @injection.content)
+ (#eq? @_tag "@type")
+ (#set injection.language "erlang")
+ (#set injection.include-children))
diff --git a/runtime/queries/erlang/injections.scm b/runtime/queries/erlang/injections.scm
index 321c90ad..07858185 100644
--- a/runtime/queries/erlang/injections.scm
+++ b/runtime/queries/erlang/injections.scm
@@ -1,2 +1,2 @@
-((comment) @injection.content
- (#set! injection.language "comment"))
+((comment_content) @injection.content
+ (#set! injection.language "edoc"))
diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm
index 988a56b6..44b19741 100644
--- a/runtime/queries/markdown/highlights.scm
+++ b/runtime/queries/markdown/highlights.scm
@@ -45,5 +45,5 @@
[
(backslash_escape)
(hard_line_break)
-] @string.character.escape
+] @constant.character.escape
diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm
index 549895c1..fd5917fb 100644
--- a/runtime/queries/tsq/highlights.scm
+++ b/runtime/queries/tsq/highlights.scm
@@ -16,6 +16,7 @@
] @punctuation.bracket
":" @punctuation.delimiter
+"!" @operator
[
(one_or_more)