Skip to content

Commit cce39b0

Browse files
Add script to sync xml syntax from vscode repo
1 parent 48f128b commit cce39b0

File tree

3 files changed

+64
-22
lines changed

3 files changed

+64
-22
lines changed

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
"clean": "rimraf dist",
4242
"install-local": "node scripts/install-local.js",
4343
"install-pull-local": "node scripts/install-local.js --pull",
44-
"uninstall-local": "node scripts/uninstall-local.js"
44+
"uninstall-local": "node scripts/uninstall-local.js",
45+
"sync-syntaxes": "node scripts/sync-scenegraph-tmlanguage.js"
4546
},
4647
"dependencies": {
4748
"array-sort": "^1.0.0",
4849
"backoff": "^2.5.0",
49-
"brighterscript": "^0.39.3",
50-
"brighterscript-formatter": "^1.6.0",
50+
"brighterscript": "file:../brighterscript",
51+
"brighterscript-formatter": "file:../brighterscript-formatter",
5152
"debounce": "^1.2.0",
5253
"dotenv": "^6.2.0",
5354
"eol": "^0.9.1",
@@ -70,13 +71,13 @@
7071
"q": "^1.5.1",
7172
"replace-in-file": "^4.1.0",
7273
"replace-last": "^1.2.6",
73-
"roku-debug": "^0.8.3",
74-
"roku-deploy": "^3.4.1",
74+
"roku-debug": "file:../roku-debug",
75+
"roku-deploy": "file:../roku-deploy",
7576
"semver": "^7.1.3",
7677
"serialize-error": "^5.0.0",
7778
"source-map": "^0.7.3",
78-
"vscode-debugadapter": "1.33.0",
79-
"vscode-debugprotocol": "1.33.0",
79+
"vscode-debugadapter": "^1.47.0",
80+
"vscode-debugprotocol": "^1.47.0",
8081
"vscode-languageclient": "^7.0.0",
8182
"vscode-languageserver": "^4.1.3",
8283
"vscode-uri": "^1.0.6"
@@ -101,6 +102,7 @@
101102
"mocha": "^8.3.2",
102103
"mocha-param": "^2.0.0",
103104
"mock-fs": "^4.10.3",
105+
"node-fetch": "^2.6.1",
104106
"nyc": "^15.0.0",
105107
"ovsx": "0.1.0-next.e000fdb",
106108
"rimraf": "^3.0.0",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const fetch = require('node-fetch');
2+
var fsExtra = require('fs-extra');
3+
(async () => {
4+
const json = await (await fetch('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/xml/syntaxes/xml.tmLanguage.json')).json()
5+
json.scopeName = 'scenegraph.xml';
6+
json.name = 'scenegraph';
7+
json.fileTypes = ['xml'];
8+
delete json.information_for_contributors;
9+
delete json.version;
10+
//find the CDATA pattern
11+
var pattern = json.patterns.find(x => x.name === 'string.unquoted.cdata.xml');
12+
pattern.name = 'source.brighterscript.embedded.scenegraph';
13+
pattern.patterns = [{
14+
include: "source.brs"
15+
}];
16+
fsExtra.outputFileSync(`${__dirname}/../syntaxes/scenegraph.tmLanguage.json`, JSON.stringify(json, null, 4));
17+
})().catch(e => console.error(e));

syntaxes/scenegraph.tmLanguage.json

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"scopeName": "scenegraph.xml",
32
"name": "scenegraph",
4-
"fileTypes": [
5-
"xml"
6-
],
3+
"scopeName": "scenegraph.xml",
74
"patterns": [
85
{
96
"begin": "(<\\?)\\s*([-_a-zA-Z0-9]+)",
@@ -191,7 +188,7 @@
191188
"name": "punctuation.definition.string.end.xml"
192189
}
193190
},
194-
"name": "source.brighterscript.embedded.xml",
191+
"name": "source.brighterscript.embedded.scenegraph",
195192
"patterns": [
196193
{
197194
"include": "source.brs"
@@ -341,7 +338,7 @@
341338
"name": "entity.other.attribute-name.localname.xml"
342339
}
343340
},
344-
"match": "(?:^|\\s+)(?:([-\\w.]+)((:)))?([-\\w.:]+)="
341+
"match": "(?:^|\\s+)(?:([-\\w.]+)((:)))?([-\\w.:]+)\\s*="
345342
},
346343
{
347344
"include": "#doublequotedString"
@@ -352,15 +349,41 @@
352349
]
353350
},
354351
"comments": {
355-
"begin": "<[!%]--",
356-
"captures": {
357-
"0": {
358-
"name": "punctuation.definition.comment.xml"
352+
"patterns": [
353+
{
354+
"begin": "<%--",
355+
"captures": {
356+
"0": {
357+
"name": "punctuation.definition.comment.xml"
358+
},
359+
"end": "--%>",
360+
"name": "comment.block.xml"
361+
}
362+
},
363+
{
364+
"begin": "<!--",
365+
"captures": {
366+
"0": {
367+
"name": "punctuation.definition.comment.xml"
368+
}
369+
},
370+
"end": "-->",
371+
"name": "comment.block.xml",
372+
"patterns": [
373+
{
374+
"begin": "--(?!>)",
375+
"captures": {
376+
"0": {
377+
"name": "invalid.illegal.bad-comments-or-CDATA.xml"
378+
}
379+
}
380+
}
381+
]
359382
}
360-
},
361-
"end": "--%?>",
362-
"name": "comment.block.xml"
383+
]
363384
}
364385
},
365-
"version": "https://github.com/atom/language-xml/commit/f461d428fb87040cb8a52d87d0b95151b9d3c0cc"
366-
}
386+
"fileTypes": [
387+
"xml"
388+
]
389+
}

0 commit comments

Comments
 (0)