aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErasin2022-07-30 17:34:00 +0000
committerGitHub2022-07-30 17:34:00 +0000
commit919edfb323609e31aa6e1f296d621782858a8533 (patch)
treef3016d2315455abb25d1177318df6062fd20b098
parent5ca98edfb1b961a9b85dbada0e71036534900be6 (diff)
Add Graphviz Dot lang support (#3241)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml14
-rw-r--r--runtime/queries/dot/highlights.scm43
-rw-r--r--runtime/queries/dot/injections.scm2
4 files changed, 60 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 0e150a67..581ccd64 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -13,6 +13,7 @@
| dart | ✓ | | ✓ | `dart` |
| devicetree | ✓ | | ✓ | |
| dockerfile | ✓ | | | `docker-langserver` |
+| dot | ✓ | | | `dot-language-server` |
| edoc | ✓ | | | |
| eex | ✓ | | | |
| ejs | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index 67e607df..7becb020 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1570,3 +1570,17 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "ungrammar"
source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "0113de880a58ea14f2a75802e9b99fcc25003d9c" }
+
+[[language]]
+name = "dot"
+scope = "source.dot"
+injection-regex = "dot"
+file-types = ["dot"]
+roots = []
+comment-token = "//"
+indent = { tab-width = 4, unit = " " }
+language-server = { command = "dot-language-server", args = ["--stdio"] }
+
+[[grammar]]
+name = "dot"
+source = { git = "https://github.com/rydesun/tree-sitter-dot", rev = "917230743aa10f45a408fea2ddb54bbbf5fbe7b7" }
diff --git a/runtime/queries/dot/highlights.scm b/runtime/queries/dot/highlights.scm
new file mode 100644
index 00000000..6ad64d28
--- /dev/null
+++ b/runtime/queries/dot/highlights.scm
@@ -0,0 +1,43 @@
+(keyword) @keyword
+(string_literal) @string
+(number_literal) @constant.numeric
+
+[
+ (edgeop)
+ (operator)
+] @operator
+
+[
+ ","
+ ";"
+] @punctuation.delimiter
+
+[
+ "{"
+ "}"
+ "["
+ "]"
+ "<"
+ ">"
+] @punctuation.bracket
+
+(subgraph
+ id: (id
+ (identifier) @namespace)
+)
+
+(attribute
+ name: (id
+ (identifier) @type)
+ value: (id
+ (identifier) @constant)
+)
+
+[
+ (comment)
+ (preproc)
+] @comment
+
+(ERROR) @error
+
+(identifier) @variable
diff --git a/runtime/queries/dot/injections.scm b/runtime/queries/dot/injections.scm
new file mode 100644
index 00000000..1bfffa1b
--- /dev/null
+++ b/runtime/queries/dot/injections.scm
@@ -0,0 +1,2 @@
+((html_internal) @injection.content
+ (#set! injection.language "html"))