Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit b82943f

Browse files
committed
Merge pull request #9969 from adobe/randy/svg
Enable SVG Code Hints
2 parents f24586f + 934f447 commit b82943f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/language/LanguageManager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,12 @@ define(function (require, exports, module) {
10701070
"scriptTypes": [{"matches": /\/x-handlebars|\/x-mustache|^text\/html$/i,
10711071
"mode": null}]
10721072
});
1073-
1073+
1074+
// Define SVG MIME type so an SVG language can be defined for SVG-specific code hints.
1075+
// Currently, SVG uses XML mode so it has generic XML syntax highlighting. This can
1076+
// be removed when SVG gets its own CodeMirror mode with SVG syntax highlighting.
1077+
CodeMirror.defineMIME("image/svg+xml", "xml");
1078+
10741079
// Load the default languages
10751080
_defaultLanguagesJSON = JSON.parse(_defaultLanguagesJSON);
10761081
_ready = Async.doInParallel(Object.keys(_defaultLanguagesJSON), function (key) {

src/language/languages.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@
8686
"xml": {
8787
"name": "XML",
8888
"mode": "xml",
89-
"fileExtensions": ["xml", "svg", "wxs", "wxl", "wsdl", "rss", "atom", "rdf", "xslt", "xsl", "xul", "xbl", "mathml", "config", "plist", "xaml"],
89+
"fileExtensions": ["xml", "wxs", "wxl", "wsdl", "rss", "atom", "rdf", "xslt", "xsl", "xul", "xbl", "mathml", "config", "plist", "xaml"],
90+
"blockComment": ["<!--", "-->"]
91+
},
92+
93+
"svg": {
94+
"name": "SVG",
95+
"mode": ["xml", "image/svg+xml"],
96+
"fileExtensions": ["svg"],
9097
"blockComment": ["<!--", "-->"]
9198
},
9299

0 commit comments

Comments
 (0)