Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
14b7df48
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 搜索 >>
提交
14b7df48
编写于
12月 14, 2020
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not restore default theme
上级
4d019515
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
7 deletion
+18
-7
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
...orkbench/services/themes/browser/workbenchThemeService.ts
+2
-2
src/vs/workbench/services/themes/common/colorThemeData.ts
src/vs/workbench/services/themes/common/colorThemeData.ts
+11
-5
src/vs/workbench/services/themes/common/themeConfiguration.ts
...vs/workbench/services/themes/common/themeConfiguration.ts
+5
-0
未找到文件。
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
浏览文件 @
14b7df48
...
...
@@ -139,7 +139,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
// In order to avoid paint flashing for tokens, because
// themes are loaded asynchronously, we need to initialize
// a color theme document with good defaults until the theme is loaded
let
themeData
:
ColorThemeData
|
undefined
=
ColorThemeData
.
fromStorageData
(
this
.
storageService
);
let
themeData
:
ColorThemeData
|
undefined
=
ColorThemeData
.
fromStorageData
(
this
.
storageService
,
isWeb
);
// the preferred color scheme (high contrast, light, dark) has changed since the last start
const
preferredColorScheme
=
this
.
getPreferredColorScheme
();
...
...
@@ -496,7 +496,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
// remember theme data for a quick restore
if
(
newTheme
.
isLoaded
)
{
newTheme
.
toStorage
(
this
.
storageService
);
newTheme
.
toStorage
(
this
.
storageService
,
this
.
settings
.
isDefaultColorTheme
(
newTheme
)
);
}
return
this
.
settings
.
setColorTheme
(
this
.
currentColorTheme
,
settingsTarget
);
...
...
src/vs/workbench/services/themes/common/colorThemeData.ts
浏览文件 @
14b7df48
...
...
@@ -505,7 +505,7 @@ export class ColorThemeData implements IWorkbenchColorTheme {
this
.
customTokenScopeMatchers
=
undefined
;
}
toStorage
(
storageService
:
IStorageService
)
{
toStorage
(
storageService
:
IStorageService
,
isDefaultTheme
:
boolean
)
{
let
colorMapData
:
{
[
key
:
string
]:
string
}
=
{};
for
(
let
key
in
this
.
colorMap
)
{
colorMapData
[
key
]
=
Color
.
Format
.
CSS
.
formatHexA
(
this
.
colorMap
[
key
],
true
);
...
...
@@ -515,12 +515,13 @@ export class ColorThemeData implements IWorkbenchColorTheme {
id
:
this
.
id
,
label
:
this
.
label
,
settingsId
:
this
.
settingsId
,
themeTokenColors
:
this
.
themeTokenColors
.
map
(
tc
=>
({
settings
:
tc
.
settings
,
scope
:
tc
.
scope
})),
// don't pesist names
themeTokenColors
:
this
.
themeTokenColors
.
map
(
tc
=>
({
settings
:
tc
.
settings
,
scope
:
tc
.
scope
})),
// don't pe
r
sist names
semanticTokenRules
:
this
.
semanticTokenRules
.
map
(
SemanticTokenRule
.
toJSONObject
),
extensionData
:
ExtensionData
.
toJSONObject
(
this
.
extensionData
),
themeSemanticHighlighting
:
this
.
themeSemanticHighlighting
,
colorMap
:
colorMapData
,
watch
:
this
.
watch
watch
:
this
.
watch
,
isDefaultTheme
});
// roam persisted color theme colors. Don't enable for icons as they contain references to fonts and images.
...
...
@@ -570,12 +571,14 @@ export class ColorThemeData implements IWorkbenchColorTheme {
return
themeData
;
}
static
fromStorageData
(
storageService
:
IStorageService
):
ColorThemeData
|
undefined
{
static
fromStorageData
(
storageService
:
IStorageService
,
doNotRestoreDefaultTheme
:
boolean
):
ColorThemeData
|
undefined
{
const
input
=
storageService
.
get
(
ColorThemeData
.
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
if
(
!
input
)
{
return
undefined
;
}
try
{
let
isDefaultTheme
=
false
;
let
data
=
JSON
.
parse
(
input
);
let
theme
=
new
ColorThemeData
(
''
,
''
,
''
);
for
(
let
key
in
data
)
{
...
...
@@ -607,9 +610,12 @@ export class ColorThemeData implements IWorkbenchColorTheme {
case
'
extensionData
'
:
theme
.
extensionData
=
ExtensionData
.
fromJSONObject
(
data
.
extensionData
);
break
;
case
'
isDefaultTheme
'
:
isDefaultTheme
=
data
.
isDefaultTheme
;
break
;
}
}
if
(
!
theme
.
id
||
!
theme
.
settingsId
)
{
if
(
!
theme
.
id
||
!
theme
.
settingsId
||
doNotRestoreDefaultTheme
&&
isDefaultTheme
)
{
return
undefined
;
}
return
theme
;
...
...
src/vs/workbench/services/themes/common/themeConfiguration.ts
浏览文件 @
14b7df48
...
...
@@ -308,6 +308,11 @@ export class ThemeConfiguration {
return
theme
;
}
public
isDefaultColorTheme
(
theme
:
IWorkbenchColorTheme
):
boolean
{
let
settings
=
this
.
configurationService
.
inspect
(
ThemeSettings
.
COLOR_THEME
);
return
settings
&&
settings
.
default
?.
value
===
theme
.
settingsId
;
}
public
findAutoConfigurationTarget
(
key
:
string
)
{
let
settings
=
this
.
configurationService
.
inspect
(
key
);
if
(
!
types
.
isUndefined
(
settings
.
workspaceFolderValue
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录