Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4783f275
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,发现更多精彩内容 >>
提交
4783f275
编写于
11月 21, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix integration tests
上级
5e747c32
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
11 deletion
+42
-11
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+27
-4
src/vs/editor/common/services/bulkEdit.ts
src/vs/editor/common/services/bulkEdit.ts
+6
-1
src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts
...ices/textmodelResolver/common/textModelResolverService.ts
+9
-6
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
4783f275
...
...
@@ -368,15 +368,15 @@ export function always<T>(promise: TPromise<T>, f: Function): TPromise<T> {
* Runs the provided list of promise factories in sequential order. The returned
* promise will complete to an array of results from each promise.
*/
export
function
sequence
<
T
>
(
promiseFactor
y
:
ITask
<
TPromise
<
T
>>
[]):
TPromise
<
T
[]
>
{
export
function
sequence
<
T
>
(
promiseFactor
ies
:
ITask
<
TPromise
<
T
>>
[]):
TPromise
<
T
[]
>
{
const
results
:
T
[]
=
[];
// reverse since we start with last element using pop()
promiseFactor
y
=
promiseFactory
.
reverse
();
promiseFactor
ies
=
promiseFactories
.
reverse
();
function
next
():
Promise
{
if
(
promiseFactor
y
.
length
)
{
return
promiseFactor
y
.
pop
()();
if
(
promiseFactor
ies
.
length
)
{
return
promiseFactor
ies
.
pop
()();
}
return
null
;
...
...
@@ -398,6 +398,29 @@ export function sequence<T>(promiseFactory: ITask<TPromise<T>>[]): TPromise<T[]>
return
TPromise
.
as
(
null
).
then
(
thenHandler
);
}
export
function
first
<
T
>
(
promiseFactories
:
ITask
<
TPromise
<
T
>>
[],
shouldStop
:
(
t
:
T
)
=>
boolean
=
t
=>
!!
t
):
TPromise
<
T
>
{
promiseFactories
=
[...
promiseFactories
.
reverse
()];
const
loop
=
()
=>
{
if
(
promiseFactories
.
length
===
0
)
{
return
TPromise
.
as
(
null
);
}
const
factory
=
promiseFactories
.
pop
();
const
promise
=
factory
();
return
promise
.
then
(
result
=>
{
if
(
shouldStop
(
result
))
{
return
TPromise
.
as
(
result
);
}
return
loop
();
});
};
return
loop
();
}
export
function
once
<
T
extends
Function
>
(
fn
:
T
):
T
{
const
_this
=
this
;
let
didCall
=
false
;
...
...
src/vs/editor/common/services/bulkEdit.ts
浏览文件 @
4783f275
...
...
@@ -76,6 +76,7 @@ class EditTask implements IDisposable {
constructor
(
model
:
IModel
,
modelReference
:
IDisposable
)
{
this
.
_endCursorSelection
=
null
;
this
.
_model
=
model
;
this
.
_modelReference
=
modelReference
;
this
.
_edits
=
[];
}
...
...
@@ -142,7 +143,11 @@ class EditTask implements IDisposable {
}
dispose
()
{
this
.
_modelReference
.
dispose
();
if
(
this
.
_model
)
{
this
.
_modelReference
.
dispose
();
this
.
_modelReference
=
null
;
this
.
_model
=
null
;
}
}
}
...
...
src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts
浏览文件 @
4783f275
...
...
@@ -6,6 +6,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
first
}
from
'
vs/base/common/async
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IDisposable
,
toDisposable
,
IReference
,
ReferenceCollection
,
ImmortalReference
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -83,14 +84,16 @@ class ResourceModelCollection extends ReferenceCollection<URI, TPromise<ITextEdi
return
TPromise
.
as
(
model
);
}
// TODO@Joao just take the first one for now
const
provider
=
(
this
.
providers
[
resource
.
scheme
]
||
[])[
0
]
;
const
providers
=
this
.
providers
[
resource
.
scheme
]
||
[];
const
factories
=
providers
.
map
(
p
=>
()
=>
p
.
provideTextContent
(
resource
))
;
if
(
!
provider
)
{
return
TPromise
.
wrapError
(
`No model with uri '
${
resource
}
' nor a resolver for the scheme '
${
resource
.
scheme
}
'.`
);
}
return
first
(
factories
).
then
(
uri
=>
{
if
(
!
uri
)
{
return
TPromise
.
wrapError
(
`Could not resolve any model with uri '
${
resource
}
'.`
);
}
return
provider
.
provideTextContent
(
resource
);
return
uri
;
});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录