add XML support

This commit is contained in:
Emmanuel Touzery 2024-09-02 22:07:05 +02:00
parent 31fbd369bb
commit 2f9a5d2577
4 changed files with 185 additions and 0 deletions

View file

@ -172,6 +172,7 @@ In addition, you will need to have either Treesitter or a working LSP client. Yo
- usd
- vim
- vimdoc
- xml
- yaml
Don't see your language here? [Request support for

16
queries/xml/aerial.scm Normal file
View file

@ -0,0 +1,16 @@
(element
(STag (Name) @name
(#set! "kind" "Struct")
)
) @symbol
(element
(EmptyElemTag (Name) @name
(#set! "kind" "Struct")
)
) @symbol
(Attribute (Name) @name
(#set! "kind" "Field")
) @symbol

156
tests/symbols/xml_test.json Normal file
View file

@ -0,0 +1,156 @@
[
{
"children": [
{
"children": [
{
"col": 9,
"end_col": 19,
"end_lnum": 3,
"kind": "Field",
"level": 2,
"lnum": 3,
"name": "id",
"selection_range": {
"col": 9,
"end_col": 11,
"end_lnum": 3,
"lnum": 3
}
},
{
"col": 6,
"end_col": 43,
"end_lnum": 4,
"kind": "Struct",
"level": 2,
"lnum": 4,
"name": "author",
"selection_range": {
"col": 7,
"end_col": 13,
"end_lnum": 4,
"lnum": 4
}
},
{
"col": 6,
"end_col": 42,
"end_lnum": 5,
"kind": "Struct",
"level": 2,
"lnum": 5,
"name": "title",
"selection_range": {
"col": 7,
"end_col": 12,
"end_lnum": 5,
"lnum": 5
}
},
{
"col": 6,
"end_col": 29,
"end_lnum": 6,
"kind": "Struct",
"level": 2,
"lnum": 6,
"name": "genre",
"selection_range": {
"col": 7,
"end_col": 12,
"end_lnum": 6,
"lnum": 6
}
},
{
"col": 6,
"end_col": 26,
"end_lnum": 7,
"kind": "Struct",
"level": 2,
"lnum": 7,
"name": "price",
"selection_range": {
"col": 7,
"end_col": 12,
"end_lnum": 7,
"lnum": 7
}
},
{
"col": 6,
"end_col": 45,
"end_lnum": 8,
"kind": "Struct",
"level": 2,
"lnum": 8,
"name": "publish_date",
"selection_range": {
"col": 7,
"end_col": 19,
"end_lnum": 8,
"lnum": 8
}
},
{
"col": 6,
"end_col": 84,
"end_lnum": 9,
"kind": "Struct",
"level": 2,
"lnum": 9,
"name": "description",
"selection_range": {
"col": 7,
"end_col": 18,
"end_lnum": 9,
"lnum": 9
}
},
{
"col": 6,
"end_col": 21,
"end_lnum": 10,
"kind": "Struct",
"level": 2,
"lnum": 10,
"name": "SelfClosing",
"selection_range": {
"col": 7,
"end_col": 18,
"end_lnum": 10,
"lnum": 10
}
}
],
"col": 3,
"end_col": 10,
"end_lnum": 11,
"kind": "Struct",
"level": 1,
"lnum": 3,
"name": "book",
"selection_range": {
"col": 4,
"end_col": 8,
"end_lnum": 3,
"lnum": 3
}
}
],
"col": 0,
"end_col": 10,
"end_lnum": 12,
"kind": "Struct",
"level": 0,
"lnum": 2,
"name": "catalog",
"selection_range": {
"col": 1,
"end_col": 8,
"end_lnum": 2,
"lnum": 2
}
}
]

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with XML.</description>
<SelfClosing />
</book>
</catalog>