Skip to content

Commit

Permalink
feat(lang): add xml (helix-editor#4518)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoohey31 authored and pathwave committed Nov 4, 2022
1 parent 60ec723 commit 002a438
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@
| wat || | | |
| wgsl || | | `wgsl_analyzer` |
| xit || | | |
| xml || || |
| yaml || || `yaml-language-server` |
| zig |||| `zls` |
20 changes: 20 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1897,3 +1897,23 @@ injection-regex = "kdl"
[[grammar]]
name = "kdl"
source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" }

[[language]]
name = "xml"
scope = "source.xml"
injection-regex = "xml"
file-types = ["xml"]
indent = { tab-width = 2, unit = " " }
roots = []

[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
"'" = "'"
"<" = ">"

[[grammar]]
name = "xml"
source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" }
42 changes: 42 additions & 0 deletions runtime/queries/xml/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(comment) @comment

[
"DOCTYPE"
"ELEMENT"
"ATTLIST"
] @keyword

[
"#REQUIRED"
"#IMPLIED"
"#FIXED"
"#PCDATA"
] @keyword.directive

[
"EMPTY"
"ANY"
"SYSTEM"
"PUBLIC"
] @constant

(doctype) @variable
(element_name) @variable

"xml" @tag
(tag_name) @tag

[
"encoding"
"version"
"standalone"
] @attribute
(attribute_name) @attribute

(system_literal) @string
(pubid_literal) @string
(attribute_value) @string

[
"<" ">" "</" "/>" "<?" "?>" "<!"
] @punctuation.bracket
1 change: 1 addition & 0 deletions runtime/queries/xml/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(element) @indent
2 changes: 2 additions & 0 deletions runtime/queries/xml/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

0 comments on commit 002a438

Please sign in to comment.