Skip to content

Commit cfc2a22

Browse files
committed
custom 'html' tags are in red color. Fixes microsoft#56467
1 parent 7ff8bda commit cfc2a22

7 files changed

Lines changed: 576 additions & 484 deletions

File tree

extensions/html/package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"vscode": "0.10.x"
99
},
1010
"scripts": {
11-
"update-grammar": "node ../../build/npm/update-grammar.js textmate/html.tmbundle Syntaxes/HTML.plist ./syntaxes/html.tmLanguage.json"
11+
"update-grammar": "node ../../build/npm/update-grammar.js textmate/html.tmbundle Syntaxes/HTML.plist ./syntaxes/html.tmLanguage.json Syntaxes/HTML%20%28Derivative%29.tmLanguage ./syntaxes/html-derivative.tmLanguage.json"
1212
},
1313
"contributes": {
1414
"languages": [
@@ -46,7 +46,6 @@
4646
],
4747
"grammars": [
4848
{
49-
"language": "html",
5049
"scopeName": "text.html.basic",
5150
"path": "./syntaxes/html.tmLanguage.json",
5251
"embeddedLanguages": {
@@ -59,6 +58,21 @@
5958
"tokenTypes": {
6059
"meta.tag string.quoted": "other"
6160
}
61+
},
62+
{
63+
"language": "html",
64+
"scopeName": "text.html.derivative",
65+
"path": "./syntaxes/html-derivative.tmLanguage.json",
66+
"embeddedLanguages": {
67+
"text.html": "html",
68+
"source.css": "css",
69+
"source.js": "javascript",
70+
"source.python": "python",
71+
"source.smarty": "smarty"
72+
},
73+
"tokenTypes": {
74+
"meta.tag string.quoted": "other"
75+
}
6276
}
6377
],
6478
"snippets": [
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"information_for_contributors": [
3+
"This file has been converted from https://github.com/textmate/html.tmbundle/blob/master/Syntaxes/HTML%20%28Derivative%29.tmLanguage",
4+
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
5+
"Once accepted there, we are happy to receive an update request."
6+
],
7+
"version": "https://github.com/textmate/html.tmbundle/commit/390c8870273a2ae80244dae6db6ba064a802f407",
8+
"name": "HTML (Derivative)",
9+
"scopeName": "text.html.derivative",
10+
"injections": {
11+
"R:text.html - (comment.block, text.html meta.embedded, meta.tag.*.*.html, meta.tag.*.*.*.html, meta.tag.*.*.*.*.html)": {
12+
"comment": "Uses R: to ensure this matches after any other injections.",
13+
"patterns": [
14+
{
15+
"match": "<",
16+
"name": "invalid.illegal.bad-angle-bracket.html"
17+
}
18+
]
19+
}
20+
},
21+
"patterns": [
22+
{
23+
"include": "text.html.basic#core-minus-invalid"
24+
},
25+
{
26+
"begin": "(</?)(\\w[^\\s>]*)(?<!/)",
27+
"beginCaptures": {
28+
"1": {
29+
"name": "punctuation.definition.tag.begin.html"
30+
},
31+
"2": {
32+
"name": "entity.name.tag.html"
33+
}
34+
},
35+
"end": "((?: ?/)?>)",
36+
"endCaptures": {
37+
"1": {
38+
"name": "punctuation.definition.tag.end.html"
39+
}
40+
},
41+
"name": "meta.tag.other.unrecognized.html.derivative",
42+
"patterns": [
43+
{
44+
"include": "text.html.basic#attribute"
45+
}
46+
]
47+
}
48+
]
49+
}

extensions/html/syntaxes/html.tmLanguage.json

Lines changed: 74 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/textmate/html.tmbundle/commit/6a6fb2967e2f562a634fca97d18018104d428f1c",
7+
"version": "https://github.com/textmate/html.tmbundle/commit/390c8870273a2ae80244dae6db6ba064a802f407",
88
"name": "HTML",
99
"scopeName": "text.html.basic",
1010
"injections": {
@@ -20,55 +20,13 @@
2020
},
2121
"patterns": [
2222
{
23-
"begin": "(<\\?)(xml)",
24-
"captures": {
25-
"1": {
26-
"name": "punctuation.definition.tag.html"
27-
},
28-
"2": {
29-
"name": "entity.name.tag.html"
30-
}
31-
},
32-
"end": "(\\?>)",
33-
"name": "meta.tag.metadata.processing.xml.html",
34-
"patterns": [
35-
{
36-
"include": "#attribute"
37-
}
38-
]
23+
"include": "#xml-processing"
3924
},
4025
{
4126
"include": "#comment"
4227
},
4328
{
44-
"begin": "<!(?=(?i:DOCTYPE\\s))",
45-
"beginCaptures": {
46-
"0": {
47-
"name": "punctuation.definition.tag.begin.html"
48-
}
49-
},
50-
"end": ">",
51-
"endCaptures": {
52-
"0": {
53-
"name": "punctuation.definition.tag.end.html"
54-
}
55-
},
56-
"name": "meta.tag.metadata.doctype.html",
57-
"patterns": [
58-
{
59-
"match": "\\G(?i:DOCTYPE)",
60-
"name": "entity.name.tag.html"
61-
},
62-
{
63-
"begin": "\"",
64-
"end": "\"",
65-
"name": "string.quoted.double.html"
66-
},
67-
{
68-
"match": "[^\\s>]+",
69-
"name": "entity.other.attribute-name.html"
70-
}
71-
]
29+
"include": "#doctype"
7230
},
7331
{
7432
"include": "#cdata"
@@ -468,6 +426,59 @@
468426
}
469427
]
470428
},
429+
"core-minus-invalid": {
430+
"comment": "This should be the root pattern array includes minus #tags-invalid",
431+
"patterns": [
432+
{
433+
"include": "#xml-processing"
434+
},
435+
{
436+
"include": "#comment"
437+
},
438+
{
439+
"include": "#doctype"
440+
},
441+
{
442+
"include": "#cdata"
443+
},
444+
{
445+
"include": "#tags-valid"
446+
},
447+
{
448+
"include": "#entities"
449+
}
450+
]
451+
},
452+
"doctype": {
453+
"begin": "<!(?=(?i:DOCTYPE\\s))",
454+
"beginCaptures": {
455+
"0": {
456+
"name": "punctuation.definition.tag.begin.html"
457+
}
458+
},
459+
"end": ">",
460+
"endCaptures": {
461+
"0": {
462+
"name": "punctuation.definition.tag.end.html"
463+
}
464+
},
465+
"name": "meta.tag.metadata.doctype.html",
466+
"patterns": [
467+
{
468+
"match": "\\G(?i:DOCTYPE)",
469+
"name": "entity.name.tag.html"
470+
},
471+
{
472+
"begin": "\"",
473+
"end": "\"",
474+
"name": "string.quoted.double.html"
475+
},
476+
{
477+
"match": "[^\\s>]+",
478+
"name": "entity.other.attribute-name.html"
479+
}
480+
]
481+
},
471482
"entities": {
472483
"patterns": [
473484
{
@@ -2559,6 +2570,24 @@
25592570
]
25602571
}
25612572
]
2573+
},
2574+
"xml-processing": {
2575+
"begin": "(<\\?)(xml)",
2576+
"captures": {
2577+
"1": {
2578+
"name": "punctuation.definition.tag.html"
2579+
},
2580+
"2": {
2581+
"name": "entity.name.tag.html"
2582+
}
2583+
},
2584+
"end": "(\\?>)",
2585+
"name": "meta.tag.metadata.processing.xml.html",
2586+
"patterns": [
2587+
{
2588+
"include": "#attribute"
2589+
}
2590+
]
25622591
}
25632592
}
25642593
}

0 commit comments

Comments
 (0)