-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
text.html.edge.js
80 lines (78 loc) · 2.63 KB
/
text.html.edge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/edge-js/edge-vscode>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.edge'],
injections: {
'text.html.edge - (meta.embedded | meta.tag | comment.block.edge), L:(text.html.edge meta.tag - (comment.block.edge | meta.embedded.block.edge)), L:(source.ts.embedded.html - (comment.block.edge | meta.embedded.block.edge))':
{
patterns: [
{include: '#comment'},
{include: '#escapedMustache'},
{include: '#safeMustache'},
{include: '#mustache'},
{include: '#nonSeekableTag'},
{include: '#tag'}
]
}
},
names: ['edge'],
patterns: [{include: 'text.html.basic'}],
repository: {
comment: {
begin: '\\{{--',
beginCaptures: {0: {name: 'punctuation.definition.comment.begin.edge'}},
end: '\\--}}',
endCaptures: {0: {name: 'punctuation.definition.comment.end.edge'}},
name: 'comment.block'
},
escapedMustache: {
begin: '\\@{{',
beginCaptures: {0: {name: 'punctuation.definition.comment.begin.edge'}},
end: '\\}}',
endCaptures: {0: {name: 'punctuation.definition.comment.end.edge'}},
name: 'comment.block'
},
mustache: {
begin: '\\{{',
beginCaptures: {0: {name: 'punctuation.mustache.begin'}},
end: '\\}}',
endCaptures: {0: {name: 'punctuation.mustache.end'}},
name: 'meta.embedded.block.javascript',
patterns: [{include: 'source.ts#expression'}]
},
nonSeekableTag: {
captures: {2: {name: 'support.function.edge'}},
match: '^(\\s*)((@{1,2})(!)?([a-zA-Z._]+))(~)?$',
name: 'meta.embedded.block.javascript',
patterns: [{include: 'source.ts#expression'}]
},
safeMustache: {
begin: '\\{{{',
beginCaptures: {0: {name: 'punctuation.mustache.begin'}},
end: '\\}}}',
endCaptures: {0: {name: 'punctuation.mustache.end'}},
name: 'meta.embedded.block.javascript',
patterns: [{include: 'source.ts#expression'}]
},
tag: {
begin: '^(\\s*)((@{1,2})(!)?([a-zA-Z._]+)(\\s{0,2}))(\\()',
beginCaptures: {
2: {name: 'support.function.edge'},
7: {name: 'punctuation.paren.open'}
},
end: '\\)',
endCaptures: {0: {name: 'punctuation.paren.close'}},
name: 'meta.embedded.block.javascript',
patterns: [{include: 'source.ts#expression'}]
}
},
scopeName: 'text.html.edge'
}
export default grammar