diff options
author | Matthew Toohey | 2022-10-29 20:41:28 +0000 |
---|---|---|
committer | GitHub | 2022-10-29 20:41:28 +0000 |
commit | f054a3f3ed445cdfa8c0dc63698659ef30af57b7 (patch) | |
tree | d4dd25e8d60a6c3b870f72b4b7b271dd4844adca | |
parent | 2935e9da197442620578e07d87cd0607ae4145f1 (diff) |
feat(lang): add xml (#4518)
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
-rw-r--r-- | languages.toml | 20 | ||||
-rw-r--r-- | runtime/queries/xml/highlights.scm | 42 | ||||
-rw-r--r-- | runtime/queries/xml/indents.scm | 1 | ||||
-rw-r--r-- | runtime/queries/xml/injections.scm | 2 |
5 files changed, 66 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ee54114a..545ec635 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -127,5 +127,6 @@ | wat | ✓ | | | | | wgsl | ✓ | | | `wgsl_analyzer` | | xit | ✓ | | | | +| xml | ✓ | | ✓ | | | yaml | ✓ | | ✓ | `yaml-language-server` | | zig | ✓ | ✓ | ✓ | `zls` | diff --git a/languages.toml b/languages.toml index 31a454b0..00e6459d 100644 --- a/languages.toml +++ b/languages.toml @@ -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" } diff --git a/runtime/queries/xml/highlights.scm b/runtime/queries/xml/highlights.scm new file mode 100644 index 00000000..d5940c8a --- /dev/null +++ b/runtime/queries/xml/highlights.scm @@ -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 diff --git a/runtime/queries/xml/indents.scm b/runtime/queries/xml/indents.scm new file mode 100644 index 00000000..d756debb --- /dev/null +++ b/runtime/queries/xml/indents.scm @@ -0,0 +1 @@ +(element) @indent diff --git a/runtime/queries/xml/injections.scm b/runtime/queries/xml/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/xml/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) |