Skip to content

Commit 8a43c98

Browse files
angelozerrmickaelistria
authored andcommitted
Syntax coloration / language config for DTD, RelaxNG
Signed-off-by: azerr <[email protected]>
1 parent ad41cbc commit 8a43c98

File tree

5 files changed

+209
-2
lines changed

5 files changed

+209
-2
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ This page describes the noteworthy improvements provided by each release of Ecli
77
#### Editing improvements
88
* XML auto closing tag
99
* HTML auto closing tag and auto creation of quotes for HTML attribute assignment
10+
* RelaxNG support : XML validation, completion hover based on RelaxNG schema
11+
* Syntax coloration for DTD
12+
* Syntax coloration / language configuration for RelaxNG compact syntax (.rng)
1013

1114
## 0.15.1
1215

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "DTD",
3+
"scopeName": "text.xml.dtd",
4+
"fileTypes": [
5+
"dtd"
6+
],
7+
"patterns": [
8+
{
9+
"begin": "(<!)(ELEMENT|ATTLIST|ENTITY|NOTATION)",
10+
"captures": {
11+
"1": {
12+
"name": "punctuation.definition.tag.dtd"
13+
},
14+
"2": {
15+
"name": "entity.name.tag.dtd"
16+
}
17+
},
18+
"end": "\\s*(>)",
19+
"name": "meta.tag.type.dtd",
20+
"patterns": [
21+
{
22+
"match": "\\s+(CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITY|ENTITIES|NOTATION|SYSTEM|NDATA)",
23+
"name": "keyword.other.data-type.dtd"
24+
},
25+
{
26+
"match": "(#[A-Z]+)|(ANY)|(EMPTY)",
27+
"name": "constant.language.dtd"
28+
},
29+
{
30+
"begin": "'|\"",
31+
"end": "'|\"",
32+
"name": "string.quoted.double.dtd"
33+
},
34+
{
35+
"begin": "(%[a-zA-Z][a-zA-Z0-9_-])",
36+
"end": ";",
37+
"name": "variable.language.dtd"
38+
}
39+
]
40+
},
41+
{
42+
"begin": "(<!--)",
43+
"end": "(-->)",
44+
"name": "comment.block.dtd"
45+
}
46+
]
47+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"fileTypes": ["rnc"],
3+
"foldingStartMarker": "\\{\\s*$",
4+
"foldingStopMarker": "^\\s*\\}",
5+
"name": "RelaxNG Compact",
6+
"patterns": [
7+
{
8+
"match": "\\bgrammar\\b",
9+
"name": "keyword.other.grammar.rnc"
10+
},
11+
{
12+
"match": "\\bstart\\b",
13+
"name": "keyword.other.start.rnc"
14+
},
15+
{
16+
"match": "\\b(text|empty|xsd\\:(int|integer|double|date(Time)?|time|string|decimal))\\b",
17+
"name": "storage.type.rnc"
18+
},
19+
{
20+
"captures":
21+
{
22+
"1":
23+
{
24+
"name": "keyword.other.attribute.rnc"
25+
},
26+
"2":
27+
{
28+
"name": "entity.other.attribute.rnc"
29+
}
30+
},
31+
"match": "\\b(attribute)\\s+([a-zA-Z][-a-zA-Z_0-9]*)\\s*\\{",
32+
"name": "meta.declaration.attribute.rnc"
33+
},
34+
{
35+
"captures":
36+
{
37+
"1":
38+
{
39+
"name": "keyword.other.element.rnc"
40+
},
41+
"2":
42+
{
43+
"name": "entity.other.element.rnc"
44+
}
45+
},
46+
"match": "\\b(element)\\s+([a-zA-Z][-a-zA-Z_0-9]*)\\s*\\{",
47+
"name": "meta.declaration.element.rnc"
48+
},
49+
{
50+
"match": "#.*$",
51+
"name": "comment.hash.rnc"
52+
},
53+
{
54+
"begin": "\"",
55+
"end": "\"",
56+
"name": "string.quoted.double.rnc",
57+
"patterns": [
58+
{
59+
"match": "\\\\.",
60+
"name": "constant.character.escape.rnc"
61+
}]
62+
},
63+
{
64+
"begin": "'",
65+
"end": "'",
66+
"name": "string.quoted.single.rnc",
67+
"patterns": [
68+
{
69+
"match": "\\\\.",
70+
"name": "constant.character.escape.rnc"
71+
}]
72+
},
73+
{
74+
"captures":
75+
{
76+
"1":
77+
{
78+
"name": "entity.other.grammar_production.rnc"
79+
}
80+
},
81+
"match": "\\b([a-zA-Z][a-zA-Z_0-9]*)\\s*=",
82+
"name": "meta.grammar_production.rnc"
83+
}],
84+
"scopeName": "source.rnc",
85+
"uuid": "85F32571-780F-4AAC-BA70-C2229E0B1BDA"
86+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copy of https://github.com/RussGlover/relaxNgCompactSyntaxHighlighter/blob/master/language-configuration.json
2+
{
3+
"comments": {
4+
"lineComment": "#"
5+
},
6+
// symbols used as brackets
7+
"brackets": [
8+
["{", "}"],
9+
["[", "]"],
10+
["(", ")"]
11+
],
12+
// symbols that are auto closed when typing
13+
"autoClosingPairs": [
14+
["{", "}"],
15+
["[", "]"],
16+
["(", ")"],
17+
["\"", "\""],
18+
["'", "'"]
19+
],
20+
// symbols that that can be used to surround a selection
21+
"surroundingPairs": [
22+
["{", "}"],
23+
["[", "]"],
24+
["(", ")"],
25+
["\"", "\""],
26+
["'", "'"]
27+
]
28+
}

org.eclipse.wildwebdeveloper.xml/plugin.xml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
contentTypeId="org.eclipse.core.runtime.xml"
99
editorId="org.eclipse.ui.genericeditor.GenericEditor">
1010
</editorContentTypeBinding>
11+
<editorContentTypeBinding
12+
contentTypeId="org.eclipse.wildwebdeveloper.rnc"
13+
editorId="org.eclipse.ui.genericeditor.GenericEditor">
14+
</editorContentTypeBinding>
1115
</extension>
1216

1317
<extension
@@ -16,6 +20,10 @@
1620
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
1721
contentType="org.eclipse.core.runtime.xml">
1822
</presentationReconciler>
23+
<presentationReconciler
24+
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
25+
contentType="org.eclipse.wildwebdeveloper.rnc">
26+
</presentationReconciler>
1927
</extension>
2028

2129
<extension
@@ -50,6 +58,21 @@
5058
name="DTD"
5159
priority="normal">
5260
</content-type>
61+
<!-- RelaxNG -->
62+
<content-type
63+
base-type="org.eclipse.core.runtime.xml"
64+
file-extensions="rng"
65+
id="org.eclipse.wildwebdeveloper.rng"
66+
name="RNG"
67+
priority="normal">
68+
</content-type>
69+
<content-type
70+
base-type="org.eclipse.core.runtime.text"
71+
file-extensions="rnc"
72+
id="org.eclipse.wildwebdeveloper.rnc"
73+
name="RNC"
74+
priority="normal">
75+
</content-type>
5376
</extension>
5477

5578
<extension
@@ -78,6 +101,10 @@
78101
contentType="org.eclipse.wildwebdeveloper.dtd"
79102
id="org.eclipse.wildwebdeveloper.xml">
80103
</contentTypeMapping>
104+
<contentTypeMapping
105+
contentType="org.eclipse.wildwebdeveloper.rng"
106+
id="org.eclipse.wildwebdeveloper.xml">
107+
</contentTypeMapping>
81108
</extension>
82109

83110
<extension
@@ -86,6 +113,14 @@
86113
path="grammars/xml/xml.tmLanguage.json"
87114
scopeName="source.xml">
88115
</grammar>
116+
<grammar
117+
path="grammars/dtd/dtd.tmLanguage.json"
118+
scopeName="text.xml.dtd">
119+
</grammar>
120+
<grammar
121+
path="grammars/rnc/rnc.tmLanguage.json"
122+
scopeName="source.rnc">
123+
</grammar>
89124
<scopeNameContentTypeBinding
90125
contentTypeId="org.eclipse.core.runtime.xml"
91126
scopeName="source.xml">
@@ -104,7 +139,11 @@
104139
</scopeNameContentTypeBinding>
105140
<scopeNameContentTypeBinding
106141
contentTypeId="org.eclipse.wildwebdeveloper.dtd"
107-
scopeName="source.xml">
142+
scopeName="text.xml.dtd">
143+
</scopeNameContentTypeBinding>
144+
<scopeNameContentTypeBinding
145+
contentTypeId="org.eclipse.wildwebdeveloper.rnc"
146+
scopeName="source.rnc">
108147
</scopeNameContentTypeBinding>
109148
</extension>
110149

@@ -118,6 +157,10 @@
118157
contentTypeId="org.eclipse.wildwebdeveloper.xsl"
119158
path="language-configurations/xsl/xsl.language-configuration.json">
120159
</languageConfiguration>
160+
<languageConfiguration
161+
contentTypeId="org.eclipse.wildwebdeveloper.rnc"
162+
path="language-configurations/rnc/rnc.language-configuration.json">
163+
</languageConfiguration>
121164
</extension>
122165

123166
<extension
@@ -131,7 +174,7 @@
131174
<extension
132175
point="org.eclipse.ui.genericeditor.icons">
133176
<icon
134-
contentType="org.eclipse.wildwebdeveloper.xml"
177+
contentType="org.eclipse.core.runtime.xml"
135178
icon="icons/xmlEditorIcon.png">
136179
</icon>
137180
</extension>

0 commit comments

Comments
 (0)