Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MrYangLu
vscode
提交
838d4a33
V
vscode
项目概览
MrYangLu
/
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,发现更多精彩内容 >>
提交
838d4a33
编写于
9月 27, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #34353
上级
1fa9254d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
54 addition
and
24 deletion
+54
-24
src/vs/platform/configuration/common/configuration.ts
src/vs/platform/configuration/common/configuration.ts
+8
-1
src/vs/platform/configuration/common/configurationRegistry.ts
...vs/platform/configuration/common/configurationRegistry.ts
+7
-5
src/vs/platform/configuration/node/configurationService.ts
src/vs/platform/configuration/node/configurationService.ts
+14
-7
src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts
...workbench/api/electron-browser/mainThreadConfiguration.ts
+8
-9
src/vs/workbench/services/configuration/node/configuration.ts
...vs/workbench/services/configuration/node/configuration.ts
+17
-2
未找到文件。
src/vs/platform/configuration/common/configuration.ts
浏览文件 @
838d4a33
...
@@ -51,8 +51,15 @@ export interface IConfigurationService {
...
@@ -51,8 +51,15 @@ export interface IConfigurationService {
*/
*/
reloadConfiguration
<
T
>
(
section
?:
string
):
TPromise
<
T
>
;
reloadConfiguration
<
T
>
(
section
?:
string
):
TPromise
<
T
>
;
// TODO: @sandy: Merge these to single fine grained configuration change event
// These events were separated to improve the start up performance - #34353
/**
/**
* Event that fires when the configuration changes.
* Event that fires when the configurations from extensions are registered.
*/
onDidRegisterExtensionsConfigurations
:
Event
<
void
>
;
/**
* Event that fires when the configuration changes. This event is not fired when configurations from extensions are registered.
*/
*/
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
;
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
;
...
...
src/vs/platform/configuration/common/configurationRegistry.ts
浏览文件 @
838d4a33
...
@@ -35,7 +35,7 @@ export interface IConfigurationRegistry {
...
@@ -35,7 +35,7 @@ export interface IConfigurationRegistry {
* Event that fires whenver a configuratio has been
* Event that fires whenver a configuratio has been
* registered.
* registered.
*/
*/
onDidRegisterConfiguration
:
Event
<
IConfiguration
Registry
>
;
onDidRegisterConfiguration
:
Event
<
IConfiguration
Node
[]
>
;
/**
/**
* Returns all configuration nodes contributed to this registry.
* Returns all configuration nodes contributed to this registry.
...
@@ -75,6 +75,7 @@ export interface IConfigurationNode {
...
@@ -75,6 +75,7 @@ export interface IConfigurationNode {
allOf
?:
IConfigurationNode
[];
allOf
?:
IConfigurationNode
[];
overridable
?:
boolean
;
overridable
?:
boolean
;
scope
?:
ConfigurationScope
;
scope
?:
ConfigurationScope
;
isFromExtensions
?:
boolean
;
}
}
export
interface
IDefaultConfigurationExtension
{
export
interface
IDefaultConfigurationExtension
{
...
@@ -93,14 +94,14 @@ class ConfigurationRegistry implements IConfigurationRegistry {
...
@@ -93,14 +94,14 @@ class ConfigurationRegistry implements IConfigurationRegistry {
private
configurationContributors
:
IConfigurationNode
[];
private
configurationContributors
:
IConfigurationNode
[];
private
configurationProperties
:
{
[
qualifiedKey
:
string
]:
IJSONSchema
};
private
configurationProperties
:
{
[
qualifiedKey
:
string
]:
IJSONSchema
};
private
editorConfigurationSchema
:
IJSONSchema
;
private
editorConfigurationSchema
:
IJSONSchema
;
private
_onDidRegisterConfiguration
:
Emitter
<
IConfiguration
Registry
>
;
private
_onDidRegisterConfiguration
:
Emitter
<
IConfiguration
Node
[]
>
;
private
overrideIdentifiers
:
string
[]
=
[];
private
overrideIdentifiers
:
string
[]
=
[];
private
overridePropertyPattern
:
string
;
private
overridePropertyPattern
:
string
;
constructor
()
{
constructor
()
{
this
.
configurationContributors
=
[];
this
.
configurationContributors
=
[];
this
.
editorConfigurationSchema
=
{
properties
:
{},
patternProperties
:
{},
additionalProperties
:
false
,
errorMessage
:
'
Unknown editor configuration setting
'
};
this
.
editorConfigurationSchema
=
{
properties
:
{},
patternProperties
:
{},
additionalProperties
:
false
,
errorMessage
:
'
Unknown editor configuration setting
'
};
this
.
_onDidRegisterConfiguration
=
new
Emitter
<
IConfiguration
Registry
>
();
this
.
_onDidRegisterConfiguration
=
new
Emitter
<
IConfiguration
Node
[]
>
();
this
.
configurationProperties
=
{};
this
.
configurationProperties
=
{};
this
.
computeOverridePropertyPattern
();
this
.
computeOverridePropertyPattern
();
...
@@ -123,7 +124,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
...
@@ -123,7 +124,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
this
.
updateSchemaForOverrideSettingsConfiguration
(
configuration
);
this
.
updateSchemaForOverrideSettingsConfiguration
(
configuration
);
});
});
this
.
_onDidRegisterConfiguration
.
fire
(
thi
s
);
this
.
_onDidRegisterConfiguration
.
fire
(
configuration
s
);
}
}
public
registerOverrideIdentifiers
(
overrideIdentifiers
:
string
[]):
void
{
public
registerOverrideIdentifiers
(
overrideIdentifiers
:
string
[]):
void
{
...
@@ -135,7 +136,8 @@ class ConfigurationRegistry implements IConfigurationRegistry {
...
@@ -135,7 +136,8 @@ class ConfigurationRegistry implements IConfigurationRegistry {
const
configurationNode
:
IConfigurationNode
=
{
const
configurationNode
:
IConfigurationNode
=
{
id
:
'
defaultOverrides
'
,
id
:
'
defaultOverrides
'
,
title
:
nls
.
localize
(
'
defaultConfigurations.title
'
,
"
Default Configuration Overrides
"
),
title
:
nls
.
localize
(
'
defaultConfigurations.title
'
,
"
Default Configuration Overrides
"
),
properties
:
{}
properties
:
{},
isFromExtensions
:
true
};
};
for
(
const
defaultConfiguration
of
defaultConfigurations
)
{
for
(
const
defaultConfiguration
of
defaultConfigurations
)
{
for
(
const
key
in
defaultConfiguration
.
defaults
)
{
for
(
const
key
in
defaultConfiguration
.
defaults
)
{
...
...
src/vs/platform/configuration/node/configurationService.ts
浏览文件 @
838d4a33
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ConfigWatcher
}
from
'
vs/base/node/config
'
;
import
{
ConfigWatcher
}
from
'
vs/base/node/config
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IConfigurationRegistry
,
Extensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IConfigurationRegistry
,
Extensions
,
IConfigurationNode
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ConfigurationSource
,
IConfigurationService
,
IConfigurationServiceEvent
,
IConfigurationValue
,
IConfigurationKeys
,
ConfigurationModel
,
IConfigurationOverrides
,
Configuration
,
IConfigurationValues
,
IConfigurationData
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ConfigurationSource
,
IConfigurationService
,
IConfigurationServiceEvent
,
IConfigurationValue
,
IConfigurationKeys
,
ConfigurationModel
,
IConfigurationOverrides
,
Configuration
,
IConfigurationValues
,
IConfigurationData
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CustomConfigurationModel
,
DefaultConfigurationModel
}
from
'
vs/platform/configuration/common/model
'
;
import
{
CustomConfigurationModel
,
DefaultConfigurationModel
}
from
'
vs/platform/configuration/common/model
'
;
...
@@ -25,6 +25,9 @@ export class ConfigurationService<T> extends Disposable implements IConfiguratio
...
@@ -25,6 +25,9 @@ export class ConfigurationService<T> extends Disposable implements IConfiguratio
private
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationServiceEvent
>
=
this
.
_register
(
new
Emitter
<
IConfigurationServiceEvent
>
());
private
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationServiceEvent
>
=
this
.
_register
(
new
Emitter
<
IConfigurationServiceEvent
>
());
public
readonly
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
=
this
.
_onDidUpdateConfiguration
.
event
;
public
readonly
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
=
this
.
_onDidUpdateConfiguration
.
event
;
private
_onDidRegisterExtensionsConfigurations
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onDidRegisterExtensionsConfigurations
:
Event
<
void
>
=
this
.
_onDidRegisterExtensionsConfigurations
.
event
;
constructor
(
constructor
(
@
IEnvironmentService
environmentService
:
IEnvironmentService
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
)
{
...
@@ -41,23 +44,27 @@ export class ConfigurationService<T> extends Disposable implements IConfiguratio
...
@@ -41,23 +44,27 @@ export class ConfigurationService<T> extends Disposable implements IConfiguratio
// Listeners
// Listeners
this
.
_register
(
this
.
userConfigModelWatcher
.
onDidUpdateConfiguration
(()
=>
this
.
onConfigurationChange
(
ConfigurationSource
.
User
)));
this
.
_register
(
this
.
userConfigModelWatcher
.
onDidUpdateConfiguration
(()
=>
this
.
onConfigurationChange
(
ConfigurationSource
.
User
)));
this
.
_register
(
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
).
onDidRegisterConfiguration
(
()
=>
this
.
onConfigurationChange
(
ConfigurationSource
.
Default
)));
this
.
_register
(
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
).
onDidRegisterConfiguration
(
configurations
=>
this
.
onConfigurationChange
(
ConfigurationSource
.
Default
,
configurations
)));
}
}
public
configuration
():
Configuration
<
any
>
{
public
configuration
():
Configuration
<
any
>
{
return
this
.
_configuration
||
(
this
.
_configuration
=
this
.
consolidateConfigurations
());
return
this
.
_configuration
||
(
this
.
_configuration
=
this
.
consolidateConfigurations
());
}
}
private
onConfigurationChange
(
source
:
ConfigurationSource
):
void
{
private
onConfigurationChange
(
source
:
ConfigurationSource
,
configurations
?:
IConfigurationNode
[]
):
void
{
this
.
reset
();
// reset our caches
this
.
reset
();
// reset our caches
const
cache
=
this
.
configuration
();
const
cache
=
this
.
configuration
();
if
(
configurations
&&
configurations
.
length
&&
configurations
.
every
(
c
=>
c
.
isFromExtensions
))
{
this
.
_onDidRegisterExtensionsConfigurations
.
fire
();
}
else
{
this
.
_onDidUpdateConfiguration
.
fire
({
this
.
_onDidUpdateConfiguration
.
fire
({
source
,
source
,
sourceConfig
:
source
===
ConfigurationSource
.
Default
?
cache
.
defaults
.
contents
:
cache
.
user
.
contents
sourceConfig
:
source
===
ConfigurationSource
.
Default
?
cache
.
defaults
.
contents
:
cache
.
user
.
contents
});
});
}
}
}
public
reloadConfiguration
<
C
>
(
section
?:
string
):
TPromise
<
C
>
{
public
reloadConfiguration
<
C
>
(
section
?:
string
):
TPromise
<
C
>
{
return
new
TPromise
<
C
>
(
c
=>
{
return
new
TPromise
<
C
>
(
c
=>
{
...
...
src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts
浏览文件 @
838d4a33
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
I
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
...
@@ -16,9 +16,7 @@ import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostCont
...
@@ -16,9 +16,7 @@ import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostCont
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadConfiguration
)
@
extHostNamedCustomer
(
MainContext
.
MainThreadConfiguration
)
export
class
MainThreadConfiguration
implements
MainThreadConfigurationShape
{
export
class
MainThreadConfiguration
extends
Disposable
implements
MainThreadConfigurationShape
{
private
readonly
_configurationListener
:
IDisposable
;
constructor
(
constructor
(
extHostContext
:
IExtHostContext
,
extHostContext
:
IExtHostContext
,
...
@@ -26,15 +24,16 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
...
@@ -26,15 +24,16 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
@
IWorkspaceContextService
private
readonly
_workspaceContextService
:
IWorkspaceContextService
,
@
IWorkspaceContextService
private
readonly
_workspaceContextService
:
IWorkspaceContextService
,
@
IWorkspaceConfigurationService
configurationService
:
IWorkspaceConfigurationService
@
IWorkspaceConfigurationService
configurationService
:
IWorkspaceConfigurationService
)
{
)
{
super
();
const
proxy
=
extHostContext
.
get
(
ExtHostContext
.
ExtHostConfiguration
);
const
proxy
=
extHostContext
.
get
(
ExtHostContext
.
ExtHostConfiguration
);
this
.
_
configurationListener
=
configurationService
.
onDidUpdateConfiguration
(()
=>
{
this
.
_
register
(
configurationService
.
onDidUpdateConfiguration
(()
=>
{
proxy
.
$acceptConfigurationChanged
(
configurationService
.
getConfigurationData
());
proxy
.
$acceptConfigurationChanged
(
configurationService
.
getConfigurationData
());
});
}));
}
public
dispose
():
void
{
this
.
_register
(
configurationService
.
onDidRegisterExtensionsConfigurations
(()
=>
{
this
.
_configurationListener
.
dispose
();
proxy
.
$acceptConfigurationChanged
(
configurationService
.
getConfigurationData
());
}));
}
}
$updateConfigurationOption
(
target
:
ConfigurationTarget
,
key
:
string
,
value
:
any
,
resource
:
URI
):
TPromise
<
void
>
{
$updateConfigurationOption
(
target
:
ConfigurationTarget
,
key
:
string
,
value
:
any
,
resource
:
URI
):
TPromise
<
void
>
{
...
...
src/vs/workbench/services/configuration/node/configuration.ts
浏览文件 @
838d4a33
...
@@ -128,6 +128,7 @@ configurationExtPoint.setHandler(extensions => {
...
@@ -128,6 +128,7 @@ configurationExtPoint.setHandler(extensions => {
validateProperties
(
configuration
,
collector
);
validateProperties
(
configuration
,
collector
);
configuration
.
id
=
id
;
configuration
.
id
=
id
;
configuration
.
isFromExtensions
=
true
;
configurations
.
push
(
configuration
);
configurations
.
push
(
configuration
);
};
};
...
@@ -275,6 +276,9 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
...
@@ -275,6 +276,9 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
protected
readonly
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationServiceEvent
>
=
this
.
_register
(
new
Emitter
<
IConfigurationServiceEvent
>
());
protected
readonly
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationServiceEvent
>
=
this
.
_register
(
new
Emitter
<
IConfigurationServiceEvent
>
());
public
readonly
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
=
this
.
_onDidUpdateConfiguration
.
event
;
public
readonly
onDidUpdateConfiguration
:
Event
<
IConfigurationServiceEvent
>
=
this
.
_onDidUpdateConfiguration
.
event
;
private
_onDidRegisterExtensionsConfigurations
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onDidRegisterExtensionsConfigurations
:
Event
<
void
>
=
this
.
_onDidRegisterExtensionsConfigurations
.
event
;
protected
readonly
_onDidChangeWorkspaceFolders
:
Emitter
<
IWorkspaceFoldersChangeEvent
>
=
this
.
_register
(
new
Emitter
<
IWorkspaceFoldersChangeEvent
>
());
protected
readonly
_onDidChangeWorkspaceFolders
:
Emitter
<
IWorkspaceFoldersChangeEvent
>
=
this
.
_register
(
new
Emitter
<
IWorkspaceFoldersChangeEvent
>
());
public
readonly
onDidChangeWorkspaceFolders
:
Event
<
IWorkspaceFoldersChangeEvent
>
=
this
.
_onDidChangeWorkspaceFolders
.
event
;
public
readonly
onDidChangeWorkspaceFolders
:
Event
<
IWorkspaceFoldersChangeEvent
>
=
this
.
_onDidChangeWorkspaceFolders
.
event
;
...
@@ -292,6 +296,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
...
@@ -292,6 +296,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
this
.
baseConfigurationService
=
this
.
_register
(
new
GlobalConfigurationService
(
environmentService
));
this
.
baseConfigurationService
=
this
.
_register
(
new
GlobalConfigurationService
(
environmentService
));
this
.
_register
(
this
.
baseConfigurationService
.
onDidUpdateConfiguration
(
e
=>
this
.
onBaseConfigurationChanged
(
e
)));
this
.
_register
(
this
.
baseConfigurationService
.
onDidUpdateConfiguration
(
e
=>
this
.
onBaseConfigurationChanged
(
e
)));
this
.
_register
(
this
.
baseConfigurationService
.
onDidRegisterExtensionsConfigurations
(
e
=>
this
.
onDidRegisterExtensionsDefaultsConfigurations
()));
this
.
_register
(
configurationRegistry
.
onDidRegisterConfiguration
(
e
=>
this
.
registerConfigurationSchemas
()));
this
.
_register
(
configurationRegistry
.
onDidRegisterConfiguration
(
e
=>
this
.
registerConfigurationSchemas
()));
}
}
...
@@ -517,14 +522,24 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
...
@@ -517,14 +522,24 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
}
}
}
}
private
onBaseConfigurationChanged
({
source
,
sourceConfig
}:
IConfigurationServiceEvent
):
void
{
private
onBaseConfigurationChanged
({
source
,
sourceConfig
}:
IConfigurationServiceEvent
,
doNotTrigger
:
boolean
=
false
):
boolean
{
if
(
this
.
workspace
)
{
if
(
this
.
workspace
)
{
if
(
source
===
ConfigurationSource
.
Default
)
{
if
(
source
===
ConfigurationSource
.
Default
)
{
this
.
workspace
.
folders
.
forEach
(
folder
=>
this
.
_configuration
.
getFolderConfigurationModel
(
folder
.
uri
).
update
());
this
.
workspace
.
folders
.
forEach
(
folder
=>
this
.
_configuration
.
getFolderConfigurationModel
(
folder
.
uri
).
update
());
}
}
if
(
this
.
_configuration
.
updateBaseConfiguration
(
<
any
>
this
.
baseConfigurationService
.
configuration
()))
{
if
(
this
.
_configuration
.
updateBaseConfiguration
(
<
any
>
this
.
baseConfigurationService
.
configuration
()))
{
if
(
!
doNotTrigger
)
{
this
.
_onDidUpdateConfiguration
.
fire
({
source
,
sourceConfig
});
this
.
_onDidUpdateConfiguration
.
fire
({
source
,
sourceConfig
});
}
}
return
true
;
}
}
return
false
;
}
private
onDidRegisterExtensionsDefaultsConfigurations
():
void
{
if
(
this
.
onBaseConfigurationChanged
({
source
:
ConfigurationSource
.
Default
,
sourceConfig
:
this
.
baseConfigurationService
.
getConfigurationData
().
defaults
.
contents
},
true
))
{
this
.
_onDidRegisterExtensionsConfigurations
.
fire
();
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录