fix highlight
This commit is contained in:
parent
947900f03e
commit
1095c58b33
6 changed files with 65 additions and 1951 deletions
4
Makefile
4
Makefile
|
@ -3,5 +3,9 @@
|
|||
test: build
|
||||
tree-sitter test
|
||||
|
||||
highlight:
|
||||
tree-sitter highlight -t test/highlight/*.d2
|
||||
|
||||
build:
|
||||
tree-sitter generate
|
||||
|
||||
|
|
|
@ -1,7 +1,2 @@
|
|||
a <- b -- b
|
||||
|
||||
foo: Hello world {
|
||||
shape: oval
|
||||
}
|
||||
|
||||
hello world- -- foo
|
||||
a.shape: oval
|
||||
b
|
||||
|
|
1943
package-lock.json
generated
1943
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -4,5 +4,14 @@
|
|||
"description": "",
|
||||
"main": "grammar.js",
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"tree-sitter": [
|
||||
{
|
||||
"scope": "source.d2",
|
||||
"file-types": [
|
||||
"d2"
|
||||
],
|
||||
"injection-regex": "^d2$"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
29
queries/highlights.scm
Normal file
29
queries/highlights.scm
Normal file
|
@ -0,0 +1,29 @@
|
|||
;-------------------------------------------------------------------------------
|
||||
|
||||
(identifier) @variable
|
||||
(attr_key) @keyword
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
(string) @string
|
||||
(label) @string
|
||||
(attr_value) @string
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
(arrow) @operator
|
||||
|
||||
[
|
||||
(dot)
|
||||
":"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
(ERROR) @error
|
20
test/highlight/shape.d2
Normal file
20
test/highlight/shape.d2
Normal file
|
@ -0,0 +1,20 @@
|
|||
foo.baz.biz
|
||||
# <- variable
|
||||
# ^ delimiter
|
||||
# ^ variable
|
||||
# ^ delimiter
|
||||
# ^ variable
|
||||
|
||||
foo: Foo Bar
|
||||
# <- variable
|
||||
# ^ delimiter
|
||||
# ^ string
|
||||
|
||||
foo: Foo Bar {
|
||||
# <- variable
|
||||
# ^ label
|
||||
|
||||
bar.baz
|
||||
# <- variable
|
||||
# ^ variable
|
||||
}
|
Loading…
Reference in a new issue