Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b2aa3084
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,发现更多精彩内容 >>
提交
b2aa3084
编写于
1月 23, 2017
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[1.9.0-insider] text/x-code-output no longer works to identify identify output. Fixes #18839
上级
130a534c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
6 deletion
+29
-6
src/vs/workbench/services/themes/electron-browser/themeService.ts
...orkbench/services/themes/electron-browser/themeService.ts
+29
-6
未找到文件。
src/vs/workbench/services/themes/electron-browser/themeService.ts
浏览文件 @
b2aa3084
...
@@ -173,6 +173,27 @@ const noFileIconTheme: IFileIconTheme = {
...
@@ -173,6 +173,27 @@ const noFileIconTheme: IFileIconTheme = {
isLoaded
:
true
isLoaded
:
true
};
};
let
defaultThemeColors
:
{
[
baseTheme
:
string
]:
IThemeSetting
[]
}
=
{
'
vs
'
:
[
{
scope
:
'
token.info-token
'
,
settings
:
{
foreground
:
'
#316bcd
'
}
},
{
scope
:
'
token.warn-token
'
,
settings
:
{
foreground
:
'
#cd9731
'
}
},
{
scope
:
'
token.error-token
'
,
settings
:
{
foreground
:
'
#cd3131
'
}
},
{
scope
:
'
token.debug-token
'
,
settings
:
{
foreground
:
'
purple
'
}
}
],
'
vs-dark
'
:
[
{
scope
:
'
token.info-token
'
,
settings
:
{
foreground
:
'
#6796e6
'
}
},
{
scope
:
'
token.warn-token
'
,
settings
:
{
foreground
:
'
#cd9731
'
}
},
{
scope
:
'
token.error-token
'
,
settings
:
{
foreground
:
'
#f44747
'
}
},
{
scope
:
'
token.debug-token
'
,
settings
:
{
foreground
:
'
#b267e6
'
}
}
],
'
hc-black
'
:
[
{
scope
:
'
token.info-token
'
,
settings
:
{
foreground
:
'
#6796e6
'
}
},
{
scope
:
'
token.warn-token
'
,
settings
:
{
foreground
:
'
#008000
'
}
},
{
scope
:
'
token.error-token
'
,
settings
:
{
foreground
:
'
#FF0000
'
}
},
{
scope
:
'
token.debug-token
'
,
settings
:
{
foreground
:
'
#b267e6
'
}
}
],
};
export
class
ThemeService
implements
IThemeService
{
export
class
ThemeService
implements
IThemeService
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
...
@@ -700,7 +721,7 @@ function applyTheme(theme: IInternalColorThemeData, onApply: (theme: IInternalCo
...
@@ -700,7 +721,7 @@ function applyTheme(theme: IInternalColorThemeData, onApply: (theme: IInternalCo
_applyRules
(
theme
.
styleSheetContent
,
colorThemeRulesClassName
);
_applyRules
(
theme
.
styleSheetContent
,
colorThemeRulesClassName
);
return
TPromise
.
as
(
onApply
(
theme
));
return
TPromise
.
as
(
onApply
(
theme
));
}
}
return
_loadThemeDocument
(
theme
.
path
).
then
(
themeSettings
=>
{
return
_loadThemeDocument
(
getBaseThemeId
(
theme
.
id
),
theme
.
path
).
then
(
themeSettings
=>
{
theme
.
settings
=
themeSettings
;
theme
.
settings
=
themeSettings
;
let
styleSheetContent
=
_processThemeObject
(
theme
.
id
,
themeSettings
);
let
styleSheetContent
=
_processThemeObject
(
theme
.
id
,
themeSettings
);
theme
.
styleSheetContent
=
styleSheetContent
;
theme
.
styleSheetContent
=
styleSheetContent
;
...
@@ -712,20 +733,21 @@ function applyTheme(theme: IInternalColorThemeData, onApply: (theme: IInternalCo
...
@@ -712,20 +733,21 @@ function applyTheme(theme: IInternalColorThemeData, onApply: (theme: IInternalCo
});
});
}
}
function
_loadThemeDocument
(
themePath
:
string
):
TPromise
<
IThemeSetting
[]
>
{
function
_loadThemeDocument
(
baseTheme
:
string
,
themePath
:
string
):
TPromise
<
IThemeSetting
[]
>
{
return
pfs
.
readFile
(
themePath
).
then
(
content
=>
{
return
pfs
.
readFile
(
themePath
).
then
(
content
=>
{
let
allSettings
=
defaultThemeColors
[
baseTheme
]
||
[];
if
(
Paths
.
extname
(
themePath
)
===
'
.json
'
)
{
if
(
Paths
.
extname
(
themePath
)
===
'
.json
'
)
{
let
errors
:
Json
.
ParseError
[]
=
[];
let
errors
:
Json
.
ParseError
[]
=
[];
let
contentValue
=
Json
.
parse
(
content
.
toString
(),
errors
);
let
contentValue
=
Json
.
parse
(
content
.
toString
(),
errors
);
if
(
errors
.
length
>
0
)
{
if
(
errors
.
length
>
0
)
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.cannotparsejson
'
,
"
Problems parsing JSON theme file: {0}
"
,
errors
.
map
(
e
=>
Json
.
getParseErrorMessage
(
e
.
error
)).
join
(
'
,
'
))));
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.cannotparsejson
'
,
"
Problems parsing JSON theme file: {0}
"
,
errors
.
map
(
e
=>
Json
.
getParseErrorMessage
(
e
.
error
)).
join
(
'
,
'
))));
}
}
let
allSettings
:
IThemeSetting
[]
=
contentValue
.
settings
;
if
(
!
Array
.
isArray
(
contentValue
.
settings
))
{
if
(
!
Array
.
isArray
(
allSettings
))
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.invalidformat
'
,
"
Problem parsing JSON theme file: {0}. 'settings' is not array.
"
)));
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.invalidformat
'
,
"
Problem parsing JSON theme file: {0}. 'settings' is not array.
"
)));
}
}
allSettings
=
allSettings
.
concat
(
contentValue
.
settings
);
// will clone
if
(
contentValue
.
include
)
{
if
(
contentValue
.
include
)
{
return
_loadThemeDocument
(
Paths
.
join
(
Paths
.
dirname
(
themePath
),
contentValue
.
include
)).
then
(
settings
=>
{
return
_loadThemeDocument
(
baseTheme
,
Paths
.
join
(
Paths
.
dirname
(
themePath
),
contentValue
.
include
)).
then
(
settings
=>
{
allSettings
=
settings
.
concat
(
allSettings
);
allSettings
=
settings
.
concat
(
allSettings
);
return
TPromise
.
as
(
allSettings
);
return
TPromise
.
as
(
allSettings
);
});
});
...
@@ -738,7 +760,8 @@ function _loadThemeDocument(themePath: string): TPromise<IThemeSetting[]> {
...
@@ -738,7 +760,8 @@ function _loadThemeDocument(themePath: string): TPromise<IThemeSetting[]> {
if
(
!
Array
.
isArray
(
settings
))
{
if
(
!
Array
.
isArray
(
settings
))
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.plist.invalidformat
'
,
"
Problem parsing theme file: {0}. 'settings' is not array.
"
)));
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.plist.invalidformat
'
,
"
Problem parsing theme file: {0}. 'settings' is not array.
"
)));
}
}
return
TPromise
.
as
(
settings
);
allSettings
=
allSettings
.
concat
(
settings
);
// will clone
return
TPromise
.
as
(
allSettings
);
}
catch
(
e
)
{
}
catch
(
e
)
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.cannotparse
'
,
"
Problems parsing theme file: {0}
"
,
e
.
message
)));
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
error.cannotparse
'
,
"
Problems parsing theme file: {0}
"
,
e
.
message
)));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录