-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiments injecting bindings into meta.tag separately (#1993)
* fix(syntaxes): Do not highlight bindings outside element tags Currently we inject all the syntaxes into text.html, causing #1725 Rather than doing this, we should separate this into two injects, one injecting interpolation into the base html, and another which injects bindings, but only into meta.tag. fixes #1725 * fixup! fix(syntaxes): Do not highlight bindings outside element tags --------- Co-authored-by: Andrew Scott <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,166 additions
and
1,170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {GrammarDefinition} from './types'; | ||
|
||
export const TemplateTag: GrammarDefinition = { | ||
scopeName: 'template.tag.ng', | ||
injectionSelector: 'L:text.html#meta.tag -comment', | ||
patterns: [ | ||
{include: '#propertyBinding'}, | ||
{include: '#eventBinding'}, | ||
{include: '#twoWayBinding'}, | ||
{include: '#templateBinding'}, | ||
], | ||
repository: { | ||
|
||
propertyBinding: { | ||
begin: /(\[\s*@?[-_a-zA-Z0-9.$]*%?\s*])(=)(["'])/, | ||
beginCaptures: { | ||
1: { | ||
name: 'entity.other.attribute-name.html entity.other.ng-binding-name.property.html', | ||
patterns: [ | ||
{include: '#bindingKey'}, | ||
], | ||
}, | ||
2: {name: 'punctuation.separator.key-value.html'}, | ||
3: {name: 'string.quoted.html punctuation.definition.string.begin.html'}, | ||
}, | ||
end: /\3/, | ||
endCaptures: { | ||
0: {name: 'string.quoted.html punctuation.definition.string.end.html'}, | ||
}, | ||
name: 'meta.ng-binding.property.html', | ||
contentName: 'expression.ng', | ||
patterns: [ | ||
{include: 'expression.ng'}, | ||
], | ||
}, | ||
|
||
eventBinding: { | ||
begin: /(\(\s*@?[-_a-zA-Z0-9.$]*\s*\))(=)(["'])/, | ||
beginCaptures: { | ||
1: { | ||
name: 'entity.other.attribute-name.html entity.other.ng-binding-name.event.html', | ||
patterns: [ | ||
{include: '#bindingKey'}, | ||
], | ||
}, | ||
2: {name: 'punctuation.separator.key-value.html'}, | ||
3: {name: 'string.quoted.html punctuation.definition.string.begin.html'}, | ||
}, | ||
end: /\3/, | ||
endCaptures: { | ||
0: {name: 'string.quoted.html punctuation.definition.string.end.html'}, | ||
}, | ||
name: 'meta.ng-binding.event.html', | ||
contentName: 'expression.ng', | ||
patterns: [ | ||
{include: 'expression.ng'}, | ||
], | ||
}, | ||
|
||
twoWayBinding: { | ||
begin: /(\[\s*\(\s*@?[-_a-zA-Z0-9.$]*\s*\)\s*\])(=)(["'])/, | ||
beginCaptures: { | ||
1: { | ||
name: 'entity.other.attribute-name.html entity.other.ng-binding-name.two-way.html', | ||
patterns: [ | ||
{include: '#bindingKey'}, | ||
], | ||
}, | ||
2: {name: 'punctuation.separator.key-value.html'}, | ||
3: {name: 'string.quoted.html punctuation.definition.string.begin.html'}, | ||
}, | ||
end: /\3/, | ||
endCaptures: { | ||
0: {name: 'string.quoted.html punctuation.definition.string.end.html'}, | ||
}, | ||
name: 'meta.ng-binding.two-way.html', | ||
contentName: 'expression.ng', | ||
patterns: [ | ||
{include: 'expression.ng'}, | ||
], | ||
}, | ||
|
||
templateBinding: { | ||
begin: /(\*[-_a-zA-Z0-9.$]*)(=)(["'])/, | ||
beginCaptures: { | ||
1: { | ||
name: 'entity.other.attribute-name.html entity.other.ng-binding-name.template.html', | ||
patterns: [ | ||
{include: '#bindingKey'}, | ||
], | ||
}, | ||
2: {name: 'punctuation.separator.key-value.html'}, | ||
3: {name: 'string.quoted.html punctuation.definition.string.begin.html'}, | ||
}, | ||
end: /\3/, | ||
endCaptures: { | ||
0: {name: 'string.quoted.html punctuation.definition.string.end.html'}, | ||
}, | ||
name: 'meta.ng-binding.template.html', | ||
contentName: 'expression.ng', | ||
patterns: [ | ||
{include: 'expression.ng'}, | ||
], | ||
}, | ||
|
||
bindingKey: { | ||
patterns: [ | ||
{ | ||
match: /([\[\(]{1,2}|\*)(?:\s*)(@?[-_a-zA-Z0-9.$]*%?)(?:\s*)([\]\)]{1,2})?/, | ||
captures: { | ||
1: {name: 'punctuation.definition.ng-binding-name.begin.html'}, | ||
2: { | ||
name: 'entity.other.ng-binding-name.$2.html', | ||
patterns: [ | ||
{ | ||
match: /\./, | ||
name: 'punctuation.accessor.html', | ||
}, | ||
], | ||
}, | ||
3: {name: 'punctuation.definition.ng-binding-name.end.html'}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.