Skip to content

Commit 8b8fbc6

Browse files
mtoohey31Shekhinah Memmel
authored and
Shekhinah Memmel
committed
feat(lang): add xml (helix-editor#4518)
1 parent d12c74a commit 8b8fbc6

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed

book/src/generated/lang-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,6 @@
127127
| wat || | | |
128128
| wgsl || | | `wgsl_analyzer` |
129129
| xit || | | |
130+
| xml || || |
130131
| yaml || || `yaml-language-server` |
131132
| zig |||| `zls` |

languages.toml

+20
Original file line numberDiff line numberDiff line change
@@ -1897,3 +1897,23 @@ injection-regex = "kdl"
18971897
[[grammar]]
18981898
name = "kdl"
18991899
source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" }
1900+
1901+
[[language]]
1902+
name = "xml"
1903+
scope = "source.xml"
1904+
injection-regex = "xml"
1905+
file-types = ["xml"]
1906+
indent = { tab-width = 2, unit = " " }
1907+
roots = []
1908+
1909+
[language.auto-pairs]
1910+
'(' = ')'
1911+
'{' = '}'
1912+
'[' = ']'
1913+
'"' = '"'
1914+
"'" = "'"
1915+
"<" = ">"
1916+
1917+
[[grammar]]
1918+
name = "xml"
1919+
source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" }

runtime/queries/xml/highlights.scm

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
(comment) @comment
2+
3+
[
4+
"DOCTYPE"
5+
"ELEMENT"
6+
"ATTLIST"
7+
] @keyword
8+
9+
[
10+
"#REQUIRED"
11+
"#IMPLIED"
12+
"#FIXED"
13+
"#PCDATA"
14+
] @keyword.directive
15+
16+
[
17+
"EMPTY"
18+
"ANY"
19+
"SYSTEM"
20+
"PUBLIC"
21+
] @constant
22+
23+
(doctype) @variable
24+
(element_name) @variable
25+
26+
"xml" @tag
27+
(tag_name) @tag
28+
29+
[
30+
"encoding"
31+
"version"
32+
"standalone"
33+
] @attribute
34+
(attribute_name) @attribute
35+
36+
(system_literal) @string
37+
(pubid_literal) @string
38+
(attribute_value) @string
39+
40+
[
41+
"<" ">" "</" "/>" "<?" "?>" "<!"
42+
] @punctuation.bracket

runtime/queries/xml/indents.scm

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(element) @indent

runtime/queries/xml/injections.scm

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
((comment) @injection.content
2+
(#set! injection.language "comment"))

0 commit comments

Comments
 (0)