Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
426214a2
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,发现更多精彩内容 >>
提交
426214a2
编写于
10月 22, 2020
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync persisted color theme data
上级
114c7eab
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
17 deletion
+24
-17
src/vs/workbench/services/themes/browser/fileIconThemeData.ts
...vs/workbench/services/themes/browser/fileIconThemeData.ts
+6
-6
src/vs/workbench/services/themes/browser/productIconThemeData.ts
...workbench/services/themes/browser/productIconThemeData.ts
+6
-6
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
...orkbench/services/themes/browser/workbenchThemeService.ts
+5
-0
src/vs/workbench/services/themes/common/colorThemeData.ts
src/vs/workbench/services/themes/common/colorThemeData.ts
+7
-5
未找到文件。
src/vs/workbench/services/themes/browser/fileIconThemeData.ts
浏览文件 @
426214a2
...
...
@@ -14,9 +14,10 @@ import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages';
import
{
asCSSUrl
}
from
'
vs/base/browser/dom
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
const
PERSISTED_FILE_ICON_THEME_STORAGE_KEY
=
'
iconThemeData
'
;
export
class
FileIconThemeData
implements
IWorkbenchFileIconTheme
{
static
readonly
STORAGE_KEY
=
'
iconThemeData
'
;
id
:
string
;
label
:
string
;
settingsId
:
string
|
null
;
...
...
@@ -108,7 +109,7 @@ export class FileIconThemeData implements IWorkbenchFileIconTheme {
static
fromStorageData
(
storageService
:
IStorageService
):
FileIconThemeData
|
undefined
{
const
input
=
storageService
.
get
(
PERSISTED_FILE_ICON_THEME_
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
const
input
=
storageService
.
get
(
FileIconThemeData
.
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
if
(
!
input
)
{
return
undefined
;
}
...
...
@@ -129,7 +130,7 @@ export class FileIconThemeData implements IWorkbenchFileIconTheme {
(
theme
as
any
)[
key
]
=
data
[
key
];
break
;
case
'
location
'
:
theme
.
location
=
URI
.
revive
(
data
.
location
);
// ignore, no longer restore
break
;
case
'
extensionData
'
:
theme
.
extensionData
=
ExtensionData
.
fromJSONObject
(
data
.
extensionData
);
...
...
@@ -148,7 +149,6 @@ export class FileIconThemeData implements IWorkbenchFileIconTheme {
label
:
this
.
label
,
description
:
this
.
description
,
settingsId
:
this
.
settingsId
,
location
:
this
.
location
?.
toJSON
(),
styleSheetContent
:
this
.
styleSheetContent
,
hasFileIcons
:
this
.
hasFileIcons
,
hasFolderIcons
:
this
.
hasFolderIcons
,
...
...
@@ -156,7 +156,7 @@ export class FileIconThemeData implements IWorkbenchFileIconTheme {
extensionData
:
ExtensionData
.
toJSONObject
(
this
.
extensionData
),
watch
:
this
.
watch
});
storageService
.
store
(
PERSISTED_FILE_ICON_THEME_
STORAGE_KEY
,
data
,
StorageScope
.
GLOBAL
);
storageService
.
store
(
FileIconThemeData
.
STORAGE_KEY
,
data
,
StorageScope
.
GLOBAL
);
}
}
...
...
src/vs/workbench/services/themes/browser/productIconThemeData.ts
浏览文件 @
426214a2
...
...
@@ -20,11 +20,12 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
getIconRegistry
}
from
'
vs/platform/theme/common/iconRegistry
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
const
PERSISTED_PRODUCT_ICON_THEME_STORAGE_KEY
=
'
productIconThemeData
'
;
export
const
DEFAULT_PRODUCT_ICON_THEME_ID
=
''
;
// TODO
export
class
ProductIconThemeData
implements
IWorkbenchProductIconTheme
{
static
readonly
STORAGE_KEY
=
'
productIconThemeData
'
;
id
:
string
;
label
:
string
;
settingsId
:
string
;
...
...
@@ -104,7 +105,7 @@ export class ProductIconThemeData implements IWorkbenchProductIconTheme {
}
static
fromStorageData
(
storageService
:
IStorageService
):
ProductIconThemeData
|
undefined
{
const
input
=
storageService
.
get
(
P
ERSISTED_PRODUCT_ICON_THEME_
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
const
input
=
storageService
.
get
(
P
roductIconThemeData
.
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
if
(
!
input
)
{
return
undefined
;
}
...
...
@@ -122,7 +123,7 @@ export class ProductIconThemeData implements IWorkbenchProductIconTheme {
(
theme
as
any
)[
key
]
=
data
[
key
];
break
;
case
'
location
'
:
theme
.
location
=
URI
.
revive
(
data
.
location
);
// ignore, no longer restore
break
;
case
'
extensionData
'
:
theme
.
extensionData
=
ExtensionData
.
fromJSONObject
(
data
.
extensionData
);
...
...
@@ -141,12 +142,11 @@ export class ProductIconThemeData implements IWorkbenchProductIconTheme {
label
:
this
.
label
,
description
:
this
.
description
,
settingsId
:
this
.
settingsId
,
location
:
this
.
location
?.
toJSON
(),
styleSheetContent
:
this
.
styleSheetContent
,
watch
:
this
.
watch
,
extensionData
:
ExtensionData
.
toJSONObject
(
this
.
extensionData
),
});
storageService
.
store
(
P
ERSISTED_PRODUCT_ICON_THEME_
STORAGE_KEY
,
data
,
StorageScope
.
GLOBAL
);
storageService
.
store
(
P
roductIconThemeData
.
STORAGE_KEY
,
data
,
StorageScope
.
GLOBAL
);
}
}
...
...
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
浏览文件 @
426214a2
...
...
@@ -38,6 +38,7 @@ import { ColorScheme } from 'vs/platform/theme/common/theme';
import
{
IHostColorSchemeService
}
from
'
vs/workbench/services/themes/common/hostColorSchemeService
'
;
import
{
CodiconStyles
}
from
'
vs/base/browser/ui/codicons/codiconStyles
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
IStorageKeysSyncRegistryService
}
from
'
vs/platform/userDataSync/common/storageKeys
'
;
// implementation
...
...
@@ -108,7 +109,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
@
IWorkbenchLayoutService
readonly
layoutService
:
IWorkbenchLayoutService
,
@
ILogService
private
readonly
logService
:
ILogService
,
@
IHostColorSchemeService
private
readonly
hostColorService
:
IHostColorSchemeService
,
@
IStorageKeysSyncRegistryService
storageKeysSyncRegistryService
:
IStorageKeysSyncRegistryService
)
{
// roam persisted color theme colors. Don't enable for icons as they contain references to fonts and images.
storageKeysSyncRegistryService
.
registerStorageKey
({
key
:
ColorThemeData
.
STORAGE_KEY
,
version
:
1
});
this
.
container
=
layoutService
.
container
;
this
.
settings
=
new
ThemeConfiguration
(
configurationService
);
...
...
src/vs/workbench/services/themes/common/colorThemeData.ts
浏览文件 @
426214a2
...
...
@@ -45,10 +45,10 @@ export type TokenStyleDefinitions = { [P in keyof TokenStyleData]?: TokenStyleDe
export
type
TextMateThemingRuleDefinitions
=
{
[
P
in
keyof
TokenStyleData
]?:
ITextMateThemingRule
|
undefined
;
}
&
{
scope
?:
ProbeScope
;
};
const
PERSISTED_THEME_STORAGE_KEY
=
'
colorThemeData
'
;
export
class
ColorThemeData
implements
IWorkbenchColorTheme
{
static
readonly
STORAGE_KEY
=
'
colorThemeData
'
;
id
:
string
;
label
:
string
;
settingsId
:
string
;
...
...
@@ -515,14 +515,16 @@ export class ColorThemeData implements IWorkbenchColorTheme {
id
:
this
.
id
,
label
:
this
.
label
,
settingsId
:
this
.
settingsId
,
themeTokenColors
:
this
.
themeTokenColors
,
themeTokenColors
:
this
.
themeTokenColors
.
map
(
tc
=>
({
settings
:
tc
.
settings
,
scope
:
tc
.
scope
})),
// don't pesist names
semanticTokenRules
:
this
.
semanticTokenRules
.
map
(
SemanticTokenRule
.
toJSONObject
),
extensionData
:
ExtensionData
.
toJSONObject
(
this
.
extensionData
),
themeSemanticHighlighting
:
this
.
themeSemanticHighlighting
,
colorMap
:
colorMapData
,
watch
:
this
.
watch
});
storageService
.
store
(
PERSISTED_THEME_STORAGE_KEY
,
value
,
StorageScope
.
GLOBAL
);
console
.
log
(
`
${
value
.
length
}
+
${
value
}
`
);
storageService
.
store
(
ColorThemeData
.
STORAGE_KEY
,
value
,
StorageScope
.
GLOBAL
);
}
get
baseTheme
():
string
{
...
...
@@ -569,7 +571,7 @@ export class ColorThemeData implements IWorkbenchColorTheme {
}
static
fromStorageData
(
storageService
:
IStorageService
):
ColorThemeData
|
undefined
{
const
input
=
storageService
.
get
(
PERSISTED_THEME_
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
const
input
=
storageService
.
get
(
ColorThemeData
.
STORAGE_KEY
,
StorageScope
.
GLOBAL
);
if
(
!
input
)
{
return
undefined
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录