Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
48e3f6c8
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,发现更多精彩内容 >>
提交
48e3f6c8
编写于
12月 13, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Working on strict null checking configuration
上级
4be6af93
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
11 deletion
+19
-11
src/vs/workbench/services/configuration/node/configuration.ts
...vs/workbench/services/configuration/node/configuration.ts
+19
-11
未找到文件。
src/vs/workbench/services/configuration/node/configuration.ts
浏览文件 @
48e3f6c8
...
@@ -65,7 +65,7 @@ export class WorkspaceConfiguration extends Disposable {
...
@@ -65,7 +65,7 @@ export class WorkspaceConfiguration extends Disposable {
parseErrors
=
[...
this
.
_workspaceConfigurationModelParser
.
errors
];
parseErrors
=
[...
this
.
_workspaceConfigurationModelParser
.
errors
];
this
.
consolidate
();
this
.
consolidate
();
return
this
.
_workspaceConfigurationModelParser
;
return
this
.
_workspaceConfigurationModelParser
;
},
initCallback
:
()
=>
c
(
null
)
},
initCallback
:
()
=>
c
(
void
0
)
});
});
this
.
listenToWatcher
();
this
.
listenToWatcher
();
});
});
...
@@ -75,7 +75,7 @@ export class WorkspaceConfiguration extends Disposable {
...
@@ -75,7 +75,7 @@ export class WorkspaceConfiguration extends Disposable {
this
.
stopListeningToWatcher
();
this
.
stopListeningToWatcher
();
return
new
Promise
<
void
>
(
c
=>
this
.
_workspaceConfigurationWatcher
.
reload
(()
=>
{
return
new
Promise
<
void
>
(
c
=>
this
.
_workspaceConfigurationWatcher
.
reload
(()
=>
{
this
.
listenToWatcher
();
this
.
listenToWatcher
();
c
(
null
);
c
(
void
0
);
}));
}));
}
}
...
@@ -225,13 +225,16 @@ export class NodeBasedFolderConfiguration extends AbstractFolderConfiguration {
...
@@ -225,13 +225,16 @@ export class NodeBasedFolderConfiguration extends AbstractFolderConfiguration {
protected
loadFolderConfigurationContents
():
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
protected
loadFolderConfigurationContents
():
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
return
this
.
resolveStat
(
this
.
folderConfigurationPath
).
then
(
stat
=>
{
return
this
.
resolveStat
(
this
.
folderConfigurationPath
).
then
(
stat
=>
{
if
(
!
stat
.
isDirectory
)
{
if
(
!
stat
.
isDirectory
||
!
stat
.
children
)
{
return
Promise
.
resolve
([]);
return
Promise
.
resolve
([]);
}
}
return
this
.
resolveContents
(
stat
.
children
.
filter
(
stat
=>
isFolderConfigurationFile
(
stat
.
resource
))
return
this
.
resolveContents
(
stat
.
children
.
filter
(
stat
=>
isFolderConfigurationFile
(
stat
.
resource
))
.
map
(
stat
=>
stat
.
resource
));
.
map
(
stat
=>
stat
.
resource
));
},
err
=>
[]
/* never fail this call */
)
},
err
=>
[]
/* never fail this call */
)
.
then
(
void
0
,
errors
.
onUnexpectedError
);
.
then
(
void
0
,
e
=>
{
errors
.
onUnexpectedError
(
e
);
return
[];
});
}
}
private
resolveContents
(
resources
:
URI
[]):
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
private
resolveContents
(
resources
:
URI
[]):
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
...
@@ -265,7 +268,7 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
...
@@ -265,7 +268,7 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
private
reloadConfigurationScheduler
:
RunOnceScheduler
;
private
reloadConfigurationScheduler
:
RunOnceScheduler
;
private
readonly
folderConfigurationPath
:
URI
;
private
readonly
folderConfigurationPath
:
URI
;
private
readonly
loadConfigurationDelayer
:
Delayer
<
{
resource
:
URI
,
value
:
string
}[]
>
=
new
Delayer
<
{
resource
:
URI
,
value
:
string
}[]
>
(
50
);
private
readonly
loadConfigurationDelayer
=
new
Delayer
<
Array
<
{
resource
:
URI
,
value
:
string
}
>
>
(
50
);
constructor
(
folder
:
URI
,
private
configFolderRelativePath
:
string
,
workbenchState
:
WorkbenchState
,
private
fileService
:
IFileService
,
from
?:
AbstractFolderConfiguration
)
{
constructor
(
folder
:
URI
,
private
configFolderRelativePath
:
string
,
workbenchState
:
WorkbenchState
,
private
fileService
:
IFileService
,
from
?:
AbstractFolderConfiguration
)
{
super
(
folder
,
workbenchState
,
from
);
super
(
folder
,
workbenchState
,
from
);
...
@@ -274,18 +277,23 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
...
@@ -274,18 +277,23 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
this
.
_register
(
fileService
.
onFileChanges
(
e
=>
this
.
handleWorkspaceFileEvents
(
e
)));
this
.
_register
(
fileService
.
onFileChanges
(
e
=>
this
.
handleWorkspaceFileEvents
(
e
)));
}
}
protected
loadFolderConfigurationContents
():
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
protected
loadFolderConfigurationContents
():
Promise
<
Array
<
{
resource
:
URI
,
value
:
string
}
>
>
{
return
Promise
.
resolve
(
this
.
loadConfigurationDelayer
.
trigger
(()
=>
this
.
doLoadFolderConfigurationContents
()));
return
Promise
.
resolve
(
this
.
loadConfigurationDelayer
.
trigger
(()
=>
this
.
doLoadFolderConfigurationContents
()));
}
}
private
doLoadFolderConfigurationContents
():
Promise
<
{
resource
:
URI
,
value
:
string
}[]
>
{
private
doLoadFolderConfigurationContents
():
Promise
<
Array
<
{
resource
:
URI
,
value
:
string
}
>
>
{
const
workspaceFilePathToConfiguration
:
{
[
relativeWorkspacePath
:
string
]:
Promise
<
IContent
>
}
=
Object
.
create
(
null
);
const
workspaceFilePathToConfiguration
:
{
[
relativeWorkspacePath
:
string
]:
Promise
<
IContent
>
}
=
Object
.
create
(
null
);
const
bulkContentFetchromise
=
Promise
.
resolve
(
this
.
fileService
.
resolveFile
(
this
.
folderConfigurationPath
))
const
bulkContentFetchromise
=
Promise
.
resolve
(
this
.
fileService
.
resolveFile
(
this
.
folderConfigurationPath
))
.
then
(
stat
=>
{
.
then
(
stat
=>
{
if
(
stat
.
isDirectory
&&
stat
.
children
)
{
if
(
stat
.
isDirectory
&&
stat
.
children
)
{
stat
.
children
stat
.
children
.
filter
(
child
=>
isFolderConfigurationFile
(
child
.
resource
))
.
filter
(
child
=>
isFolderConfigurationFile
(
child
.
resource
))
.
forEach
(
child
=>
workspaceFilePathToConfiguration
[
this
.
toFolderRelativePath
(
child
.
resource
)]
=
Promise
.
resolve
(
this
.
fileService
.
resolveContent
(
child
.
resource
)).
then
(
void
0
,
errors
.
onUnexpectedError
));
.
forEach
(
child
=>
{
const
folderRelativePath
=
this
.
toFolderRelativePath
(
child
.
resource
);
if
(
folderRelativePath
)
{
workspaceFilePathToConfiguration
[
folderRelativePath
]
=
Promise
.
resolve
(
this
.
fileService
.
resolveContent
(
child
.
resource
)).
then
(
void
0
,
errors
.
onUnexpectedError
);
}
});
}
}
}).
then
(
void
0
,
err
=>
[]
/* never fail this call */
);
}).
then
(
void
0
,
err
=>
[]
/* never fail this call */
);
...
@@ -336,7 +344,7 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
...
@@ -336,7 +344,7 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
}
}
}
}
private
toFolderRelativePath
(
resource
:
URI
):
string
{
private
toFolderRelativePath
(
resource
:
URI
):
string
|
null
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
if
(
paths
.
isEqualOrParent
(
resource
.
fsPath
,
this
.
folderConfigurationPath
.
fsPath
,
!
isLinux
/* ignorecase */
))
{
if
(
paths
.
isEqualOrParent
(
resource
.
fsPath
,
this
.
folderConfigurationPath
.
fsPath
,
!
isLinux
/* ignorecase */
))
{
return
paths
.
normalize
(
relative
(
this
.
folderConfigurationPath
.
fsPath
,
resource
.
fsPath
));
return
paths
.
normalize
(
relative
(
this
.
folderConfigurationPath
.
fsPath
,
resource
.
fsPath
));
...
@@ -387,7 +395,7 @@ export class CachedFolderConfiguration extends Disposable implements IFolderConf
...
@@ -387,7 +395,7 @@ export class CachedFolderConfiguration extends Disposable implements IFolderConf
if
(
created
)
{
if
(
created
)
{
return
configurationModel
.
keys
.
length
?
pfs
.
writeFile
(
this
.
cachedConfigurationPath
,
raw
)
:
pfs
.
rimraf
(
this
.
cachedFolderPath
);
return
configurationModel
.
keys
.
length
?
pfs
.
writeFile
(
this
.
cachedConfigurationPath
,
raw
)
:
pfs
.
rimraf
(
this
.
cachedFolderPath
);
}
}
return
null
;
return
void
0
;
});
});
}
}
...
@@ -492,6 +500,6 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat
...
@@ -492,6 +500,6 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat
return
this
.
folderConfiguration
.
loadConfiguration
()
return
this
.
folderConfiguration
.
loadConfiguration
()
.
then
(
configurationModel
=>
this
.
cachedFolderConfiguration
.
updateConfiguration
(
configurationModel
));
.
then
(
configurationModel
=>
this
.
cachedFolderConfiguration
.
updateConfiguration
(
configurationModel
));
}
}
return
Promise
.
resolve
(
null
);
return
Promise
.
resolve
(
void
0
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录