Skip to content

Commit 9a17427

Browse files
committed
feat(image mime types): added link rel type support
also: fixed some wrong applied scopes, missing characters from string captures, fixed pipe capture when after type cast in angular directives
1 parent 2d65088 commit 9a17427

29 files changed

Lines changed: 3626 additions & 3401 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This plugin adds syntax highlighting for angular HTML template files in VS Code.
6767
- [Coffeescript](#coffeescript)
6868
- [Dart](#dart)
6969
- [Javascript fallback](#javascript-fallback)
70+
- [Link tags](#link-tags)
7071
- [Theming](#theming)
7172
- [Translate](#translate)
7273
- [Changelog](#changelog)
@@ -279,6 +280,10 @@ And with [colorize support](https://marketplace.visualstudio.com/items?itemName=
279280

280281
<img src="assets/script-tag-javascript-fallback.png" title="Script tags" alt="Script tag" />
281282

283+
# Link tags
284+
285+
<img src="assets/link-tag-icon" title="Link tags" alt="Link tag" />
286+
282287
# Theming
283288

284289
> If you want to create a theme and support this extension, please checkout the [theming docs](docs/THEMING.md)

assets/link-tag-icon.png

28 KB
Loading

docs/THEMING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- [Stylesheet](#stylesheet)
3232
- [Style tags](#style-tags)
3333
- [Script tags](#script-tags)
34+
- [Link tags](#link-tags)
3435

3536
# General
3637

@@ -219,3 +220,10 @@
219220
- `javascript` - html-template.ng.script.language.identifier
220221
- `lang="javascript"`
221222
- `javascript` - html-template.ng.script.language.identifier
223+
224+
# Link tags
225+
226+
<img src="../assets/link-tag-icon" title="Link tags" alt="Link tag" />
227+
228+
- `type="image/x-icon"`
229+
- `x-icon` - html-template.ng.link.myme-type

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@
149149
"default": "",
150150
"markdownDescription": "%ext.settings.html.htmlScriptAttributesLanguageIdentifier%"
151151
},
152+
"vscode-angular-html.htmlLinkAttributesMimeType": {
153+
"type": "string",
154+
"default": "",
155+
"markdownDescription": "%ext.settings.html.htmlLinkAttributesMimeType%"
156+
},
152157
"vscode-angular-html.ariaAttributePrefix": {
153158
"type": "string",
154159
"default": "",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ext.settings.html.htmlAttributeValueSeparator": "Matches HTML attribute-value separator (=).\nThis is a global match.\n\n* &#60;div onpointercancel`=`\"callback()\"&#62;&#60;/div&#62;\n\n* &#60;div class`=`\"test\"&#62;&#60;/div&#62;\n\n```html\n\n<div onpointercancel=\"callback()\"></div>\n<div class=\"test\"></div>\n\n\n```\nLeave it empty to disable for this item only",
1111
"ext.settings.html.htmlStyleAttributesLanguageIdentifier": "Matches HTML Style Type Attribute language identifier.\n\n* &#60;style type=\"text/`css`\"&#62;&#60;/style&#62;\n\n* &#60;style type=\"text/`scss`\"&#62;&#60;/style&#62;\n\n* &#60;style type=\"text/`sass`\"&#62;&#60;/style&#62;\n\n```html\n\n<style type=\"text/css\"></style>\n<style type=\"text/scss\"></style>\n<style type=\"text/sass\"></style>\n<style type=\"text/stylus\"></style>\n<style type=\"text/less\"></style>\n<style type=\"text/postcss\"></style>\n\n\n```\nLeave it empty to disable for this item only",
1212
"ext.settings.html.htmlScriptAttributesLanguageIdentifier": "Matches HTML Script Type Attribute language identifier.\n\n* &#60;script type=\"text/`javascript`\"&#62;&#60;/script&#62;\n\n* &#60;script type=\"text/`typescript`\"&#62;&#60;/script&#62;\n\n* &#60;script type=\"application/`dart`\"&#62;&#60;/script&#62;\n\n```html\n\n<script type=\"text/javascript\"></script>\n<script type=\"text/typescript\"></script>\n<script type=\"text/coffeescript\"></script>\n<script type=\"application/dart\"></script>\n\n\n```\nLeave it empty to disable for this item only",
13+
"ext.settings.html.htmlLinkAttributesMimeType": "Matches HTML link tag type attribute icon MIME type.\n\n* &#60;link rel=\"icon\" type=\"image/`x-icon`\" /&#62;\n\n* &#60;link rel=\"icon\" type=\"image/`svg+xml`\" /&#62;\n\n```html\n\n<link rel=\"icon\" type=\"image/svg+xml\" />\n<link rel=\"icon\" type=\"image/x-icon\" />\n\n\n```\nLeave it empty to disable for this item only",
1314
"ext.settings.html.htmlTags": "Matches HTML known elements.\n\n* &#60;`div`&#62;&#60;/`div`&#62;\n\n* &#60;`span`&#62;&#60;/`span`&#62;\n\n```html\n\n<div></div>\n<span></span>\n\n\n```\nLeave it empty to disable for this item only",
1415
"ext.settings.html.htmlCustomTags": "Matches non-standard HTML elements.\n\n* &#60;`circle`&#62;&#60;/`circle`&#62;\n\n* &#60;`another-custom-element`&#62;&#60;/`another-custom-element`&#62;\n\n```html\n\n<circle></circle>\n<another-custom-element></another-custom-element>\n\n\n```\nLeave it empty to disable for this item only",
1516
"ext.settings.html.ariaAttributePrefix": "Matches aria-attributes aria prefix.\n\n* &#60;div `aria-`label=\"label\"&#62;&#60;/div&#62;\n\n```html\n\n<div aria-label=\"label\"></div>\n\n```\nLeave it empty to disable for this item only",

package.nls.pt-br.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ext.settings.html.htmlAttributeValueSeparator": "Corresponde ao separador de atributo-valor (=) HTML.\nEsta é uma correspondência global.\n\n* &#60;div onpointercancel`=`\"callback()\"&#62;&#60;/div&#62;\n\n* &#60;div class`=`\"test\"&#62;&#60;/div&#62;\n\n```html\n\n<div onpointercancel=\"callback()\"></div>\n<div class=\"test\"></div>\n\n\n```\nDeixe em branco para desativar para este item.",
1111
"ext.settings.html.htmlStyleAttributesLanguageIdentifier": "Corresponde ao identificador de linguagem no atributo type da tag script.\n\n* &#60;style type=\"text/`css`\"&#62;&#60;/style&#62;\n\n* &#60;style type=\"text/`scss`\"&#62;&#60;/style&#62;\n\n* &#60;style type=\"text/`sass`\"&#62;&#60;/style&#62;\n\n```html\n\n<style type=\"text/css\"></style>\n<style type=\"text/scss\"></style>\n<style type=\"text/sass\"></style>\n<style type=\"text/stylus\"></style>\n<style type=\"text/less\"></style>\n<style type=\"text/postcss\"></style>\n\n\n```\nDeixe em branco para desativar para este item.",
1212
"ext.settings.html.htmlScriptAttributesLanguageIdentifier": "Corresponde ao identificador de linguagem no atributo type da tag style.\n\n* &#60;script type=\"text/`javascript`\"&#62;&#60;/script&#62;\n\n* &#60;script type=\"text/`typescript`\"&#62;&#60;/script&#62;\n\n* &#60;script type=\"application/`dart`\"&#62;&#60;/script&#62;\n\n```html\n\n<script type=\"text/javascript\"></script>\n<script type=\"text/typescript\"></script>\n<script type=\"text/coffeescript\"></script>\n<script type=\"application/dart\"></script>\n\n\n```\nDeixe em branco para desativar para este item.",
13+
"ext.settings.html.htmlLinkAttributesMimeType": "Corresponde ao identificador de MIME Type no attributo type da tag link.\n\n* &#60;link rel=\"icon\" type=\"image/`x-icon`\" /&#62;\n\n* &#60;link rel=\"icon\" type=\"image/`svg+xml`\" /&#62;\n\n```html\n\n<link rel=\"icon\" type=\"image/svg+xml\" />\n<link rel=\"icon\" type=\"image/x-icon\" />\n\n\n```\nDeixe em branco para desativar para este item.",
1314
"ext.settings.html.htmlTags": "Corresponde a elementos conhecidos do HTML.\n\n* &#60;`div`&#62;&#60;/`div`&#62;\n\n* &#60;`span`&#62;&#60;/`span`&#62;\n\n```html\n\n<div></div>\n<span></span>\n\n\n```\nDeixe em branco para desativar para este item.",
1415
"ext.settings.html.htmlCustomTags": "Corresponde a elements não conhecidos do HTML.\n\n* &#60;`circle`&#62;&#60;/`circle`&#62;\n\n* &#60;`another-custom-element`&#62;&#60;/`another-custom-element`&#62;\n\n```html\n\n<circle></circle>\n<another-custom-element></another-custom-element>\n\n\n```\nDeixe em branco para desativar para este item.",
1516
"ext.settings.html.ariaAttributePrefix": "Corresponde ao prefixo aria de atributos de acessibilidade.\n\n* &#60;div `aria-`label=\"label\"&#62;&#60;/div&#62;\n\n```html\n\n<div aria-label=\"label\"></div>\n\n```\nDeixe em branco para desativar para este item.",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
textMateRules: [
3+
{
4+
scope: 'html-template.ng.link.myme-type',
5+
configRule: 'vscode-angular-html.htmlLinkAttributesMimeType',
6+
},
7+
],
8+
}

src/grammar/repository/attributes/generic/tag-generic-attribute.json5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
},
3434
},
3535
begin: '(?<!\\S)(?!(?:ref|let|data|aria)?-)(?<!\\*|\\#)(?!(DOMMenuItemActive|DOMMenuItemInactive|DOMMouseScroll|onabort|onafterprint|onafterupdate|onbeforecopy|onbeforecut|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|onbounce|onbroadcast|oncancel|oncanplay|oncanplaythrough|oncellchange|onchange|onclick|onclose|oncommandupdate|oncommand|oncontextmenu|oncopy|oncuechange|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondragdrop|ondragend|ondragenter|ondragexit|ondraggesture|ondragleave|ondragover|ondragstart|ondrag|ondrop|ondurationchange|onemptied|onended|onerrorupdate|onerror|onfilterchange|onfinish|onfocus|onformchange|onforminput|ongotpointercapture|onhelp|oninput|oninvalid|onkeydown|onkeypress|onkeyup|onloadeddata|onloadedmetadata|onloadstart|onload|onlosecapture|onlostpointercapture|onmousedown|onmouseenter|onmouseleave|onmousemove|onmouseout|onmouseover|onmouseup|onmousewheel|onoverflowchanged|onoverflow|onpaste|onpause|onplaying|onplay|onpointercancel|onpointerdown|onpointerenter|onpointerleave|onpointermove|onpointerout|onpointerover|onpointerup|onpopuphidden|onpopuphiding|onpopupshowing|onpopupshown|onprogress|onpropertychange|onratechange|onreadystatechange|onreset|onresize|onrowenter|onrowexit|onrowinserted|onrowsdelete|onscroll|onseeked|onseeking|onselectstart|onselect|onshow|onstalled|onstart|onstop|onsubmit|onsuspend|ontimeupdate|ontoggle|onunderflow|onunload|onvolumechange|onwaiting|style)\\b)\\b(([a-zA-Z0-9\\-_\\$]+)(?:[\\.]([a-zA-Z0-9\\-_\\%]+))?(?:\\.([a-zA-Z0-9\\-_\\%]+))?)(:)?([\\w\\-\\_$]+)?\\b(=)(")',
36-
// begin: '(?<!\\S)(?!(?:ref|let)?-)(?<!\\*|\\#)(?!(DOMMenuItemActive|DOMMenuItemInactive|DOMMouseScroll|onabort|onafterprint|onafterupdate|onbeforecopy|onbeforecut|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onblur|onbounce|onbroadcast|oncancel|oncanplay|oncanplaythrough|oncellchange|onchange|onclick|onclose|oncommandupdate|oncommand|oncontextmenu|oncopy|oncuechange|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondblclick|ondragdrop|ondragend|ondragenter|ondragexit|ondraggesture|ondragleave|ondragover|ondragstart|ondrag|ondrop|ondurationchange|onemptied|onended|onerrorupdate|onerror|onfilterchange|onfinish|onfocus|onformchange|onforminput|ongotpointercapture|onhelp|oninput|oninvalid|onkeydown|onkeypress|onkeyup|onloadeddata|onloadedmetadata|onloadstart|onload|onlosecapture|onlostpointercapture|onmousedown|onmouseenter|onmouseleave|onmousemove|onmouseout|onmouseover|onmouseup|onmousewheel|onoverflowchanged|onoverflow|onpaste|onpause|onplaying|onplay|onpointercancel|onpointerdown|onpointerenter|onpointerleave|onpointermove|onpointerout|onpointerover|onpointerup|onpopuphidden|onpopuphiding|onpopupshowing|onpopupshown|onprogress|onpropertychange|onratechange|onreadystatechange|onreset|onresize|onrowenter|onrowexit|onrowinserted|onrowsdelete|onscroll|onseeked|onseeking|onselectstart|onselect|onshow|onstalled|onstart|onstop|onsubmit|onsuspend|ontimeupdate|ontoggle|onunderflow|onunload|onvolumechange|onwaiting|style)\\b)\\b([\\w\\-\\_$]+)(:)?([\\w\\-\\_$]+)?\\b(=)(")',
3736
end: '(")',
3837
patterns: [
3938
{
4039
begin: '(?<=")',
4140
end: '(?=")',
4241
patterns: [
4342
{
44-
match: '([[:alpha:]0-9\\s\\-_&$@\\#\\%\\^\\;\\+\\*!?()\\[\\]:\\/\\\\\\.\\,-]+)(?![^{]*\\})',
43+
match: '([[:alpha:]0-9\\s\\-_&$@\\#\\%\\^\\;\\+\\*!?()\\[\\]:\\/\\\\\\.\\,-\\=]+|(?<!{)({)(?!{)|(?<!})(})(?!}))',
44+
// match: '([[:alpha:]0-9\\s\\-_&$@\\#\\%\\^\\;\\+\\*!?()\\[\\]:\\/\\\\\\.\\,-\\=]+)(?![^{]*\\})',
4545
name: 'string.quoted.double.html',
4646
},
4747
{
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
repository: {
3+
'link-type-attribute': {
4+
patterns: [
5+
{
6+
match: '[\\s]*(type)(=)(")((image)/((x-)?(icon|png|jpg|jpeg|svg\\+xml|svg|vnd\\.microsoft\\.icon)))(")',
7+
captures: {
8+
'0': {
9+
name: 'meta.attribute.$1.html',
10+
},
11+
'1': {
12+
name: 'entity.other.attribute-name.html html-template.ng.attributes.generic',
13+
},
14+
'2': {
15+
name: 'punctuation.separator.key-value.html punctuation.separator.key-value.html-template.ng',
16+
},
17+
'3': {
18+
name: 'string.quoted.double.html',
19+
},
20+
'4': {
21+
name: 'string.quoted.double.html',
22+
},
23+
'6': {
24+
name: 'html-template.ng.script.language.identifier',
25+
},
26+
'9': {
27+
name: 'html-template.ng.script.language.identifier',
28+
},
29+
'10': {
30+
name: 'string.quoted.double.html',
31+
},
32+
},
33+
},
34+
],
35+
},
36+
},
37+
}

src/grammar/repository/misc/angular/expression/expression-operators.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
name: 'keyword.control.as.ts',
6060
},
6161
},
62-
end: '(?=$|"|[;,:})\\]])',
62+
end: '(?=$|"|[;,:\\|})\\]])',
6363
patterns: [
6464
{
6565
include: '#type',

0 commit comments

Comments
 (0)