Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e4c54be8
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e4c54be8
编写于
7月 27, 2018
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update TypeScript grammar
上级
c640a0ed
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
1079 addition
and
127 deletion
+1079
-127
extensions/javascript/syntaxes/JavaScript.tmLanguage.json
extensions/javascript/syntaxes/JavaScript.tmLanguage.json
+269
-31
extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json
...sions/javascript/syntaxes/JavaScriptReact.tmLanguage.json
+269
-31
extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json
...ons/typescript-basics/syntaxes/TypeScript.tmLanguage.json
+269
-31
extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json
...ypescript-basics/syntaxes/TypeScriptReact.tmLanguage.json
+269
-31
extensions/typescript-basics/test/colorize-results/test-issue11_ts.json
...escript-basics/test/colorize-results/test-issue11_ts.json
+1
-1
extensions/typescript-basics/test/colorize-results/test-issue5431_ts.json
...cript-basics/test/colorize-results/test-issue5431_ts.json
+1
-1
extensions/typescript-basics/test/colorize-results/test-issue5566_ts.json
...cript-basics/test/colorize-results/test-issue5566_ts.json
+1
-1
未找到文件。
extensions/javascript/syntaxes/JavaScript.tmLanguage.json
浏览文件 @
e4c54be8
...
...
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository."
,
"Once accepted there, we are happy to receive an update request."
],
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
32208c2b11569d08a925f56fd69d28b18a5cc30
8"
,
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
858d33f03943e4ec040e81cbabbc3f7892157c1
8"
,
"name"
:
"JavaScript (with React support)"
,
"scopeName"
:
"source.js"
,
"patterns"
:
[
...
...
@@ -285,55 +285,112 @@
]
},
"var-expr"
:
{
"name"
:
"meta.var.expr.js"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let|const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.js"
},
"2"
:
{
"name"
:
"storage.type.js"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const|^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"name"
:
"meta.var.expr.js"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let)(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js"
"name"
:
"keyword.control.export.js"
},
"2"
:
{
"name"
:
"storage.type.js"
}
},
"end"
:
"(
?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S
)(?=
\\
s*$)))"
,
"end"
:
"(
(?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var
)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
"name"
:
"meta.var.expr.js"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.js"
},
"2"
:
{
"name"
:
"storage.type.js"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
}
]
},
...
...
@@ -386,6 +443,40 @@
}
]
},
"var-single-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.var-single-variable.expr.js"
,
"begin"
:
"(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=
\\
s*
\n
# function assignment |
\n
(=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)) |
\n
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
\n
(:
\\
s*(
\n
(<) |
\n
([(]
\\
s*(
\n
([)]) |
\n
(
\\
.
\\
.
\\
.) |
\n
([_$[:alnum:]]+
\\
s*(
\n
([:,?=])|
\n
([)]
\\
s*=>)
\n
))
\n
))
\n
)) |
\n
(:
\\
s*((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$))) |
\n
(:
\\
s*(=>|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(<[^<>]*>)|[^<>(),=])+=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.js variable.other.constant.js entity.name.function.js"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
},
{
"name"
:
"meta.var-single-variable.expr.js"
,
"begin"
:
"([_$[:alpha:]][_$[:alnum:]]*)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.js variable.other.constant.js"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation"
:
{
"patterns"
:
[
{
...
...
@@ -435,6 +526,42 @@
}
]
},
"destructuring-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.object-binding-pattern-variable.js"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
{)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
},
{
"name"
:
"meta.array-binding-pattern-variable.js"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
[)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
}
]
},
"object-binding-element"
:
{
"patterns"
:
[
{
...
...
@@ -466,6 +593,37 @@
}
]
},
"object-binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(?=,|
\\
})"
,
"patterns"
:
[
{
"include"
:
"#object-binding-element-propertyName"
},
{
"include"
:
"#binding-element-const"
}
]
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"object-binding-element-propertyName"
:
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(:)"
,
...
...
@@ -512,6 +670,28 @@
}
]
},
"binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#string"
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
}
]
},
"destructuring-variable-rest"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
...
...
@@ -523,6 +703,17 @@
}
}
},
"destructuring-variable-rest-const"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js"
},
"2"
:
{
"name"
:
"meta.definition.variable.js variable.other.constant.js"
}
}
},
"object-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
...
...
@@ -545,6 +736,28 @@
}
]
},
"object-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.js"
}
},
"end"
:
"
\\
}"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.js"
}
},
"patterns"
:
[
{
"include"
:
"#object-binding-element-const"
}
]
},
"array-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
...
...
@@ -570,6 +783,31 @@
}
]
},
"array-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.js"
}
},
"end"
:
"
\\
]"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.js"
}
},
"patterns"
:
[
{
"include"
:
"#binding-element-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"parameter-name"
:
{
"patterns"
:
[
{
...
...
extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json
浏览文件 @
e4c54be8
...
...
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository."
,
"Once accepted there, we are happy to receive an update request."
],
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
32208c2b11569d08a925f56fd69d28b18a5cc30
8"
,
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
858d33f03943e4ec040e81cbabbc3f7892157c1
8"
,
"name"
:
"JavaScript (with React support)"
,
"scopeName"
:
"source.js.jsx"
,
"patterns"
:
[
...
...
@@ -285,55 +285,112 @@
]
},
"var-expr"
:
{
"name"
:
"meta.var.expr.js.jsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let|const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.js.jsx"
},
"2"
:
{
"name"
:
"storage.type.js.jsx"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const|^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"name"
:
"meta.var.expr.js.jsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let)(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js.jsx"
"name"
:
"keyword.control.export.js.jsx"
},
"2"
:
{
"name"
:
"storage.type.js.jsx"
}
},
"end"
:
"(
?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S
)(?=
\\
s*$)))"
,
"end"
:
"(
(?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var
)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js.jsx"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
"name"
:
"meta.var.expr.js.jsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.js.jsx"
},
"2"
:
{
"name"
:
"storage.type.js.jsx"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.js.jsx"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
}
]
},
...
...
@@ -386,6 +443,40 @@
}
]
},
"var-single-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.var-single-variable.expr.js.jsx"
,
"begin"
:
"(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=
\\
s*
\n
# function assignment |
\n
(=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)) |
\n
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
\n
(:
\\
s*(
\n
(<) |
\n
([(]
\\
s*(
\n
([)]) |
\n
(
\\
.
\\
.
\\
.) |
\n
([_$[:alnum:]]+
\\
s*(
\n
([:,?=])|
\n
([)]
\\
s*=>)
\n
))
\n
))
\n
)) |
\n
(:
\\
s*((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$))) |
\n
(:
\\
s*(=>|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(<[^<>]*>)|[^<>(),=])+=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.js.jsx variable.other.constant.js.jsx entity.name.function.js.jsx"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
},
{
"name"
:
"meta.var-single-variable.expr.js.jsx"
,
"begin"
:
"([_$[:alpha:]][_$[:alnum:]]*)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.js.jsx variable.other.constant.js.jsx"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation"
:
{
"patterns"
:
[
{
...
...
@@ -435,6 +526,42 @@
}
]
},
"destructuring-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.object-binding-pattern-variable.js.jsx"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
{)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
},
{
"name"
:
"meta.array-binding-pattern-variable.js.jsx"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
[)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
}
]
},
"object-binding-element"
:
{
"patterns"
:
[
{
...
...
@@ -466,6 +593,37 @@
}
]
},
"object-binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(?=,|
\\
})"
,
"patterns"
:
[
{
"include"
:
"#object-binding-element-propertyName"
},
{
"include"
:
"#binding-element-const"
}
]
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"object-binding-element-propertyName"
:
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(:)"
,
...
...
@@ -512,6 +670,28 @@
}
]
},
"binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#string"
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
}
]
},
"destructuring-variable-rest"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
...
...
@@ -523,6 +703,17 @@
}
}
},
"destructuring-variable-rest-const"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js.jsx"
},
"2"
:
{
"name"
:
"meta.definition.variable.js.jsx variable.other.constant.js.jsx"
}
}
},
"object-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
...
...
@@ -545,6 +736,28 @@
}
]
},
"object-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js.jsx"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.js.jsx"
}
},
"end"
:
"
\\
}"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.js.jsx"
}
},
"patterns"
:
[
{
"include"
:
"#object-binding-element-const"
}
]
},
"array-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
...
...
@@ -570,6 +783,31 @@
}
]
},
"array-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.js.jsx"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.js.jsx"
}
},
"end"
:
"
\\
]"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.js.jsx"
}
},
"patterns"
:
[
{
"include"
:
"#binding-element-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"parameter-name"
:
{
"patterns"
:
[
{
...
...
extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json
浏览文件 @
e4c54be8
...
...
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository."
,
"Once accepted there, we are happy to receive an update request."
],
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
32208c2b11569d08a925f56fd69d28b18a5cc30
8"
,
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
858d33f03943e4ec040e81cbabbc3f7892157c1
8"
,
"name"
:
"TypeScript"
,
"scopeName"
:
"source.ts"
,
"patterns"
:
[
...
...
@@ -282,55 +282,112 @@
]
},
"var-expr"
:
{
"name"
:
"meta.var.expr.ts"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let|const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.ts"
},
"2"
:
{
"name"
:
"storage.type.ts"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const|^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"name"
:
"meta.var.expr.ts"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let)(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.ts"
"name"
:
"keyword.control.export.ts"
},
"2"
:
{
"name"
:
"storage.type.ts"
}
},
"end"
:
"(
?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S
)(?=
\\
s*$)))"
,
"end"
:
"(
(?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var
)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.ts"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
"name"
:
"meta.var.expr.ts"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.ts"
},
"2"
:
{
"name"
:
"storage.type.ts"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.ts"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
}
]
},
...
...
@@ -383,6 +440,40 @@
}
]
},
"var-single-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.var-single-variable.expr.ts"
,
"begin"
:
"(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=
\\
s*
\n
# function assignment |
\n
(=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|((<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?[
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)) |
\n
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
\n
(:
\\
s*(
\n
(<) |
\n
([(]
\\
s*(
\n
([)]) |
\n
(
\\
.
\\
.
\\
.) |
\n
([_$[:alnum:]]+
\\
s*(
\n
([:,?=])|
\n
([)]
\\
s*=>)
\n
))
\n
))
\n
)) |
\n
(:
\\
s*((<
\\
s*$)|((<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?[
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$))) |
\n
(:
\\
s*(=>|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(<[^<>]*>)|[^<>(),=])+=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|((<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?[
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
},
{
"name"
:
"meta.var-single-variable.expr.ts"
,
"begin"
:
"([_$[:alpha:]][_$[:alnum:]]*)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.ts variable.other.constant.ts"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation"
:
{
"patterns"
:
[
{
...
...
@@ -432,6 +523,42 @@
}
]
},
"destructuring-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.object-binding-pattern-variable.ts"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
{)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
},
{
"name"
:
"meta.array-binding-pattern-variable.ts"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
[)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
}
]
},
"object-binding-element"
:
{
"patterns"
:
[
{
...
...
@@ -463,6 +590,37 @@
}
]
},
"object-binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(?=,|
\\
})"
,
"patterns"
:
[
{
"include"
:
"#object-binding-element-propertyName"
},
{
"include"
:
"#binding-element-const"
}
]
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"object-binding-element-propertyName"
:
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(:)"
,
...
...
@@ -509,6 +667,28 @@
}
]
},
"binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#string"
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
}
]
},
"destructuring-variable-rest"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
...
...
@@ -520,6 +700,17 @@
}
}
},
"destructuring-variable-rest-const"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.ts"
},
"2"
:
{
"name"
:
"meta.definition.variable.ts variable.other.constant.ts"
}
}
},
"object-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
...
...
@@ -542,6 +733,28 @@
}
]
},
"object-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.ts"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.ts"
}
},
"end"
:
"
\\
}"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.ts"
}
},
"patterns"
:
[
{
"include"
:
"#object-binding-element-const"
}
]
},
"array-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
...
...
@@ -567,6 +780,31 @@
}
]
},
"array-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.ts"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.ts"
}
},
"end"
:
"
\\
]"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.ts"
}
},
"patterns"
:
[
{
"include"
:
"#binding-element-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"parameter-name"
:
{
"patterns"
:
[
{
...
...
extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json
浏览文件 @
e4c54be8
...
...
@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository."
,
"Once accepted there, we are happy to receive an update request."
],
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
32208c2b11569d08a925f56fd69d28b18a5cc30
8"
,
"version"
:
"https://github.com/Microsoft/TypeScript-TmLanguage/commit/
858d33f03943e4ec040e81cbabbc3f7892157c1
8"
,
"name"
:
"TypeScriptReact"
,
"scopeName"
:
"source.tsx"
,
"patterns"
:
[
...
...
@@ -285,55 +285,112 @@
]
},
"var-expr"
:
{
"name"
:
"meta.var.expr.tsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let|const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.tsx"
},
"2"
:
{
"name"
:
"storage.type.tsx"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const|^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"name"
:
"meta.var.expr.tsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(var|let)(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.tsx"
"name"
:
"keyword.control.export.tsx"
},
"2"
:
{
"name"
:
"storage.type.tsx"
}
},
"end"
:
"(
?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S
)(?=
\\
s*$)))"
,
"end"
:
"(
(?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^let|[^
\\
._$[:alnum:]]let|^var|[^
\\
._$[:alnum:]]var
)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.tsx"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-variable"
},
{
"include"
:
"#var-single-variable"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
"name"
:
"meta.var.expr.tsx"
,
"begin"
:
"(?<![_$[:alnum:]])(?:(?<=
\\
.
\\
.
\\
.)|(?<!
\\
.))(?:(
\\
bexport)
\\
s+)?
\\
b(const(?!
\\
s+enum
\\
b))(?![_$[:alnum:]])(?:(?=
\\
.
\\
.
\\
.)|(?!
\\
.))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.control.export.tsx"
},
"2"
:
{
"name"
:
"storage.type.tsx"
}
},
"end"
:
"((?=;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$|;|^
\\
s*abstract
\\
b|^
\\
s*async
\\
b|^
\\
s*class
\\
b|^
\\
s*const
\\
b|^
\\
s*declare
\\
b|^
\\
s*enum
\\
b|^
\\
s*export
\\
b|^
\\
s*function
\\
b|^
\\
s*import
\\
b|^
\\
s*interface
\\
b|^
\\
s*let
\\
b|^
\\
s*module
\\
b|^
\\
s*namespace
\\
b|^
\\
s*return
\\
b|^
\\
s*type
\\
b|^
\\
s*var
\\
b)|((?<=
\\
S)(?<!^const|[^
\\
._$[:alnum:]]const)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#comment"
},
{
"begin"
:
"(,)
\\
s*(?!
\\
S)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"punctuation.separator.comma.tsx"
}
},
"end"
:
"(?<!,)(((?==|;|}|(
\\
s+(of|in)
\\
s+)|^
\\
s*$))|((?<=
\\
S)(?=
\\
s*$)))"
,
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#destructuring-const"
},
{
"include"
:
"#var-single-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
{
"include"
:
"#punctuation-comma"
}
]
}
]
},
...
...
@@ -386,6 +443,40 @@
}
]
},
"var-single-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.var-single-variable.expr.tsx"
,
"begin"
:
"(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=
\\
s*
\n
# function assignment |
\n
(=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)) |
\n
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
\n
(:
\\
s*(
\n
(<) |
\n
([(]
\\
s*(
\n
([)]) |
\n
(
\\
.
\\
.
\\
.) |
\n
([_$[:alnum:]]+
\\
s*(
\n
([:,?=])|
\n
([)]
\\
s*=>)
\n
))
\n
))
\n
)) |
\n
(:
\\
s*((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$))) |
\n
(:
\\
s*(=>|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(<[^<>]*>)|[^<>(),=])+=
\\
s*(
\n
((async
\\
s+)?(
\n
(function
\\
s*[(<*]) |
\n
(function
\\
s+) |
\n
([_$[:alpha:]][_$[:alnum:]]*
\\
s*=>)
\n
)) |
\n
((async
\\
s*)?(
\n
((<
\\
s*$)|([
\\
(]
\\
s*([
\\
{
\\
[]
\\
s*)?$)) |
\n
# sure shot arrow functions even if => is on new line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)?
\n
[(]
\\
s*
\n
(
\n
([)]
\\
s*:) | # ():
\n
((
\\
.
\\
.
\\
.
\\
s*)?[_$[:alpha:]][_$[:alnum:]]*
\\
s*:) # [(]param: | [(]...param:
\n
)
\n
) |
\n
(
\n
[<]
\\
s*[_$[:alpha:]][_$[:alnum:]]*
\\
s+extends
\\
s*[^=>] # < typeparam extends
\n
) |
\n
# arrow function possible to detect only with => on same line
\n
(
\n
(<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<]|
\\
<
\\
s*([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
))|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
]))([^=<>]|=[^<])*
\\
>)*>
\\
s*)? # typeparameters
\n
\\
(
\\
s*(([_$[:alpha:]]|(
\\
{([^
\\
{
\\
}]|(
\\
{[^
\\
{
\\
}]*
\\
}))*
\\
})|(
\\
[([^
\\
[
\\
]]|(
\\
[[^
\\
[
\\
]]*
\\
]))*
\\
])|(
\\
.
\\
.
\\
.
\\
s*[_$[:alpha:]]))([^()]|(
\\
(([^
\\
(
\\
)]|(
\\
([^
\\
(
\\
)]*
\\
)))*
\\
)))*)?
\\
) # parameters
\n
(
\\
s*:
\\
s*([^<>
\\
(
\\
)]|
\\
<[^<>]+
\\
>|
\\
([^
\\
(
\\
)]+
\\
))+)? # return type
\n
\\
s*=> # arrow operator
\n
)
\n
))
\n
)))"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.tsx variable.other.constant.tsx entity.name.function.tsx"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
},
{
"name"
:
"meta.var-single-variable.expr.tsx"
,
"begin"
:
"([_$[:alpha:]][_$[:alnum:]]*)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"meta.definition.variable.tsx variable.other.constant.tsx"
}
},
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation"
:
{
"patterns"
:
[
{
...
...
@@ -435,6 +526,42 @@
}
]
},
"destructuring-const"
:
{
"patterns"
:
[
{
"name"
:
"meta.object-binding-pattern-variable.tsx"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
{)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
},
{
"name"
:
"meta.array-binding-pattern-variable.tsx"
,
"begin"
:
"(?<!=|:|^of|[^
\\
._$[:alnum:]]of|^in|[^
\\
._$[:alnum:]]in)
\\
s*(?=
\\
[)"
,
"end"
:
"(?=$|^|[;,=}]|(
\\
s+(of|in)
\\
s+))"
,
"patterns"
:
[
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#type-annotation"
},
{
"include"
:
"#comment"
}
]
}
]
},
"object-binding-element"
:
{
"patterns"
:
[
{
...
...
@@ -466,6 +593,37 @@
}
]
},
"object-binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(?=,|
\\
})"
,
"patterns"
:
[
{
"include"
:
"#object-binding-element-propertyName"
},
{
"include"
:
"#binding-element-const"
}
]
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"object-binding-element-propertyName"
:
{
"begin"
:
"(?x)(?=((
\\
b(?<!
\\
$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(b|B)[01][01_]*
\\
b(?!
\\
$))|(
\\
b(?<!
\\
$)0(o|O)?[0-7][0-7_]*
\\
b(?!
\\
$))|((?<!
\\
$)(?:
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[eE][+-]?[0-9][0-9_]*
\\
b)| # 1.E+3
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # .1E+3
\n
(?:
\\
b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*
\\
b)| # 1E+3
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)[0-9][0-9_]*
\\
b)| # 1.1
\n
(?:
\\
b[0-9][0-9_]*(
\\
.)
\\
B)| # 1.
\n
(?:
\\
B(
\\
.)[0-9][0-9_]*
\\
b)| # .1
\n
(?:
\\
b[0-9][0-9_]*
\\
b(?!
\\
.)) # 1
\n
)(?!
\\
$))|([_$[:alpha:]][_$[:alnum:]]*)|(
\\
'([^
\\
'
\\\\
]|
\\\\\\
'|
\\\\
)*
\\
')|(
\\\"
([^
\\\"\\\\
]|
\\\\\\\"
|
\\\\
)*
\\\"
)|(
\\
[([^
\\
[
\\
]]|
\\
[[^
\\
[
\\
]]*
\\
])+
\\
]))
\\
s*(:))"
,
"end"
:
"(:)"
,
...
...
@@ -512,6 +670,28 @@
}
]
},
"binding-element-const"
:
{
"patterns"
:
[
{
"include"
:
"#comment"
},
{
"include"
:
"#string"
},
{
"include"
:
"#object-binding-pattern-const"
},
{
"include"
:
"#array-binding-pattern-const"
},
{
"include"
:
"#destructuring-variable-rest-const"
},
{
"include"
:
"#variable-initializer"
}
]
},
"destructuring-variable-rest"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
...
...
@@ -523,6 +703,17 @@
}
}
},
"destructuring-variable-rest-const"
:
{
"match"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?([_$[:alpha:]][_$[:alnum:]]*)"
,
"captures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.tsx"
},
"2"
:
{
"name"
:
"meta.definition.variable.tsx variable.other.constant.tsx"
}
}
},
"object-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
...
...
@@ -545,6 +736,28 @@
}
]
},
"object-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
{)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.tsx"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.tsx"
}
},
"end"
:
"
\\
}"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.object.tsx"
}
},
"patterns"
:
[
{
"include"
:
"#object-binding-element-const"
}
]
},
"array-binding-pattern"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
...
...
@@ -570,6 +783,31 @@
}
]
},
"array-binding-pattern-const"
:
{
"begin"
:
"(?:(
\\
.
\\
.
\\
.)
\\
s*)?(
\\
[)"
,
"beginCaptures"
:
{
"1"
:
{
"name"
:
"keyword.operator.rest.tsx"
},
"2"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.tsx"
}
},
"end"
:
"
\\
]"
,
"endCaptures"
:
{
"0"
:
{
"name"
:
"punctuation.definition.binding-pattern.array.tsx"
}
},
"patterns"
:
[
{
"include"
:
"#binding-element-const"
},
{
"include"
:
"#punctuation-comma"
}
]
},
"parameter-name"
:
{
"patterns"
:
[
{
...
...
extensions/typescript-basics/test/colorize-results/test-issue11_ts.json
浏览文件 @
e4c54be8
...
...
@@ -2960,7 +2960,7 @@
},
{
"c"
:
"t"
,
"t"
:
"source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.
readwrite
.ts"
,
"t"
:
"source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.
constant
.ts"
,
"r"
:
{
"dark_plus"
:
"variable: #9CDCFE"
,
"light_plus"
:
"variable: #001080"
,
...
...
extensions/typescript-basics/test/colorize-results/test-issue5431_ts.json
浏览文件 @
e4c54be8
...
...
@@ -188,7 +188,7 @@
},
{
"c"
:
"timeRange"
,
"t"
:
"source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.
readwrite
.ts"
,
"t"
:
"source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.
constant
.ts"
,
"r"
:
{
"dark_plus"
:
"variable: #9CDCFE"
,
"light_plus"
:
"variable: #001080"
,
...
...
extensions/typescript-basics/test/colorize-results/test-issue5566_ts.json
浏览文件 @
e4c54be8
...
...
@@ -111,7 +111,7 @@
},
{
"c"
:
"foo"
,
"t"
:
"source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts entity.name.function.ts"
,
"t"
:
"source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts
variable.other.constant.ts
entity.name.function.ts"
,
"r"
:
{
"dark_plus"
:
"entity.name.function: #DCDCAA"
,
"light_plus"
:
"entity.name.function: #795E26"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录