Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
0d0e4dfe
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d0e4dfe
编写于
6月 11, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #75109
上级
eabd2c51
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
17 deletion
+23
-17
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+1
-1
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-1
src/vs/code/node/cliProcessMain.ts
src/vs/code/node/cliProcessMain.ts
+1
-1
src/vs/platform/configuration/node/configurationService.ts
src/vs/platform/configuration/node/configurationService.ts
+9
-4
src/vs/platform/configuration/test/node/configurationService.test.ts
...form/configuration/test/node/configurationService.test.ts
+11
-10
未找到文件。
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
0d0e4dfe
...
...
@@ -98,7 +98,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
disposables
.
push
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
const
configurationService
=
new
ConfigurationService
(
environmentService
.
settingsResource
.
path
);
const
configurationService
=
new
ConfigurationService
(
environmentService
.
settingsResource
);
disposables
.
push
(
configurationService
);
await
configurationService
.
initialize
();
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
0d0e4dfe
...
...
@@ -141,7 +141,7 @@ class CodeMain {
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
services
.
set
(
ILogService
,
logService
);
services
.
set
(
IConfigurationService
,
new
ConfigurationService
(
environmentService
.
settingsResource
.
path
));
services
.
set
(
IConfigurationService
,
new
ConfigurationService
(
environmentService
.
settingsResource
));
services
.
set
(
ILifecycleService
,
new
SyncDescriptor
(
LifecycleService
));
services
.
set
(
IStateService
,
new
SyncDescriptor
(
StateService
));
services
.
set
(
IRequestService
,
new
SyncDescriptor
(
RequestService
));
...
...
src/vs/code/node/cliProcessMain.ts
浏览文件 @
0d0e4dfe
...
...
@@ -285,7 +285,7 @@ export async function main(argv: ParsedArgs): Promise<void> {
await
Promise
.
all
([
environmentService
.
appSettingsHome
,
environmentService
.
extensionsPath
].
map
(
p
=>
mkdirp
(
p
)));
const
configurationService
=
new
ConfigurationService
(
environmentService
.
settingsResource
.
path
);
const
configurationService
=
new
ConfigurationService
(
environmentService
.
settingsResource
);
await
configurationService
.
initialize
();
services
.
set
(
IEnvironmentService
,
environmentService
);
...
...
src/vs/platform/configuration/node/configurationService.ts
浏览文件 @
0d0e4dfe
...
...
@@ -12,6 +12,8 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ConfigWatcher
}
from
'
vs/base/node/config
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
class
ConfigurationService
extends
Disposable
implements
IConfigurationService
,
IDisposable
{
...
...
@@ -24,7 +26,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
readonly
onDidChangeConfiguration
:
Event
<
IConfigurationChangeEvent
>
=
this
.
_onDidChangeConfiguration
.
event
;
constructor
(
private
readonly
configurationPath
:
string
private
readonly
settingsResource
:
URI
)
{
super
();
this
.
configuration
=
new
Configuration
(
new
DefaultConfigurationModel
(),
new
ConfigurationModel
());
...
...
@@ -36,10 +38,13 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
this
.
userConfigModelWatcher
.
dispose
();
}
if
(
this
.
settingsResource
.
scheme
!==
Schemas
.
file
)
{
return
Promise
.
resolve
();
}
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
this
.
userConfigModelWatcher
=
this
.
_register
(
new
ConfigWatcher
(
this
.
configuration
Path
,
{
changeBufferDelay
:
300
,
onError
:
error
=>
onUnexpectedError
(
error
),
defaultConfig
:
new
ConfigurationModelParser
(
this
.
configuration
Path
),
parse
:
(
content
:
string
,
parseErrors
:
any
[])
=>
{
const
userConfigModelParser
=
new
ConfigurationModelParser
(
this
.
configuration
Path
);
this
.
userConfigModelWatcher
=
this
.
_register
(
new
ConfigWatcher
(
this
.
settingsResource
.
fs
Path
,
{
changeBufferDelay
:
300
,
onError
:
error
=>
onUnexpectedError
(
error
),
defaultConfig
:
new
ConfigurationModelParser
(
this
.
settingsResource
.
fs
Path
),
parse
:
(
content
:
string
,
parseErrors
:
any
[])
=>
{
const
userConfigModelParser
=
new
ConfigurationModelParser
(
this
.
settingsResource
.
fs
Path
);
userConfigModelParser
.
parseContent
(
content
);
parseErrors
=
[...
userConfigModelParser
.
errors
];
return
userConfigModelParser
;
...
...
src/vs/platform/configuration/test/node/configurationService.test.ts
浏览文件 @
0d0e4dfe
...
...
@@ -13,6 +13,7 @@ import { ConfigurationService } from 'vs/platform/configuration/node/configurati
import
*
as
uuid
from
'
vs/base/common/uuid
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
testFile
}
from
'
vs/base/test/node/utils
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
suite
(
'
ConfigurationService - Node
'
,
()
=>
{
...
...
@@ -20,7 +21,7 @@ suite('ConfigurationService - Node', () => {
const
res
=
await
testFile
(
'
config
'
,
'
config.json
'
);
fs
.
writeFileSync
(
res
.
testFile
,
'
{ "foo": "bar" }
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
await
service
.
initialize
();
const
config
=
service
.
getValue
<
{
foo
:
string
;
...
...
@@ -38,7 +39,7 @@ suite('ConfigurationService - Node', () => {
fs
.
writeFileSync
(
res
.
testFile
,
'
{ "testworkbench.editor.tabs": true }
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
await
service
.
initialize
();
const
config
=
service
.
getValue
<
{
testworkbench
:
{
...
...
@@ -61,7 +62,7 @@ suite('ConfigurationService - Node', () => {
fs
.
writeFileSync
(
res
.
testFile
,
'
,,,,
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
await
service
.
initialize
();
const
config
=
service
.
getValue
<
{
foo
:
string
;
...
...
@@ -78,7 +79,7 @@ suite('ConfigurationService - Node', () => {
const
newDir
=
path
.
join
(
parentDir
,
'
config
'
,
id
);
const
testFile
=
path
.
join
(
newDir
,
'
config.json
'
);
const
service
=
new
ConfigurationService
(
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
testFile
)
);
await
service
.
initialize
();
const
config
=
service
.
getValue
<
{
foo
:
string
}
>
();
...
...
@@ -90,7 +91,7 @@ suite('ConfigurationService - Node', () => {
test
(
'
trigger configuration change event
'
,
async
()
=>
{
const
res
=
await
testFile
(
'
config
'
,
'
config.json
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
await
service
.
initialize
();
return
new
Promise
((
c
,
e
)
=>
{
service
.
onDidChangeConfiguration
(()
=>
{
...
...
@@ -108,7 +109,7 @@ suite('ConfigurationService - Node', () => {
fs
.
writeFileSync
(
res
.
testFile
,
'
{ "foo": "bar" }
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
await
service
.
initialize
();
let
config
=
service
.
getValue
<
{
foo
:
string
;
...
...
@@ -157,7 +158,7 @@ suite('ConfigurationService - Node', () => {
}
});
let
serviceWithoutFile
=
new
ConfigurationService
(
'
__testFile
'
);
let
serviceWithoutFile
=
new
ConfigurationService
(
URI
.
file
(
'
__testFile
'
)
);
await
serviceWithoutFile
.
initialize
();
let
setting
=
serviceWithoutFile
.
getValue
<
ITestSetting
>
();
...
...
@@ -167,7 +168,7 @@ suite('ConfigurationService - Node', () => {
return
testFile
(
'
config
'
,
'
config.json
'
).
then
(
async
res
=>
{
fs
.
writeFileSync
(
res
.
testFile
,
'
{ "testworkbench.editor.tabs": true }
'
);
const
service
=
new
ConfigurationService
(
res
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
res
.
testFile
)
);
let
setting
=
service
.
getValue
<
ITestSetting
>
();
...
...
@@ -200,7 +201,7 @@ suite('ConfigurationService - Node', () => {
});
const
r
=
await
testFile
(
'
config
'
,
'
config.json
'
);
const
service
=
new
ConfigurationService
(
r
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
r
.
testFile
)
);
service
.
initialize
();
let
res
=
service
.
inspect
(
'
something.missing
'
);
...
...
@@ -238,7 +239,7 @@ suite('ConfigurationService - Node', () => {
});
const
r
=
await
testFile
(
'
config
'
,
'
config.json
'
);
const
service
=
new
ConfigurationService
(
r
.
testFile
);
const
service
=
new
ConfigurationService
(
URI
.
file
(
r
.
testFile
)
);
service
.
initialize
();
let
res
=
service
.
inspect
(
'
lookup.service.testNullSetting
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录