Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3f737ae1
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,发现更多精彩内容 >>
提交
3f737ae1
编写于
3月 05, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check textModelResolver
上级
7d884520
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
6 deletion
+8
-6
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-0
src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts
...ices/textmodelResolver/common/textModelResolverService.ts
+6
-6
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
3f737ae1
...
@@ -446,6 +446,8 @@
...
@@ -446,6 +446,8 @@
"./vs/workbench/services/textfile/common/textFileEditorModelManager.ts"
,
"./vs/workbench/services/textfile/common/textFileEditorModelManager.ts"
,
"./vs/workbench/services/textfile/common/textfiles.ts"
,
"./vs/workbench/services/textfile/common/textfiles.ts"
,
"./vs/workbench/services/textfile/node/textResourcePropertiesService.ts"
,
"./vs/workbench/services/textfile/node/textResourcePropertiesService.ts"
,
"./vs/workbench/services/textmodelResolver/common/textModelResolverService.ts"
,
"./vs/workbench/services/timer/electron-browser/timerService.ts"
,
"./vs/workbench/services/title/common/titleService.ts"
,
"./vs/workbench/services/title/common/titleService.ts"
,
"./vs/workbench/services/untitled/common/untitledEditorService.ts"
,
"./vs/workbench/services/untitled/common/untitledEditorService.ts"
,
"./vs/workbench/services/viewlet/browser/viewlet.ts"
,
"./vs/workbench/services/viewlet/browser/viewlet.ts"
,
...
...
src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts
浏览文件 @
3f737ae1
...
@@ -12,7 +12,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
...
@@ -12,7 +12,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
ITextFileService
,
LoadReason
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextFileService
,
LoadReason
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
*
as
network
from
'
vs/base/common/network
'
;
import
*
as
network
from
'
vs/base/common/network
'
;
import
{
ITextModelService
,
ITextModelContentProvider
,
ITextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ITextModelService
,
ITextModelContentProvider
,
ITextEditorModel
,
IActiveTextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
...
@@ -104,7 +104,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
...
@@ -104,7 +104,7 @@ class ResourceModelCollection extends ReferenceCollection<Promise<ITextEditorMod
private
resolveTextModelContent
(
key
:
string
):
Promise
<
ITextModel
>
{
private
resolveTextModelContent
(
key
:
string
):
Promise
<
ITextModel
>
{
const
resource
=
URI
.
parse
(
key
);
const
resource
=
URI
.
parse
(
key
);
const
providers
=
this
.
providers
[
resource
.
scheme
]
||
[];
const
providers
=
this
.
providers
[
resource
.
scheme
]
||
[];
const
factories
=
providers
.
map
(
p
=>
()
=>
Promise
.
resolve
(
p
.
provideTextContent
(
resource
)));
const
factories
=
providers
.
map
(
p
=>
()
=>
Promise
.
resolve
<
ITextModel
|
undefined
|
null
>
(
p
.
provideTextContent
(
resource
)));
return
first
(
factories
).
then
(
model
=>
{
return
first
(
factories
).
then
(
model
=>
{
if
(
!
model
)
{
if
(
!
model
)
{
...
@@ -130,15 +130,15 @@ export class TextModelResolverService implements ITextModelService {
...
@@ -130,15 +130,15 @@ export class TextModelResolverService implements ITextModelService {
this
.
resourceModelCollection
=
instantiationService
.
createInstance
(
ResourceModelCollection
);
this
.
resourceModelCollection
=
instantiationService
.
createInstance
(
ResourceModelCollection
);
}
}
createModelReference
(
resource
:
URI
):
Promise
<
IReference
<
ITextEditorModel
>>
{
createModelReference
(
resource
:
URI
):
Promise
<
IReference
<
I
Active
TextEditorModel
>>
{
return
this
.
_createModelReference
(
resource
);
return
this
.
_createModelReference
(
resource
);
}
}
private
_createModelReference
(
resource
:
URI
):
Promise
<
IReference
<
ITextEditorModel
>>
{
private
_createModelReference
(
resource
:
URI
):
Promise
<
IReference
<
I
Active
TextEditorModel
>>
{
// Untitled Schema: go through cached input
// Untitled Schema: go through cached input
if
(
resource
.
scheme
===
network
.
Schemas
.
untitled
)
{
if
(
resource
.
scheme
===
network
.
Schemas
.
untitled
)
{
return
this
.
untitledEditorService
.
loadOrCreate
({
resource
}).
then
(
model
=>
new
ImmortalReference
(
model
));
return
this
.
untitledEditorService
.
loadOrCreate
({
resource
}).
then
(
model
=>
new
ImmortalReference
(
model
as
IActiveTextEditorModel
));
}
}
// InMemory Schema: go through model service cache
// InMemory Schema: go through model service cache
...
@@ -149,7 +149,7 @@ export class TextModelResolverService implements ITextModelService {
...
@@ -149,7 +149,7 @@ export class TextModelResolverService implements ITextModelService {
return
Promise
.
reject
(
new
Error
(
'
Cant resolve inmemory resource
'
));
return
Promise
.
reject
(
new
Error
(
'
Cant resolve inmemory resource
'
));
}
}
return
Promise
.
resolve
(
new
ImmortalReference
(
this
.
instantiationService
.
createInstance
(
ResourceEditorModel
,
resource
)));
return
Promise
.
resolve
(
new
ImmortalReference
(
this
.
instantiationService
.
createInstance
(
ResourceEditorModel
,
resource
)
as
IActiveTextEditorModel
));
}
}
const
ref
=
this
.
resourceModelCollection
.
acquire
(
resource
.
toString
());
const
ref
=
this
.
resourceModelCollection
.
acquire
(
resource
.
toString
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录