Skip to content

Commit

Permalink
feat(scope customization): new scope customization (html, custom-elem…
Browse files Browse the repository at this point in the history
…ents, svg, ng operators)

All the elements scopes were meta-named and separated into known and unknown elements, html,
custom-elements, angular and angular material elements, some fixes were made also, and there is only
one more fix to do before only chores missing and documentation to do

BREAKING CHANGE: same as before
  • Loading branch information
ghaschel committed Oct 7, 2022
1 parent 4054765 commit 71d978d
Show file tree
Hide file tree
Showing 162 changed files with 6,046 additions and 3,050 deletions.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@
{
"title": "HTML",
"properties": {
"vscode-angular-html.htmlTags": {
"type": "string",
"default": "",
"markdownDescription": "%ext.settings.html.htmlTags%"
},
"vscode-angular-html.htmlCustomTags": {
"type": "string",
"default": "",
"markdownDescription": "%ext.settings.html.htmlCustomTags%"
},
"vscode-angular-html.htmlDoctypeAttributes": {
"type": "string",
"default": "",
Expand Down Expand Up @@ -144,6 +154,11 @@
"default": "",
"markdownDescription": "%ext.settings.angular.angularExpression%"
},
"vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor": {
"type": "string",
"default": "",
"markdownDescription": "%ext.settings.angular.angularExpressionOperatorsAndNavigatorsColor%"
},
"vscode-angular-html.angularAndAngularMaterialElementTags": {
"type": "string",
"default": "",
Expand Down Expand Up @@ -234,6 +249,11 @@
{
"title": "SVG",
"properties": {
"vscode-angular-html.svgTags": {
"type": "string",
"default": "",
"markdownDescription": "%ext.settings.svg.svgTags%"
},
"vscode-angular-html.svgDAttributePathCommands": {
"type": "string",
"default": "",
Expand Down
4 changes: 4 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"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",
"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",
"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",
"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",
"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",
"ext.settings.angular.angularExpression": "Matches the curly braces preceding and succeeding an angular expression.\nFor both template string interpolation and temlate expressions.\n\n* `{{`condition?.met() ? 'value' : 'otherwise'`}}`\n\n* &#60;div class=\"class `{{`condition?.met() ? 'value' : 'otherwise'`}}`\"&#62;&#60;/div&#62;\n\n```html\n\n<div class=\"class {{condition?.met() ? 'value' : 'otherwise'}}\">\n\t{{condition?.met() ? 'value' : 'otherwise'}}\n</div>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.angular.angularAndAngularMaterialElementTags": "Matches Angular-and-Angular-Material-specific element tags. [See Angular-specific tags](#ADD-LINK)\n\n* &#60;`ng-container`&#62;&#60;/`ng-container`&#62;\n\n* &#60;`mat-action-list`&#62;&#60;/`mat-action-list`&#62;\n\n```html\n\n<ng-container></ng-container>\n<mat-action-list></mat-action-list>\n\n\n```\nLeave it empty to disable for this item onlyLeave it empty to disable for this item only",
"ext.settings.angular.angularAnimationTriggerPrefix": "Matches Angular animation trigger attribute prefix.\n\n* &#60;div `@`animationTrigger&#62;&#60;/div&#62;\n\n```html\n\n<div @animationTrigger></div>\n\n\n```\nLeave it empty to disable for this item only",
Expand All @@ -28,6 +30,8 @@
"ext.settings.angular.angularSyntaxSugarAttributesName": "Matches Angular syntax sugar attribute name.\n\n* &#60;div *`ngFor`=\"let obs of observable | async as test\"&#62;&#60;/div&#62;\n\n```html\n\n<div \n\t*ngFor=\"let obs of observable | async as test\"\n\t *matHeaderCellDef\n>\n</div>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.angular.angularTemplateVariablePrefix": "Matches Angular template variable decorator.\n\n* &#60;div `#`menu=\"parsedMenu\"&#62;&#60;/div&#62;\n\n```html\n\n<div #menu=\"parsedMenu\"></div>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.angular.angularTemplateVariableName": "Matches Angular template variable name.\n\n* &#60;div #`menu`=\"parsedMenu\"&#62;&#60;/div&#62;\n\n```html\n\n<div #menu=\"parsedMenu\"></div>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.angular.angularExpressionOperatorsAndNavigatorsColor": "Matches Angular expressions' operators and navigators.\n\n* {{ if (key`?.`value `||` condition `&&` condition) {} }}\n\n* {{ if (key`.`value `!==` '') {} }}\n\n* {{ if (key`!.`value `===` '') {} }}\n\n```html{{\n\n{{\n\tif (key?.value || condition && condition) {}\n\tif (key.value !== '') {}\n\tif (key!.value === '') {}\n}}\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.svg.svgTags": "Matches known SVG elements.\n\n* &#60;`circle`&#62;&#60;/`circle`&#62;\n\n* &#60;`path`&#62;&#60;/`path`&#62;\n\n```html\n\n<circle></circle>\n<svg>\n\t<circle></circle>\n\t<path></path>\n</svg>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.svg.svgDAttributePathCommands": "Matches SVG d attribute path commands.\n\n* &#60;path d=\"`M`202.35,163.64`l`-4.38-13.1`h`-2.13`v`-3.85`h`9.1`v`3.85`h`-1.82`l`2.05,6.2`l`3.41-10.05\" /&#62;\n\n```html\n\n<svg>\n\t<path d=\"M202.35,163.64l-4.38-13.1h-2.13v-3.85h9.1v3.85h-1.82l2.05,6.2l3.41-10.05\" />\n</svg>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.xml.xmlTagNamespaceDivider": "Matches XML/HTML element namespace colon separator.\n\n* &#60;li`:`title&#62;Book Title&#60;/li`:`title&#62;\n\n```html\n\n<li:title>Book Title</li:title>\n\n\n```\nLeave it empty to disable for this item only",
"ext.settings.xml.xmlTagNamespaceSuffix": "Matches XML/HTML element namespace suffix.\n\n* &#60;li:`title`&#62;Book Title&#60;/li:`title`&#62;\n\n```html\n\n<li:title>Book Title</li:title>\n\n\n```\nLeave it empty to disable for this item only",
Expand Down
4 changes: 4 additions & 0 deletions package.nls.pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"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.",
"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.",
"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.",
"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.",
"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.",
"ext.settings.angular.angularExpression": "Corresponde às chaves precedendo e sucedendo uma expressão do angular.\nTanto para interpolação quanto para expressões de templates.\n\n* `{{`condition?.met() ? 'value' : 'otherwise'`}}`\n\n* &#60;div class=\"class `{{`condition?.met() ? 'value' : 'otherwise'`}}`\"&#62;&#60;/div&#62;\n\n```html\n\n<div class=\"class {{condition?.met() ? 'value' : 'otherwise'}}\">\n\t{{condition?.met() ? 'value' : 'otherwise'}}\n</div>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.angular.angularAndAngularMaterialElementTags": "Corresponde a tags especificas do Angular e do Angular Material. [Ver tags específicas do Angular](#ADD-LINK)\n\n* &#60;`ng-container`&#62;&#60;/`ng-container`&#62;\n\n* &#60;`mat-action-list`&#62;&#60;/`mat-action-list`&#62;\n\n```html\n\n<ng-container></ng-container>\n<mat-action-list></mat-action-list>\n\n\n```\nDeixe em branco para desativar para este item.Deixe em branco para desativar para este item.",
"ext.settings.angular.angularAnimationTriggerPrefix": "Corresponde ao decorador do atributo do tipo gatilho de animação.\n\n* &#60;div `@`animationTrigger&#62;&#60;/div&#62;\n\n```html\n\n<div @animationTrigger></div>\n\n\n```\nDeixe em branco para desativar para este item.",
Expand All @@ -28,6 +30,8 @@
"ext.settings.angular.angularSyntaxSugarAttributesName": "Corresponde ao nome dos atributos do tipo syntax sugar do Angular.\n\n* &#60;div *`ngFor`=\"let obs of observable | async as test\"&#62;&#60;/div&#62;\n\n```html\n\n<div \n\t*ngFor=\"let obs of observable | async as test\"\n\t *matHeaderCellDef\n>\n</div>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.angular.angularTemplateVariablePrefix": "Corresponde ao decorador de variaveis de template do Angular.\n\n* &#60;div `#`menu=\"parsedMenu\"&#62;&#60;/div&#62;\n\n```html\n\n<div #menu=\"parsedMenu\"></div>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.angular.angularTemplateVariableName": "Corresponde ao nome das variaveis de template do Angular.\n\n* &#60;div #`menu`=\"parsedMenu\"&#62;&#60;/div&#62;\n\n```html\n\n<div #menu=\"parsedMenu\"></div>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.angular.angularExpressionOperatorsAndNavigatorsColor": "Corresponde aos operadores e navegadores das expressoes Angular.\n\n* {{ if (key`?.`value `||` condition `&&` condition) {} }}\n\n* {{ if (key`.`value `!==` '') {} }}\n\n* {{ if (key`!.`value `===` '') {} }}\n\n```html{{\n\n{{\n\tif (key?.value || condition && condition) {}\n\tif (key.value !== '') {}\n\tif (key!.value === '') {}\n}}\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.svg.svgTags": "Corresponde a elementos conhecidos do SVG.\n\n* &#60;`circle`&#62;&#60;/`circle`&#62;\n\n* &#60;`path`&#62;&#60;/`path`&#62;\n\n```html\n\n<circle></circle>\n<svg>\n\t<circle></circle>\n\t<path></path>\n</svg>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.svg.svgDAttributePathCommands": "Corresponde a comandos do atributo d de tags path no SVG.\n\n* &#60;path d=\"`M`202.35,163.64`l`-4.38-13.1`h`-2.13`v`-3.85`h`9.1`v`3.85`h`-1.82`l`2.05,6.2`l`3.41-10.05\" /&#62;\n\n```html\n\n<svg>\n\t<path d=\"M202.35,163.64l-4.38-13.1h-2.13v-3.85h9.1v3.85h-1.82l2.05,6.2l3.41-10.05\" />\n</svg>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.xml.xmlTagNamespaceDivider": "Corresponde ao separador de namespace dois pontos de elementos XML/HTML.\n\n* &#60;li`:`title&#62;Book Title&#60;/li`:`title&#62;\n\n```html\n\n<li:title>Book Title</li:title>\n\n\n```\nDeixe em branco para desativar para este item.",
"ext.settings.xml.xmlTagNamespaceSuffix": "Corresponde ao sufixo de namespace de elementos XML/HTML.\n\n* &#60;li:`title`&#62;Book Title&#60;/li:`title`&#62;\n\n```html\n\n<li:title>Book Title</li:title>\n\n\n```\nDeixe em branco para desativar para este item.",
Expand Down
32 changes: 32 additions & 0 deletions src/color-customizations/expression-operator-colors.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
textMateRules: [
{
scope: 'html-template.ng.expression.operator.logical',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.compound',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.bitwise',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.comparison',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.relational',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.arithmetic',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
{
scope: 'html-template.ng.expression.operator.navigator',
configRule: 'vscode-angular-html.angularExpressionOperatorsAndNavigatorsColor',
},
],
}
8 changes: 8 additions & 0 deletions src/color-customizations/tag-svg-elements.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
textMateRules: [
{
scope: 'html-template.tag.svg',
configRule: 'vscode-angular-html.svgTags',
},
],
}
8 changes: 8 additions & 0 deletions src/color-customizations/tags-html-custom.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
textMateRules: [
{
scope: 'html-template.tag.custom',
configRule: 'vscode-angular-html.htmlCustomTags',
},
],
}
8 changes: 8 additions & 0 deletions src/color-customizations/tags-html-elements.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
textMateRules: [
{
scope: 'html-template.tag.html',
configRule: 'vscode-angular-html.htmlTags',
},
],
}
File renamed without changes.
18 changes: 15 additions & 3 deletions src/grammar/base.json5
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,22 @@
{ include: '#tag-deprecated-attribute-thead' },
{ include: '#tag-deprecated-attribute-th' },
{ include: '#tag-deprecated-attribute-tr' },
{ include: '#tag-deprecated-attribute-t' },
{ include: '#tag-deprecated-attribute-ul' },
{ include: '#tag-deprecated' },
{ include: '#tag-definition' },
{ include: '#tag-deprecated-other' },
{ include: '#tag-deprecated-inline' },
{ include: '#tag-deprecated-metadata-void' },
{ include: '#tag-deprecated-object-void' },
{ include: '#tag-deprecated-object' },
{ include: '#tag-deprecated-structure' },
{ include: '#tag-definition-angular' },
{ include: '#tag-definition-custom' },
{ include: '#tag-definition-structure' },
{ include: '#tag-definition-object' },
{ include: '#tag-definition-object-void' },
{ include: '#tag-definition-metadata' },
{ include: '#tag-definition-metadata-void' },
{ include: '#tag-definition-inline' },
{ include: '#tag-definition-inline-void' },
{ include: '#regex' },
{ include: '#comment' },
{ include: '#doctype' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{
repository: {
'tag-prefixed-attribute': {
'tag-alt-template-variable': {
beginCaptures: {
'2': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.let',
'0': {
name: 'meta.ng-binding.template.variable.alt.html',
},
'3': {
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.ref',
},
'4': {
'2': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.name',
},
'5': {
'3': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.rxjs',
},
'6': {
'4': {
name: 'punctuation.separator.key-value.html punctuation.separator.key-value.html-template.ng',
},
'7': {
'5': {
name: 'string.quoted.double.html',
},
},
endCaptures: {
'0': {
name: 'meta.ng-binding.template.variable.alt.html',
},
'1': {
name: 'string.quoted.double.html',
},
},
begin: '((let\\-)|(ref\\-))\\b([\\w\\-\\_]+)([$]*)(=)(")',
begin: '(ref\\-)\\b([\\w\\-\\_]+)([$]*)(=)(")',
end: '(")',
patterns: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
repository: {
'tag-annimation-trigger': {
captures: {
'0': {
name: 'meta.ng-animation-trigger.property.html',
},
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.animationtrigger.prefix',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
repository: {
'tag-minified-boolean-prefixed-attributes': {
'tag-boolean-alt-template-variable': {
captures: {
'2': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.let',
'0': {
name: 'meta.ng-binding.template.variable.boolean.alt.html',
},
'3': {
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.ref',
},
'4': {
'2': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.name',
},
'5': {
'3': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.rxjs',
},
},
match: '((let\\-)|(ref\\-))\\b([\\w\\-\\_]+)([$]*)(?!=)[\\s]?',
match: '(ref\\-)\\b([\\w\\-\\_]+)([$]*)(?!=)[\\s]?',
},
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
repository: {
'tag-boolean-sugar-attributes': {
captures: {
'0': {
name: 'meta.ng-binding.template.sugar.boolean.html',
},
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.sugar',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
repository: {
'tag-boolean-template-input-variable': {
captures: {
'0': {
name: 'meta.ng-binding.template.input.variable.boolean.html',
},
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.prefix.let',
},
'2': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.name',
},
'3': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.suffix.rxjs',
},
},
match: '(let\\-)\\b([\\w\\-\\_]+)([$]*)(?!=)[\\s]?',
},
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
repository: {
'tag-boolean-template-variable': {
captures: {
'0': {
name: 'meta.ng-binding.template.variable.boolean.html',
},
'1': {
name: 'entity.other.attribute-name.html html-template.ng.attributes.template.prefix',
},
Expand Down
Loading

0 comments on commit 71d978d

Please sign in to comment.