Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
803ec5b6
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,发现更多精彩内容 >>
提交
803ec5b6
编写于
3月 15, 2017
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
themeservice: remove constructor dependency on IConfigurationEditingService
上级
e2427505
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
22 deletion
+37
-22
src/vs/workbench/services/themes/electron-browser/themeService.ts
...orkbench/services/themes/electron-browser/themeService.ts
+37
-22
未找到文件。
src/vs/workbench/services/themes/electron-browser/themeService.ts
浏览文件 @
803ec5b6
...
@@ -24,6 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
...
@@ -24,6 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
ColorThemeData
}
from
'
./colorThemeData
'
;
import
{
ColorThemeData
}
from
'
./colorThemeData
'
;
import
{
ITheme
,
IThemingParticipant
,
Extensions
as
ThemingExtensions
,
IThemingRegistry
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ITheme
,
IThemingParticipant
,
Extensions
as
ThemingExtensions
,
IThemingRegistry
}
from
'
vs/platform/theme/common/themeService
'
;
...
@@ -186,6 +187,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -186,6 +187,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
private
onFileIconThemeChange
:
Emitter
<
IFileIconTheme
>
;
private
onFileIconThemeChange
:
Emitter
<
IFileIconTheme
>
;
private
themingParticipants
:
IThemingParticipant
[];
private
themingParticipants
:
IThemingParticipant
[];
private
_configurationWriter
:
ConfigurationWriter
;
constructor
(
constructor
(
container
:
HTMLElement
,
container
:
HTMLElement
,
...
@@ -193,10 +195,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -193,10 +195,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
@
IStorageService
private
storageService
:
IStorageService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IWindowIPCService
private
windowService
:
IWindowIPCService
,
@
IWindowIPCService
private
windowService
:
IWindowIPCService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
this
.
container
=
container
;
this
.
container
=
container
;
this
.
knownColorThemes
=
[];
this
.
knownColorThemes
=
[];
...
@@ -311,7 +313,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -311,7 +313,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
this
.
storageService
.
remove
(
'
workbench.theme
'
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
remove
(
'
workbench.theme
'
,
StorageScope
.
GLOBAL
);
promise
=
this
.
findThemeData
(
legacyColorThemeId
,
DEFAULT_THEME_ID
).
then
(
theme
=>
{
promise
=
this
.
findThemeData
(
legacyColorThemeId
,
DEFAULT_THEME_ID
).
then
(
theme
=>
{
let
value
=
theme
?
theme
.
settingsId
:
DEFAULT_THEME_SETTING_VALUE
;
let
value
=
theme
?
theme
.
settingsId
:
DEFAULT_THEME_SETTING_VALUE
;
return
this
.
writeConfiguration
(
COLOR_THEME_SETTING
,
value
,
ConfigurationTarget
.
USER
).
then
(
null
,
error
=>
null
);
return
this
.
configurationWriter
.
writeConfiguration
(
COLOR_THEME_SETTING
,
value
,
ConfigurationTarget
.
USER
).
then
(
null
,
error
=>
null
);
});
});
}
}
if
(
!
types
.
isUndefined
(
legacyIconThemeId
))
{
if
(
!
types
.
isUndefined
(
legacyIconThemeId
))
{
...
@@ -319,7 +321,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -319,7 +321,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
promise
=
promise
.
then
(
_
=>
{
promise
=
promise
.
then
(
_
=>
{
return
this
.
_findIconThemeData
(
legacyIconThemeId
).
then
(
theme
=>
{
return
this
.
_findIconThemeData
(
legacyIconThemeId
).
then
(
theme
=>
{
let
value
=
theme
?
theme
.
settingsId
:
null
;
let
value
=
theme
?
theme
.
settingsId
:
null
;
return
this
.
writeConfiguration
(
ICON_THEME_SETTING
,
value
,
ConfigurationTarget
.
USER
).
then
(
null
,
error
=>
null
);
return
this
.
configurationWriter
.
writeConfiguration
(
ICON_THEME_SETTING
,
value
,
ConfigurationTarget
.
USER
).
then
(
null
,
error
=>
null
);
});
});
});
});
}
}
...
@@ -430,7 +432,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -430,7 +432,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
private
writeColorThemeConfiguration
(
settingsTarget
:
ConfigurationTarget
):
TPromise
<
IFileIconTheme
>
{
private
writeColorThemeConfiguration
(
settingsTarget
:
ConfigurationTarget
):
TPromise
<
IFileIconTheme
>
{
if
(
!
types
.
isUndefinedOrNull
(
settingsTarget
))
{
if
(
!
types
.
isUndefinedOrNull
(
settingsTarget
))
{
return
this
.
writeConfiguration
(
COLOR_THEME_SETTING
,
this
.
currentColorTheme
.
settingsId
,
settingsTarget
).
then
(
_
=>
this
.
currentColorTheme
);
return
this
.
configurationWriter
.
writeConfiguration
(
COLOR_THEME_SETTING
,
this
.
currentColorTheme
.
settingsId
,
settingsTarget
).
then
(
_
=>
this
.
currentColorTheme
);
}
}
return
TPromise
.
as
(
this
.
currentColorTheme
);
return
TPromise
.
as
(
this
.
currentColorTheme
);
}
}
...
@@ -628,28 +630,17 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
...
@@ -628,28 +630,17 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
private
writeFileIconConfiguration
(
settingsTarget
:
ConfigurationTarget
):
TPromise
<
IFileIconTheme
>
{
private
writeFileIconConfiguration
(
settingsTarget
:
ConfigurationTarget
):
TPromise
<
IFileIconTheme
>
{
if
(
!
types
.
isUndefinedOrNull
(
settingsTarget
))
{
if
(
!
types
.
isUndefinedOrNull
(
settingsTarget
))
{
return
this
.
writeConfiguration
(
ICON_THEME_SETTING
,
this
.
currentIconTheme
.
settingsId
,
settingsTarget
).
then
(
_
=>
this
.
currentIconTheme
);
return
this
.
configurationWriter
.
writeConfiguration
(
ICON_THEME_SETTING
,
this
.
currentIconTheme
.
settingsId
,
settingsTarget
).
then
(
_
=>
this
.
currentIconTheme
);
}
}
return
TPromise
.
as
(
this
.
currentIconTheme
);
return
TPromise
.
as
(
this
.
currentIconTheme
);
}
}
private
writeConfiguration
(
key
:
string
,
value
:
any
,
settingsTarget
:
ConfigurationTarget
):
TPromise
<
any
>
{
private
get
configurationWriter
():
ConfigurationWriter
{
let
settings
=
this
.
configurationService
.
lookup
(
key
);
// separate out the ConfigurationWriter to avoid a dependency of the IConfigurationEditingService
if
(
settingsTarget
===
ConfigurationTarget
.
USER
)
{
if
(
!
this
.
_configurationWriter
)
{
if
(
value
===
settings
.
user
)
{
this
.
_configurationWriter
=
this
.
instantiationService
.
createInstance
(
ConfigurationWriter
);
return
TPromise
.
as
(
null
);
// nothing to do
}
else
if
(
value
===
settings
.
default
)
{
if
(
types
.
isUndefined
(
settings
.
user
))
{
return
TPromise
.
as
(
null
);
// nothing to do
}
value
=
void
0
;
// remove configuration from user settings
}
}
else
if
(
settingsTarget
===
ConfigurationTarget
.
WORKSPACE
)
{
if
(
value
===
settings
.
value
)
{
return
TPromise
.
as
(
null
);
// nothing to do
}
}
}
return
this
.
configurationEditingService
.
writeConfiguration
(
settingsTarget
,
{
key
,
value
})
;
return
this
.
_configurationWriter
;
}
}
private
_findIconThemeData
(
iconTheme
:
string
):
TPromise
<
IInternalIconThemeData
>
{
private
_findIconThemeData
(
iconTheme
:
string
):
TPromise
<
IInternalIconThemeData
>
{
...
@@ -886,6 +877,30 @@ function _applyRules(styleSheetContent: string, rulesClassName: string) {
...
@@ -886,6 +877,30 @@ function _applyRules(styleSheetContent: string, rulesClassName: string) {
colorThemeSchema
.
register
();
colorThemeSchema
.
register
();
fileIconThemeSchema
.
register
();
fileIconThemeSchema
.
register
();
class
ConfigurationWriter
{
constructor
(
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
)
{
}
public
writeConfiguration
(
key
:
string
,
value
:
any
,
settingsTarget
:
ConfigurationTarget
):
TPromise
<
any
>
{
let
settings
=
this
.
configurationService
.
lookup
(
key
);
if
(
settingsTarget
===
ConfigurationTarget
.
USER
)
{
if
(
value
===
settings
.
user
)
{
return
TPromise
.
as
(
null
);
// nothing to do
}
else
if
(
value
===
settings
.
default
)
{
if
(
types
.
isUndefined
(
settings
.
user
))
{
return
TPromise
.
as
(
null
);
// nothing to do
}
value
=
void
0
;
// remove configuration from user settings
}
}
else
if
(
settingsTarget
===
ConfigurationTarget
.
WORKSPACE
)
{
if
(
value
===
settings
.
value
)
{
return
TPromise
.
as
(
null
);
// nothing to do
}
}
return
this
.
configurationEditingService
.
writeConfiguration
(
settingsTarget
,
{
key
,
value
});
}
}
// Configuration: Themes
// Configuration: Themes
const
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
);
const
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录