Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6a586e39
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,发现更多精彩内容 >>
提交
6a586e39
编写于
6月 05, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - don't refer to WinJS.Promise as Promise
上级
211a5d8b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
13 deletion
+17
-13
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+12
-12
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
...kbench/services/textfile/test/textFileEditorModel.test.ts
+5
-1
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
6a586e39
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
Promise
,
TPromise
,
ValueCallback
,
ErrorCallback
,
ProgressCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
,
ValueCallback
,
ErrorCallback
,
ProgressCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
CancellationToken
,
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -131,9 +131,9 @@ export interface ITask<T> {
*/
export
class
Throttler
{
private
activePromise
:
Promise
;
private
queuedPromise
:
Promise
;
private
queuedPromiseFactory
:
ITask
<
Promise
>
;
private
activePromise
:
T
Promise
;
private
queuedPromise
:
T
Promise
;
private
queuedPromiseFactory
:
ITask
<
T
Promise
>
;
constructor
()
{
this
.
activePromise
=
null
;
...
...
@@ -221,7 +221,7 @@ export class SimpleThrottler {
export
class
Delayer
<
T
>
{
private
timeout
:
number
;
private
completionPromise
:
Promise
;
private
completionPromise
:
T
Promise
;
private
onSuccess
:
ValueCallback
;
private
task
:
ITask
<
T
|
TPromise
<
T
>>
;
...
...
@@ -357,10 +357,10 @@ export class ShallowCancelThenPromise<T> extends TPromise<T> {
}
/**
* Replacement for `WinJS.Promise.timeout`.
* Replacement for `WinJS.
T
Promise.timeout`.
*/
export
function
timeout
(
n
:
number
):
Promis
e
<
void
>
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
n
));
export
function
timeout
(
n
:
number
):
Thenabl
e
<
void
>
{
return
new
T
Promise
(
resolve
=>
setTimeout
(
resolve
,
n
));
}
function
isWinJSPromise
(
candidate
:
any
):
candidate
is
TPromise
{
...
...
@@ -466,7 +466,7 @@ export function first<T>(promiseFactories: ITask<TPromise<T>>[], shouldStop: (t:
}
interface
ILimitedTaskFactory
{
factory
:
ITask
<
Promise
>
;
factory
:
ITask
<
T
Promise
>
;
c
:
ValueCallback
;
e
:
ErrorCallback
;
p
:
ProgressCallback
;
...
...
@@ -497,7 +497,7 @@ export class Limiter<T> {
return
this
.
runningPromises
+
this
.
outstandingPromises
.
length
;
}
queue
(
promiseFactory
:
ITask
<
Promise
>
):
Promise
;
queue
(
promiseFactory
:
ITask
<
TPromise
>
):
T
Promise
;
queue
(
promiseFactory
:
ITask
<
TPromise
<
T
>>
):
TPromise
<
T
>
{
return
new
TPromise
<
T
>
((
c
,
e
,
p
)
=>
{
this
.
outstandingPromises
.
push
({
...
...
@@ -737,13 +737,13 @@ export class RunOnceWorker<T> extends RunOnceScheduler {
}
}
export
function
nfcall
(
fn
:
Function
,
...
args
:
any
[]):
Promise
;
export
function
nfcall
(
fn
:
Function
,
...
args
:
any
[]):
T
Promise
;
export
function
nfcall
<
T
>
(
fn
:
Function
,
...
args
:
any
[]):
TPromise
<
T
>
;
export
function
nfcall
(
fn
:
Function
,
...
args
:
any
[]):
any
{
return
new
TPromise
((
c
,
e
)
=>
fn
(...
args
,
(
err
:
any
,
result
:
any
)
=>
err
?
e
(
err
)
:
c
(
result
)),
()
=>
null
);
}
export
function
ninvoke
(
thisArg
:
any
,
fn
:
Function
,
...
args
:
any
[]):
Promise
;
export
function
ninvoke
(
thisArg
:
any
,
fn
:
Function
,
...
args
:
any
[]):
T
Promise
;
export
function
ninvoke
<
T
>
(
thisArg
:
any
,
fn
:
Function
,
...
args
:
any
[]):
TPromise
<
T
>
;
export
function
ninvoke
(
thisArg
:
any
,
fn
:
Function
,
...
args
:
any
[]):
any
{
return
new
TPromise
((
c
,
e
)
=>
fn
.
call
(
thisArg
,
...
args
,
(
err
:
any
,
result
:
any
)
=>
err
?
e
(
err
)
:
c
(
result
)),
()
=>
null
);
...
...
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
浏览文件 @
6a586e39
...
...
@@ -16,7 +16,11 @@ import { toResource } from 'vs/base/test/common/utils';
import
{
TextFileEditorModelManager
}
from
'
vs/workbench/services/textfile/common/textFileEditorModelManager
'
;
import
{
FileOperationResult
,
FileOperationError
,
IFileService
,
snapshotToString
}
from
'
vs/platform/files/common/files
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
timeout
as
thenableTimeout
}
from
'
vs/base/common/async
'
;
function
timeout
(
n
:
number
)
{
return
TPromise
.
wrap
(
thenableTimeout
(
n
));
}
class
ServiceAccessor
{
constructor
(@
ITextFileService
public
textFileService
:
TestTextFileService
,
@
IModelService
public
modelService
:
IModelService
,
@
IFileService
public
fileService
:
TestFileService
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录