Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8998f7a5
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8998f7a5
编写于
1月 03, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt new vscode textmate
上级
9cebde96
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
299 addition
and
72 deletion
+299
-72
extensions/markdown/syntaxes/markdown.tmLanguage
extensions/markdown/syntaxes/markdown.tmLanguage
+3
-3
extensions/theme-defaults/themes/dark_plus.json
extensions/theme-defaults/themes/dark_plus.json
+35
-16
extensions/theme-defaults/themes/dark_vs.json
extensions/theme-defaults/themes/dark_vs.json
+36
-9
extensions/theme-defaults/themes/hc_black.json
extensions/theme-defaults/themes/hc_black.json
+34
-7
extensions/theme-defaults/themes/light_plus.json
extensions/theme-defaults/themes/light_plus.json
+35
-16
extensions/theme-defaults/themes/light_vs.json
extensions/theme-defaults/themes/light_vs.json
+65
-10
src/vs/editor/node/textMate/TMSyntax.ts
src/vs/editor/node/textMate/TMSyntax.ts
+81
-11
src/vs/workbench/services/themes/common/themeService.ts
src/vs/workbench/services/themes/common/themeService.ts
+1
-0
src/vs/workbench/services/themes/electron-browser/themeService.ts
...orkbench/services/themes/electron-browser/themeService.ts
+9
-0
未找到文件。
extensions/markdown/syntaxes/markdown.tmLanguage
浏览文件 @
8998f7a5
...
...
@@ -294,8 +294,8 @@
<string>
(^|\G)\s*(
<
!--)
</string>
<key>
end
</key>
<string>
(--
>
)
</string>
<key>
contentN
ame
</key>
<string>
block.comment
.html
</string>
<key>
n
ame
</key>
<string>
comment.block
.html
</string>
<key>
captures
</key>
<dict>
<key>
1
</key>
...
...
@@ -1902,7 +1902,7 @@
<key>
match
</key>
<string>
(`+)([^`]|(?!(?
<
!`)\1(?!`))`)*+(\1)
</string>
<key>
name
</key>
<string>
markup.
raw.inline
.markdown
</string>
<string>
markup.
inline.raw
.markdown
</string>
</dict>
</dict>
</dict>
...
...
extensions/theme-defaults/themes/dark_plus.json
浏览文件 @
8998f7a5
...
...
@@ -19,9 +19,28 @@
"support.class"
,
"support.type"
,
"entity.name.type"
,
"entity.name.class"
,
"storage.type.cs"
,
"storage.type.generic.cs"
,
"storage.type.modifier.cs"
,
"storage.type.variable.cs"
,
"storage.type.annotation.java"
,
"storage.type.generic.java"
,
"storage.type.java"
,
"entity.other.inherited-class"
"storage.type.object.array.java"
,
"storage.type.primitive.array.java"
,
"storage.type.primitive.java"
,
"storage.type.token.java"
,
"storage.type.groovy"
,
"storage.type.annotation.groovy"
,
"storage.type.parameters.groovy"
,
"storage.type.generic.groovy"
,
"storage.type.object.array.groovy"
,
"storage.type.primitive.array.groovy"
,
"storage.type.primitive.groovy"
],
"settings"
:
{
"foreground"
:
"#4EC9B0"
...
...
@@ -51,9 +70,8 @@
{
"name"
:
"Variable and parameter name"
,
"scope"
:
[
"variable.parameter"
,
"variable"
,
"variable.name"
,
"
meta.definition.
variable.name"
,
"support.variable"
],
"settings"
:
{
...
...
@@ -61,8 +79,11 @@
}
},
{
"name"
:
"Object keys, TS gammar specific"
,
"scope"
:
"object-literal.member.key"
,
"name"
:
"Object keys, TS grammar specific"
,
"scope"
:
[
"meta.object-literal.key"
,
"meta.object-literal.key entity.name.function"
],
"settings"
:
{
"foreground"
:
"#9CDCFE"
}
...
...
@@ -70,21 +91,19 @@
{
"name"
:
"CSS property value"
,
"scope"
:
[
"support.property-value"
,
"constant.rgb-value"
,
"support.property-value.scss"
,
"constant.rgb-value.scss"
"constant.other.color.rgb-value.css"
,
"constant.other.rgb-value.css"
,
"meta.property-value.css support.function"
,
"meta.property-value.css support"
,
"constant.numeric.color.rgb-value.scss"
,
"constant.rgb-value.scss"
,
"meta.property-value.scss support.function"
,
"meta.property-value.scss support"
],
"settings"
:
{
"foreground"
:
"#CE9178"
}
},
{
"name"
:
"JSX Tag names, workaround for flattening match with function"
,
"scope"
:
"entity.name.function.tag"
,
"settings"
:
{
"foreground"
:
"#569cd6"
}
}
]
}
\ No newline at end of file
extensions/theme-defaults/themes/dark_vs.json
浏览文件 @
8998f7a5
{
"name"
:
"Dark Visual Studio"
,
"settings"
:
[
{
"settings"
:
{
"foreground"
:
"#D4D4D4"
,
"background"
:
"#1E1E1E"
}
},
{
"scope"
:
"emphasis"
,
"settings"
:
{
...
...
@@ -45,7 +51,11 @@
}
},
{
"scope"
:
"constant.rgb-value"
,
"scope"
:
[
"constant.other.color.rgb-value.css"
,
"constant.numeric.color.rgb-value.scss"
,
"constant.other.rgb-value.css"
],
"settings"
:
{
"foreground"
:
"#d4d4d4"
}
...
...
@@ -57,7 +67,7 @@
}
},
{
"scope"
:
"entity.name.
selector
"
,
"scope"
:
"entity.name.
tag.css
"
,
"settings"
:
{
"foreground"
:
"#d7ba7d"
}
...
...
@@ -69,7 +79,19 @@
}
},
{
"scope"
:
"entity.other.attribute-name.css"
,
"scope"
:
[
"entity.other.attribute-name.class.css"
,
"entity.other.attribute-name.class.mixin.css"
,
"entity.other.attribute-name.id.css"
,
"entity.other.attribute-name.parent-selector.css"
,
"entity.other.attribute-name.pseudo-class.css"
,
"entity.other.attribute-name.pseudo-element.css"
,
"source.css.less entity.other.attribute-name.id"
,
"entity.other.attribute-name.attribute.scss"
,
"entity.other.attribute-name.scss"
],
"settings"
:
{
"foreground"
:
"#d7ba7d"
}
...
...
@@ -125,13 +147,13 @@
}
},
{
"scope"
:
"
markup.punctuation.quote.beginning
"
,
"scope"
:
"
beginning.punctuation.definition.quote.markdown
"
,
"settings"
:
{
"foreground"
:
"#608b4e"
}
},
{
"scope"
:
"
markup.punctuation.list.beginning
"
,
"scope"
:
"
beginning.punctuation.definition.list.markdown
"
,
"settings"
:
{
"foreground"
:
"#6796e6"
}
...
...
@@ -180,7 +202,7 @@
}
},
{
"scope"
:
"meta.
header.diff
"
,
"scope"
:
"meta.
diff.header
"
,
"settings"
:
{
"foreground"
:
"#569cd6"
}
...
...
@@ -229,7 +251,10 @@
},
{
"name"
:
"JavaScript string interpolation ${}"
,
"scope"
:
"string.template-expression"
,
"scope"
:
[
"punctuation.definition.template-expression.begin.ts"
,
"punctuation.definition.template-expression.end.ts"
],
"settings"
:
{
"foreground"
:
"#569cd6"
}
...
...
@@ -271,8 +296,10 @@
}
},
{
"name"
:
"coloring of the PHP start and end tag (<?php and ?>)"
,
"scope"
:
[
"punctuation.section.embedded.begin.metatag.php"
,
"punctuation.section.embedded.end.metatag.php"
],
"scope"
:
[
"punctuation.section.embedded.metatag.begin.php"
,
"punctuation.section.embedded.metatag.end.php"
],
"settings"
:
{
"foreground"
:
"#569cd6"
}
...
...
extensions/theme-defaults/themes/hc_black.json
浏览文件 @
8998f7a5
{
"name"
:
"Dark Visual Studio"
,
"settings"
:
[
{
"settings"
:
{
"foreground"
:
"#FFFFFF"
,
"background"
:
"#000000"
}
},
{
"scope"
:
"emphasis"
,
"settings"
:
{
...
...
@@ -14,7 +20,7 @@
}
},
{
"scope"
:
"header"
,
"scope"
:
"
meta.diff.
header"
,
"settings"
:
{
"foreground"
:
"#000080"
}
...
...
@@ -45,7 +51,11 @@
}
},
{
"scope"
:
"constant.rgb-value"
,
"scope"
:
[
"constant.other.color.rgb-value.css"
,
"constant.numeric.color.rgb-value.scss"
,
"constant.other.rgb-value.css"
],
"settings"
:
{
"foreground"
:
"#d4d4d4"
}
...
...
@@ -57,7 +67,7 @@
}
},
{
"scope"
:
"entity.name.
selector
"
,
"scope"
:
"entity.name.
tag.css
"
,
"settings"
:
{
"foreground"
:
"#d7ba7d"
}
...
...
@@ -69,7 +79,19 @@
}
},
{
"scope"
:
"entity.other.attribute-name.css"
,
"scope"
:
[
"entity.other.attribute-name.class.css"
,
"entity.other.attribute-name.class.mixin.css"
,
"entity.other.attribute-name.id.css"
,
"entity.other.attribute-name.parent-selector.css"
,
"entity.other.attribute-name.pseudo-class.css"
,
"entity.other.attribute-name.pseudo-element.css"
,
"source.css.less entity.other.attribute-name.id"
,
"entity.other.attribute-name.attribute.scss"
,
"entity.other.attribute-name.scss"
],
"settings"
:
{
"foreground"
:
"#d7ba7d"
}
...
...
@@ -130,7 +152,9 @@
},
{
"name"
:
"brackets of XML/HTML tags"
,
"scope"
:
"punctuation.definition.tag"
,
"scope"
:
[
"punctuation.definition.tag"
],
"settings"
:
{
"foreground"
:
"#808080"
}
...
...
@@ -203,7 +227,10 @@
},
{
"name"
:
"JavaScript string interpolation ${}"
,
"scope"
:
"string.template-expression"
,
"scope"
:
[
"punctuation.definition.template-expression.begin.ts"
,
"punctuation.definition.template-expression.end.ts"
],
"settings"
:
{
"foreground"
:
"#569cd6"
}
...
...
@@ -265,7 +292,7 @@
},
{
"name"
:
"coloring of the TS this"
,
"scope"
:
"variable.this"
,
"scope"
:
"variable.
language.
this"
,
"settings"
:
{
"foreground"
:
"#569cd6"
}
...
...
extensions/theme-defaults/themes/light_plus.json
浏览文件 @
8998f7a5
...
...
@@ -19,9 +19,28 @@
"support.class"
,
"support.type"
,
"entity.name.type"
,
"entity.name.class"
,
"storage.type.cs"
,
"storage.type.generic.cs"
,
"storage.type.modifier.cs"
,
"storage.type.variable.cs"
,
"storage.type.annotation.java"
,
"storage.type.generic.java"
,
"storage.type.java"
,
"entity.other.inherited-class"
"storage.type.object.array.java"
,
"storage.type.primitive.array.java"
,
"storage.type.primitive.java"
,
"storage.type.token.java"
,
"storage.type.groovy"
,
"storage.type.annotation.groovy"
,
"storage.type.parameters.groovy"
,
"storage.type.generic.groovy"
,
"storage.type.object.array.groovy"
,
"storage.type.primitive.array.groovy"
,
"storage.type.primitive.groovy"
],
"settings"
:
{
"foreground"
:
"#267f99"
...
...
@@ -51,9 +70,8 @@
{
"name"
:
"Variable and parameter name"
,
"scope"
:
[
"variable.parameter"
,
"variable"
,
"variable.name"
,
"
meta.definition.
variable.name"
,
"support.variable"
],
"settings"
:
{
...
...
@@ -61,8 +79,11 @@
}
},
{
"name"
:
"Object keys, TS gammar specific"
,
"scope"
:
"object-literal.member.key"
,
"name"
:
"Object keys, TS grammar specific"
,
"scope"
:
[
"meta.object-literal.key"
,
"meta.object-literal.key entity.name.function"
],
"settings"
:
{
"foreground"
:
"#001080"
}
...
...
@@ -70,21 +91,19 @@
{
"name"
:
"CSS property value"
,
"scope"
:
[
"support.property-value"
,
"constant.rgb-value"
,
"support.property-value.scss"
,
"constant.rgb-value.scss"
"constant.other.color.rgb-value.css"
,
"constant.other.rgb-value.css"
,
"meta.property-value.css support.function"
,
"meta.property-value.css support"
,
"constant.numeric.color.rgb-value.scss"
,
"constant.rgb-value.scss"
,
"meta.property-value.scss support.function"
,
"meta.property-value.scss support"
],
"settings"
:
{
"foreground"
:
"#0451a5"
}
},
{
"name"
:
"JSX Tag names, workaround for flattening match with function"
,
"scope"
:
"entity.name.function.tag"
,
"settings"
:
{
"foreground"
:
"#800000"
}
}
]
}
\ No newline at end of file
extensions/theme-defaults/themes/light_vs.json
浏览文件 @
8998f7a5
...
...
@@ -14,7 +14,7 @@
}
},
{
"scope"
:
"header"
,
"scope"
:
"
meta.diff.
header"
,
"settings"
:
{
"foreground"
:
"#000080"
}
...
...
@@ -46,7 +46,11 @@
}
},
{
"scope"
:
"constant.rgb-value"
,
"scope"
:
[
"constant.other.color.rgb-value.css"
,
"constant.numeric.color.rgb-value.scss"
,
"constant.other.rgb-value.css"
],
"settings"
:
{
"foreground"
:
"#0451a5"
}
...
...
@@ -71,7 +75,19 @@
}
},
{
"scope"
:
[
"entity.other.attribute-name.css"
,
"entity.other.attribute-name.scss"
],
"scope"
:
[
"entity.other.attribute-name.class.css"
,
"entity.other.attribute-name.class.mixin.css"
,
"entity.other.attribute-name.id.css"
,
"entity.other.attribute-name.parent-selector.css"
,
"entity.other.attribute-name.pseudo-class.css"
,
"entity.other.attribute-name.pseudo-element.css"
,
"source.css.less entity.other.attribute-name.id"
,
"entity.other.attribute-name.attribute.scss"
,
"entity.other.attribute-name.scss"
],
"settings"
:
{
"foreground"
:
"#800000"
}
...
...
@@ -128,7 +144,10 @@
}
},
{
"scope"
:
[
"markup.punctuation.quote.beginning"
,
"markup.punctuation.list.beginning"
],
"scope"
:
[
"beginning.punctuation.definition.quote.markdown"
,
"beginning.punctuation.definition.list.markdown"
],
"settings"
:
{
"foreground"
:
"#0451a5"
}
...
...
@@ -201,7 +220,28 @@
}
},
{
"scope"
:
[
"string.xml"
,
"string.jade"
,
"string.yaml"
,
"string.html"
],
"scope"
:
[
"string.comment.buffered.block.jade"
,
"string.quoted.jade"
,
"string.interpolated.jade"
,
"string.unquoted.plain.in.yaml"
,
"string.unquoted.plain.out.yaml"
,
"string.unquoted.block.yaml"
,
"string.quoted.single.yaml"
,
"string.quoted.double.xml"
,
"string.quoted.single.xml"
,
"string.unquoted.cdata.xml"
,
"string.quoted.double.html"
,
"string.quoted.single.html"
,
"string.unquoted.html"
,
"string.quoted.single.handlebars"
,
"string.quoted.double.handlebars"
],
"settings"
:
{
"foreground"
:
"#0000ff"
}
...
...
@@ -214,19 +254,32 @@
},
{
"name"
:
"JavaScript string interpolation ${}"
,
"scope"
:
"string.template-expression"
,
"scope"
:
[
"punctuation.definition.template-expression.begin.ts"
,
"punctuation.definition.template-expression.end.ts"
],
"settings"
:
{
"foreground"
:
"#0000ff"
}
},
{
"scope"
:
"support.property-value"
,
"scope"
:
[
"support.property-value"
,
"meta.property-value.css support"
,
"meta.property-value.scss support"
],
"settings"
:
{
"foreground"
:
"#0451a5"
}
},
{
"scope"
:
[
"support.type.property-name.css"
,
"support.type.property-name.less"
,
"support.type.property-name.scss"
],
"scope"
:
[
"support.type.property-name.css"
,
"support.type.property-name.variable.css"
,
"support.type.property-name.media.css"
,
"support.type.property-name.less"
,
"support.type.property-name.scss"
],
"settings"
:
{
"foreground"
:
"#ff0000"
}
...
...
@@ -268,8 +321,10 @@
}
},
{
"name"
:
"coloring of the PHP start and end tag (<?php and ?>)"
,
"scope"
:
[
"punctuation.section.embedded.begin.metatag.php"
,
"punctuation.section.embedded.end.metatag.php"
],
"scope"
:
[
"punctuation.section.embedded.metatag.begin.php"
,
"punctuation.section.embedded.metatag.end.php"
],
"settings"
:
{
"foreground"
:
"#800000"
}
...
...
src/vs/editor/node/textMate/TMSyntax.ts
浏览文件 @
8998f7a5
...
...
@@ -15,10 +15,11 @@ import { ILineTokens, ITokenizationSupport, TokenizationRegistry } from 'vs/edit
import
{
TMState
}
from
'
vs/editor/node/textMate/TMState
'
;
import
{
RawLineTokens
}
from
'
vs/editor/common/modes/supports
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IGrammar
,
Registry
,
StackElement
,
IToken
}
from
'
vscode-textmate
'
;
import
{
IGrammar
,
Registry
,
StackElement
,
IToken
,
IEmbeddedLanguagesMap
as
IEmbeddedLanguagesMap2
}
from
'
vscode-textmate
'
;
import
{
ModeTransition
}
from
'
vs/editor/common/core/modeTransition
'
;
import
{
Token
}
from
'
vs/editor/common/core/token
'
;
import
{
languagesExtPoint
}
from
'
vs/editor/common/services/modeServiceImpl
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
export
interface
IEmbeddedLanguagesMap
{
[
scopeName
:
string
]:
string
;
...
...
@@ -110,9 +111,9 @@ export class TMLanguageRegistration {
readonly
scopeName
:
string
;
readonly
grammarFilePath
:
string
;
readonly
embeddedLanguages
:
IEmbeddedLanguagesMap
;
private
readonly
_registry
:
TMScopeRegistry
;
private
readonly
_embeddedLanguages
:
IEmbeddedLanguagesMap
;
private
readonly
_embeddedLanguagesRegex
:
RegExp
;
constructor
(
registry
:
TMScopeRegistry
,
scopeName
:
string
,
grammarFilePath
:
string
,
embeddedLanguages
:
IEmbeddedLanguagesMap
)
{
...
...
@@ -121,7 +122,7 @@ export class TMLanguageRegistration {
this
.
grammarFilePath
=
grammarFilePath
;
// embeddedLanguages handling
this
.
_
embeddedLanguages
=
Object
.
create
(
null
);
this
.
embeddedLanguages
=
Object
.
create
(
null
);
if
(
embeddedLanguages
)
{
// If embeddedLanguages are configured, fill in `this._embeddedLanguages`
...
...
@@ -133,12 +134,12 @@ export class TMLanguageRegistration {
// never hurts to be too careful
continue
;
}
this
.
_
embeddedLanguages
[
scope
]
=
language
;
this
.
embeddedLanguages
[
scope
]
=
language
;
}
}
// create the regex
let
escapedScopes
=
Object
.
keys
(
this
.
_
embeddedLanguages
).
map
((
scopeName
)
=>
strings
.
escapeRegExpCharacters
(
scopeName
));
let
escapedScopes
=
Object
.
keys
(
this
.
embeddedLanguages
).
map
((
scopeName
)
=>
strings
.
escapeRegExpCharacters
(
scopeName
));
if
(
escapedScopes
.
length
===
0
)
{
// no scopes registered
this
.
_embeddedLanguagesRegex
=
null
;
...
...
@@ -167,7 +168,7 @@ export class TMLanguageRegistration {
return
null
;
}
let
language
=
this
.
_
embeddedLanguages
[
m
[
1
]]
||
null
;
let
language
=
this
.
embeddedLanguages
[
m
[
1
]]
||
null
;
if
(
!
language
)
{
return
null
;
}
...
...
@@ -177,18 +178,31 @@ export class TMLanguageRegistration {
}
}
function
createStyleSheet
():
HTMLStyleElement
{
let
style
=
document
.
createElement
(
'
style
'
);
style
.
type
=
'
text/css
'
;
style
.
media
=
'
screen
'
;
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
style
);
return
style
;
}
export
class
MainProcessTextMateSyntax
{
private
_grammarRegistry
:
Registry
;
private
_modeService
:
IModeService
;
private
_themeService
:
IThemeService
;
private
_scopeRegistry
:
TMScopeRegistry
;
private
_injections
:
{
[
scopeName
:
string
]:
string
[];
};
private
_styleElement
:
HTMLStyleElement
;
public
onDidEncounterLanguage
:
Event
<
string
>
;
constructor
(
@
IModeService
modeService
:
IModeService
@
IModeService
modeService
:
IModeService
,
@
IThemeService
themeService
:
IThemeService
)
{
this
.
_styleElement
=
createStyleSheet
();
this
.
_modeService
=
modeService
;
this
.
_themeService
=
themeService
;
this
.
_scopeRegistry
=
new
TMScopeRegistry
();
this
.
onDidEncounterLanguage
=
this
.
_scopeRegistry
.
onDidEncounterLanguage
;
this
.
_injections
=
{};
...
...
@@ -201,6 +215,8 @@ export class MainProcessTextMateSyntax {
return
this
.
_injections
[
scopeName
];
}
});
this
.
_updateTheme
();
this
.
_themeService
.
onDidColorThemeChange
((
e
)
=>
this
.
_updateTheme
());
grammarsExtPoint
.
setHandler
((
extensions
)
=>
{
for
(
let
i
=
0
;
i
<
extensions
.
length
;
i
++
)
{
...
...
@@ -212,6 +228,26 @@ export class MainProcessTextMateSyntax {
});
}
private
static
_generateCSS
(
colorMap
:
string
[]):
string
{
let
rules
:
string
[]
=
[];
for
(
let
i
=
1
,
len
=
colorMap
.
length
;
i
<
len
;
i
++
)
{
let
color
=
colorMap
[
i
];
rules
[
i
]
=
`.mtk
${
i
}
{ color:
${
color
.
substr
(
0
,
7
)}
; }`
;
}
rules
.
push
(
'
.mtki { font-style: italic; }
'
);
rules
.
push
(
'
.mtkb { font-weight: bold; }
'
);
rules
.
push
(
'
.mtku { text-decoration: underline; }
'
);
return
rules
.
join
(
'
\n
'
);
}
private
_updateTheme
():
void
{
this
.
_grammarRegistry
.
setTheme
(
this
.
_themeService
.
getColorThemeDocument
());
let
colorMap
=
this
.
_grammarRegistry
.
getColorMap
();
let
cssRules
=
MainProcessTextMateSyntax
.
_generateCSS
(
colorMap
);
this
.
_styleElement
.
innerHTML
=
cssRules
;
TokenizationRegistry
.
setColorMap
(
colorMap
);
}
private
_handleGrammarExtensionPointUser
(
extensionFolderPath
:
string
,
syntax
:
ITMSyntaxExtensionPoint
,
collector
:
ExtensionMessageCollector
):
void
{
if
(
syntax
.
language
&&
((
typeof
syntax
.
language
!==
'
string
'
)
||
!
this
.
_modeService
.
isRegisteredMode
(
syntax
.
language
)))
{
collector
.
error
(
nls
.
localize
(
'
invalid.language
'
,
"
Unknown language in `contributes.{0}.language`. Provided value: {1}
"
,
grammarsExtPoint
.
name
,
String
(
syntax
.
language
)));
...
...
@@ -264,8 +300,26 @@ export class MainProcessTextMateSyntax {
}
}
private
_resolveEmbeddedLanguages
(
embeddedLanguages
:
IEmbeddedLanguagesMap
):
IEmbeddedLanguagesMap2
{
let
scopes
=
Object
.
keys
(
embeddedLanguages
);
let
result
:
IEmbeddedLanguagesMap2
=
Object
.
create
(
null
);
for
(
let
i
=
0
,
len
=
scopes
.
length
;
i
<
len
;
i
++
)
{
let
scope
=
scopes
[
i
];
let
language
=
embeddedLanguages
[
scope
];
let
languageIdentifier
=
this
.
_modeService
.
getLanguageIdentifier
(
language
);
if
(
languageIdentifier
)
{
result
[
scope
]
=
languageIdentifier
.
iid
;
}
}
return
result
;
}
private
registerDefinition
(
modeId
:
string
,
scopeName
:
string
):
void
{
this
.
_grammarRegistry
.
loadGrammar
(
scopeName
,
(
err
,
grammar
)
=>
{
let
languageRegistration
=
this
.
_scopeRegistry
.
getLanguageRegistration
(
scopeName
);
let
embeddedLanguages
=
this
.
_resolveEmbeddedLanguages
(
languageRegistration
.
embeddedLanguages
);
let
languageId
=
this
.
_modeService
.
getLanguageIdentifier
(
modeId
).
iid
;
this
.
_grammarRegistry
.
loadGrammarWithEmbeddedLanguages
(
scopeName
,
languageId
,
embeddedLanguages
,
(
err
,
grammar
)
=>
{
if
(
err
)
{
onUnexpectedError
(
err
);
return
;
...
...
@@ -282,9 +336,25 @@ function createTokenizationSupport(languageRegistration: TMLanguageRegistration,
return
{
getInitialState
:
()
=>
new
TMState
(
null
),
tokenize
:
(
line
,
state
,
offsetDelta
)
=>
tokenizer
.
tokenize
(
line
,
<
TMState
>
state
,
offsetDelta
),
tokenize3
:
()
=>
{
// TODO@tokenization
throw
new
Error
(
'
TODO@tokenization
'
);
tokenize3
:
(
line
:
string
,
state
:
TMState
,
offsetDelta
:
number
)
=>
{
if
(
offsetDelta
!==
0
)
{
throw
new
Error
(
'
Unexpected: offsetDelta should be 0.
'
);
}
let
textMateResult
=
grammar
.
tokenizeLine2
(
line
,
state
.
ruleStack
);
let
endState
:
TMState
;
// try to save an object if possible
if
(
state
.
ruleStack
!==
null
&&
textMateResult
.
ruleStack
.
equals
(
state
.
ruleStack
))
{
endState
=
state
;
}
else
{
endState
=
new
TMState
(
textMateResult
.
ruleStack
);
}
return
{
tokens
:
textMateResult
.
tokens
,
endState
:
endState
};
}
};
}
...
...
src/vs/workbench/services/themes/common/themeService.ts
浏览文件 @
8998f7a5
...
...
@@ -18,6 +18,7 @@ export interface IThemeService {
_serviceBrand
:
any
;
setColorTheme
(
themeId
:
string
,
broadcastToAllWindows
:
boolean
):
TPromise
<
boolean
>
;
getColorTheme
():
string
;
getColorThemeDocument
():
IThemeDocument
;
getColorThemes
():
TPromise
<
IThemeData
[]
>
;
onDidColorThemeChange
:
Event
<
string
>
;
...
...
src/vs/workbench/services/themes/electron-browser/themeService.ts
浏览文件 @
8998f7a5
...
...
@@ -103,6 +103,7 @@ let iconThemeExtPoint = ExtensionsRegistry.registerExtensionPoint<IThemeExtensio
interface
IInternalThemeData
extends
IThemeData
{
styleSheetContent
?:
string
;
document
?:
IThemeDocument
;
extensionId
:
string
;
extensionPublisher
:
string
;
extensionName
:
string
;
...
...
@@ -155,6 +156,7 @@ export class ThemeService implements IThemeService {
private
knownColorThemes
:
IInternalThemeData
[];
private
currentColorTheme
:
string
;
private
currentColorThemeDocument
:
IThemeDocument
;
private
container
:
HTMLElement
;
private
onColorThemeChange
:
Emitter
<
string
>
;
...
...
@@ -168,6 +170,7 @@ export class ThemeService implements IThemeService {
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
this
.
knownColorThemes
=
[];
this
.
currentColorThemeDocument
=
null
;
this
.
onColorThemeChange
=
new
Emitter
<
string
>
();
this
.
knownIconThemes
=
[];
this
.
currentIconTheme
=
''
;
...
...
@@ -258,6 +261,7 @@ export class ThemeService implements IThemeService {
}
else
{
this
.
sendTelemetry
(
newTheme
);
}
this
.
currentColorThemeDocument
=
newTheme
.
document
;
this
.
onColorThemeChange
.
fire
(
newThemeId
);
};
...
...
@@ -268,6 +272,10 @@ export class ThemeService implements IThemeService {
return
this
.
currentColorTheme
||
this
.
storageService
.
get
(
COLOR_THEME_PREF
,
StorageScope
.
GLOBAL
,
DEFAULT_THEME_ID
);
}
public
getColorThemeDocument
():
IThemeDocument
{
return
this
.
currentColorThemeDocument
;
}
private
findThemeData
(
themeId
:
string
,
defaultId
?:
string
):
TPromise
<
IInternalThemeData
>
{
return
this
.
getColorThemes
().
then
(
allThemes
=>
{
let
themes
=
allThemes
.
filter
(
t
=>
t
.
id
===
themeId
);
...
...
@@ -641,6 +649,7 @@ function applyTheme(theme: IInternalThemeData, onApply: (theme: IInternalThemeDa
return
TPromise
.
as
(
true
);
}
return
_loadThemeDocument
(
theme
.
path
).
then
(
themeDocument
=>
{
theme
.
document
=
themeDocument
;
let
styleSheetContent
=
_processThemeObject
(
theme
.
id
,
themeDocument
);
theme
.
styleSheetContent
=
styleSheetContent
;
_applyRules
(
styleSheetContent
,
colorThemeRulesClassName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录