Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions vscode-ng-language-service/syntaxes/src/template-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export const TemplateTag: GrammarDefinition = {
scopeName: 'template.tag.ng',
injectionSelector: 'L:text.html#meta.tag -comment',
patterns: [
{include: '#twoWayBinding'},
{include: '#propertyBinding'},
{include: '#eventBinding'},
{include: '#twoWayBinding'},
{include: '#templateBinding'},
],
repository: {
propertyBinding: {
begin: /(\[\s*@?[-_a-zA-Z0-9.$]*%?\s*])(=)(["'])/,
begin: /(\[\s*@?(?:[-_a-zA-Z0-9.$]+|\[[^\[\]]*]|\([^()]*\))*%?\s*])(=)(["'])/,
beginCaptures: {
1: {
name: 'entity.other.attribute-name.html entity.other.ng-binding-name.property.html',
Expand Down Expand Up @@ -101,7 +101,8 @@ export const TemplateTag: GrammarDefinition = {
bindingKey: {
patterns: [
{
match: /([\[\(]{1,2}|\*)(?:\s*)(@?[-_a-zA-Z0-9.$]*%?)(?:\s*)([\]\)]{1,2})?/,
match:
/([\[\(]{1,2}|\*)(?:\s*)(@?(?:[-_a-zA-Z0-9.$]+|\[[^\[\]]*]|\([^()]*\))*%?)(?:\s*)([\]\)]{1,2})?/,
captures: {
1: {name: 'punctuation.definition.ng-binding-name.begin.html'},
2: {
Expand Down
10 changes: 5 additions & 5 deletions vscode-ng-language-service/syntaxes/template-tag.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"injectionSelector": "L:text.html#meta.tag -comment",
"patterns": [
{
"include": "#propertyBinding"
"include": "#twoWayBinding"
},
{
"include": "#eventBinding"
"include": "#propertyBinding"
},
{
"include": "#twoWayBinding"
"include": "#eventBinding"
},
{
"include": "#templateBinding"
}
],
"repository": {
"propertyBinding": {
"begin": "(\\[\\s*@?[-_a-zA-Z0-9.$]*%?\\s*])(=)([\"'])",
"begin": "(\\[\\s*@?(?:[-_a-zA-Z0-9.$]+|\\[[^\\[\\]]*]|\\([^()]*\\))*%?\\s*])(=)([\"'])",
"beginCaptures": {
"1": {
"name": "entity.other.attribute-name.html entity.other.ng-binding-name.property.html",
Expand Down Expand Up @@ -147,7 +147,7 @@
"bindingKey": {
"patterns": [
{
"match": "([\\[\\(]{1,2}|\\*)(?:\\s*)(@?[-_a-zA-Z0-9.$]*%?)(?:\\s*)([\\]\\)]{1,2})?",
"match": "([\\[\\(]{1,2}|\\*)(?:\\s*)(@?(?:[-_a-zA-Z0-9.$]+|\\[[^\\[\\]]*]|\\([^()]*\\))*%?)(?:\\s*)([\\]\\)]{1,2})?",
"captures": {
"1": {
"name": "punctuation.definition.ng-binding-name.begin.html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<div [myProperty$]="val"></div>
<div [%invalidProperty]="val"></div>
<div [invalidProperty)="val"></div>
<div [class.min-h-[calc(100vh-var(--header-height))]]="val"></div>

<!-- Event binding test -->
<button (click)="onClick($event)"></button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng
><div [invalidProperty)="val"></div>
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng
><div [class.min-h-[calc(100vh-var(--header-height))]]="val"></div>
#^^^^^ template.tag.ng
# ^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html punctuation.definition.ng-binding-name.begin.html
# ^^^^^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html entity.other.ng-binding-name.class.min-h-[calc(100vh-var(--header-height))].html
# ^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html entity.other.ng-binding-name.class.min-h-[calc(100vh-var(--header-height))].html punctuation.accessor.html
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html entity.other.ng-binding-name.class.min-h-[calc(100vh-var(--header-height))].html
# ^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html punctuation.definition.ng-binding-name.end.html
# ^ template.tag.ng meta.ng-binding.property.html punctuation.separator.key-value.html
# ^ template.tag.ng meta.ng-binding.property.html string.quoted.html punctuation.definition.string.begin.html
# ^^^ template.tag.ng meta.ng-binding.property.html expression.ng variable.other.readwrite.ts
# ^ template.tag.ng meta.ng-binding.property.html string.quoted.html punctuation.definition.string.end.html
# ^^^^^^^^ template.tag.ng
>
><!-- Event binding test -->
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng
Expand Down Expand Up @@ -348,7 +360,15 @@
# ^ template.tag.ng meta.ng-binding.two-way.html string.quoted.html punctuation.definition.string.end.html
# ^^^^^^^^^^^^^^^^^ template.tag.ng
><my-component [(%invalid)]="invalid"></my-component>
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng
#^^^^^^^^^^^^^^ template.tag.ng
# ^^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html punctuation.definition.ng-binding-name.begin.html
# ^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html entity.other.ng-binding-name.%.html
# ^^^^^^^^^ template.tag.ng meta.ng-binding.property.html entity.other.attribute-name.html entity.other.ng-binding-name.property.html
# ^ template.tag.ng meta.ng-binding.property.html punctuation.separator.key-value.html
# ^ template.tag.ng meta.ng-binding.property.html string.quoted.html punctuation.definition.string.begin.html
# ^^^^^^^ template.tag.ng meta.ng-binding.property.html expression.ng variable.other.readwrite.ts
# ^ template.tag.ng meta.ng-binding.property.html string.quoted.html punctuation.definition.string.end.html
# ^^^^^^^^^^^^^^^^^ template.tag.ng
><my-component ([invalid)]="invalid"></my-component>
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.tag.ng
>
Expand Down