Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3bf2a074
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,发现更多精彩内容 >>
提交
3bf2a074
编写于
7月 03, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of winjs promise progress
上级
5ffd9f50
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
18 addition
and
24 deletion
+18
-24
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+1
-1
src/vs/base/common/worker/simpleWorker.ts
src/vs/base/common/worker/simpleWorker.ts
+4
-4
src/vs/base/node/processes.ts
src/vs/base/node/processes.ts
+2
-2
src/vs/base/test/common/utils.ts
src/vs/base/test/common/utils.ts
+3
-9
src/vs/base/test/common/winjs.promise.test.ts
src/vs/base/test/common/winjs.promise.test.ts
+2
-2
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+1
-1
src/vs/editor/standalone/browser/colorizer.ts
src/vs/editor/standalone/browser/colorizer.ts
+2
-2
src/vs/platform/integrity/node/integrityServiceImpl.ts
src/vs/platform/integrity/node/integrityServiceImpl.ts
+1
-1
src/vs/workbench/services/extensions/node/extensionPoints.ts
src/vs/workbench/services/extensions/node/extensionPoints.ts
+2
-2
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
3bf2a074
...
@@ -352,7 +352,7 @@ export class Barrier {
...
@@ -352,7 +352,7 @@ export class Barrier {
constructor
()
{
constructor
()
{
this
.
_isOpen
=
false
;
this
.
_isOpen
=
false
;
this
.
_promise
=
new
TPromise
<
boolean
>
((
c
,
e
,
p
)
=>
{
this
.
_promise
=
new
TPromise
<
boolean
>
((
c
,
e
)
=>
{
this
.
_completePromise
=
c
;
this
.
_completePromise
=
c
;
},
()
=>
{
},
()
=>
{
console
.
warn
(
'
You should really not try to cancel this ready promise!
'
);
console
.
warn
(
'
You should really not try to cancel this ready promise!
'
);
...
...
src/vs/base/common/worker/simpleWorker.ts
浏览文件 @
3bf2a074
...
@@ -91,7 +91,7 @@ class SimpleWorkerProtocol {
...
@@ -91,7 +91,7 @@ class SimpleWorkerProtocol {
c
:
null
,
c
:
null
,
e
:
null
e
:
null
};
};
let
result
=
new
TPromise
<
any
>
((
c
,
e
,
p
)
=>
{
let
result
=
new
TPromise
<
any
>
((
c
,
e
)
=>
{
reply
.
c
=
c
;
reply
.
c
=
c
;
reply
.
e
=
e
;
reply
.
e
=
e
;
},
()
=>
{
},
()
=>
{
...
@@ -232,7 +232,7 @@ export class SimpleWorkerClient<T> extends Disposable {
...
@@ -232,7 +232,7 @@ export class SimpleWorkerClient<T> extends Disposable {
loaderConfiguration
=
(
<
any
>
self
).
requirejs
.
s
.
contexts
.
_
.
config
;
loaderConfiguration
=
(
<
any
>
self
).
requirejs
.
s
.
contexts
.
_
.
config
;
}
}
this
.
_lazyProxy
=
new
TPromise
<
T
>
((
c
,
e
,
p
)
=>
{
this
.
_lazyProxy
=
new
TPromise
<
T
>
((
c
,
e
)
=>
{
lazyProxyFulfill
=
c
;
lazyProxyFulfill
=
c
;
lazyProxyReject
=
e
;
lazyProxyReject
=
e
;
},
()
=>
{
/* no cancel */
});
},
()
=>
{
/* no cancel */
});
...
@@ -273,7 +273,7 @@ export class SimpleWorkerClient<T> extends Disposable {
...
@@ -273,7 +273,7 @@ export class SimpleWorkerClient<T> extends Disposable {
}
}
private
_request
(
method
:
string
,
args
:
any
[]):
TPromise
<
any
>
{
private
_request
(
method
:
string
,
args
:
any
[]):
TPromise
<
any
>
{
return
new
TPromise
<
any
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
any
>
((
c
,
e
)
=>
{
this
.
_onModuleLoaded
.
then
(()
=>
{
this
.
_onModuleLoaded
.
then
(()
=>
{
this
.
_protocol
.
sendMessage
(
method
,
args
).
then
(
c
,
e
);
this
.
_protocol
.
sendMessage
(
method
,
args
).
then
(
c
,
e
);
},
e
);
},
e
);
...
@@ -363,7 +363,7 @@ export class SimpleWorkerServer {
...
@@ -363,7 +363,7 @@ export class SimpleWorkerServer {
let
cc
:
ValueCallback
;
let
cc
:
ValueCallback
;
let
ee
:
ErrorCallback
;
let
ee
:
ErrorCallback
;
let
r
=
new
TPromise
<
any
>
((
c
,
e
,
p
)
=>
{
let
r
=
new
TPromise
<
any
>
((
c
,
e
)
=>
{
cc
=
c
;
cc
=
c
;
ee
=
e
;
ee
=
e
;
});
});
...
...
src/vs/base/node/processes.ts
浏览文件 @
3bf2a074
...
@@ -234,7 +234,7 @@ export abstract class AbstractProcess<TProgressData> {
...
@@ -234,7 +234,7 @@ export abstract class AbstractProcess<TProgressData> {
if
(
this
.
cmd
)
{
if
(
this
.
cmd
)
{
childProcess
=
cp
.
spawn
(
this
.
cmd
,
this
.
args
,
this
.
options
);
childProcess
=
cp
.
spawn
(
this
.
cmd
,
this
.
args
,
this
.
options
);
}
else
if
(
this
.
module
)
{
}
else
if
(
this
.
module
)
{
this
.
childProcessPromise
=
new
TPromise
<
cp
.
ChildProcess
>
((
c
,
e
,
p
)
=>
{
this
.
childProcessPromise
=
new
TPromise
<
cp
.
ChildProcess
>
((
c
,
e
)
=>
{
fork
(
this
.
module
,
this
.
args
,
<
ForkOptions
>
this
.
options
,
(
error
:
any
,
childProcess
:
cp
.
ChildProcess
)
=>
{
fork
(
this
.
module
,
this
.
args
,
<
ForkOptions
>
this
.
options
,
(
error
:
any
,
childProcess
:
cp
.
ChildProcess
)
=>
{
if
(
error
)
{
if
(
error
)
{
e
(
error
);
e
(
error
);
...
@@ -323,7 +323,7 @@ export abstract class AbstractProcess<TProgressData> {
...
@@ -323,7 +323,7 @@ export abstract class AbstractProcess<TProgressData> {
}
}
private
useExec
():
TPromise
<
boolean
>
{
private
useExec
():
TPromise
<
boolean
>
{
return
new
TPromise
<
boolean
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
boolean
>
((
c
,
e
)
=>
{
if
(
!
this
.
shell
||
!
Platform
.
isWindows
)
{
if
(
!
this
.
shell
||
!
Platform
.
isWindows
)
{
c
(
false
);
c
(
false
);
}
}
...
...
src/vs/base/test/common/utils.ts
浏览文件 @
3bf2a074
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
PPromise
,
ProgressCallback
,
TProgressCallback
,
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
PPromise
,
TProgressCallback
,
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
export
class
DeferredTPromise
<
T
>
extends
TPromise
<
T
>
{
export
class
DeferredTPromise
<
T
>
extends
TPromise
<
T
>
{
...
@@ -16,17 +16,15 @@ export class DeferredTPromise<T> extends TPromise<T> {
...
@@ -16,17 +16,15 @@ export class DeferredTPromise<T> extends TPromise<T> {
private
completeCallback
:
TValueCallback
<
T
>
;
private
completeCallback
:
TValueCallback
<
T
>
;
private
errorCallback
:
(
err
:
any
)
=>
void
;
private
errorCallback
:
(
err
:
any
)
=>
void
;
private
progressCallback
:
ProgressCallback
;
constructor
()
{
constructor
()
{
let
captured
:
any
;
let
captured
:
any
;
super
((
c
,
e
,
p
)
=>
{
super
((
c
,
e
)
=>
{
captured
=
{
c
,
e
,
p
};
captured
=
{
c
,
e
};
},
()
=>
this
.
oncancel
());
},
()
=>
this
.
oncancel
());
this
.
canceled
=
false
;
this
.
canceled
=
false
;
this
.
completeCallback
=
captured
.
c
;
this
.
completeCallback
=
captured
.
c
;
this
.
errorCallback
=
captured
.
e
;
this
.
errorCallback
=
captured
.
e
;
this
.
progressCallback
=
captured
.
p
;
}
}
public
complete
(
value
:
T
)
{
public
complete
(
value
:
T
)
{
...
@@ -37,10 +35,6 @@ export class DeferredTPromise<T> extends TPromise<T> {
...
@@ -37,10 +35,6 @@ export class DeferredTPromise<T> extends TPromise<T> {
this
.
errorCallback
(
err
);
this
.
errorCallback
(
err
);
}
}
public
progress
(
p
:
any
)
{
this
.
progressCallback
(
p
);
}
private
oncancel
():
void
{
private
oncancel
():
void
{
this
.
canceled
=
true
;
this
.
canceled
=
true
;
}
}
...
...
src/vs/base/test/common/winjs.promise.test.ts
浏览文件 @
3bf2a074
...
@@ -11,7 +11,7 @@ suite('WinJS and ES6 Promises', function () {
...
@@ -11,7 +11,7 @@ suite('WinJS and ES6 Promises', function () {
test
(
'
Promise.resolve
'
,
function
()
{
test
(
'
Promise.resolve
'
,
function
()
{
let
resolveTPromise
;
let
resolveTPromise
;
const
tPromise
=
new
winjs
.
Promise
(
function
(
c
,
e
,
p
)
{
const
tPromise
=
new
winjs
.
Promise
(
(
c
,
e
)
=>
{
resolveTPromise
=
c
;
resolveTPromise
=
c
;
});
});
...
@@ -28,7 +28,7 @@ suite('WinJS and ES6 Promises', function () {
...
@@ -28,7 +28,7 @@ suite('WinJS and ES6 Promises', function () {
test
(
'
new Promise
'
,
function
()
{
test
(
'
new Promise
'
,
function
()
{
let
resolveTPromise
;
let
resolveTPromise
;
const
tPromise
=
new
winjs
.
Promise
(
function
(
c
,
e
,
p
)
{
const
tPromise
=
new
winjs
.
Promise
(
(
c
,
e
)
=>
{
resolveTPromise
=
c
;
resolveTPromise
=
c
;
});
});
...
...
src/vs/editor/common/model/textModel.ts
浏览文件 @
3bf2a074
...
@@ -46,7 +46,7 @@ export function createTextBufferFactory(text: string): model.ITextBufferFactory
...
@@ -46,7 +46,7 @@ export function createTextBufferFactory(text: string): model.ITextBufferFactory
}
}
export
function
createTextBufferFactoryFromStream
(
stream
:
IStringStream
,
filter
?:
(
chunk
:
string
)
=>
string
):
TPromise
<
model
.
ITextBufferFactory
>
{
export
function
createTextBufferFactoryFromStream
(
stream
:
IStringStream
,
filter
?:
(
chunk
:
string
)
=>
string
):
TPromise
<
model
.
ITextBufferFactory
>
{
return
new
TPromise
<
model
.
ITextBufferFactory
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
model
.
ITextBufferFactory
>
((
c
,
e
)
=>
{
let
done
=
false
;
let
done
=
false
;
let
builder
=
createTextBufferBuilder
();
let
builder
=
createTextBufferBuilder
();
...
...
src/vs/editor/standalone/browser/colorizer.ts
浏览文件 @
3bf2a074
...
@@ -42,7 +42,7 @@ export class Colorizer {
...
@@ -42,7 +42,7 @@ export class Colorizer {
let
render
=
(
str
:
string
)
=>
{
let
render
=
(
str
:
string
)
=>
{
domNode
.
innerHTML
=
str
;
domNode
.
innerHTML
=
str
;
};
};
return
this
.
colorize
(
modeService
,
text
,
mimeType
,
options
).
then
(
render
,
(
err
)
=>
console
.
error
(
err
)
,
render
);
return
this
.
colorize
(
modeService
,
text
,
mimeType
,
options
).
then
(
render
,
(
err
)
=>
console
.
error
(
err
));
}
}
private
static
_tokenizationSupportChangedPromise
(
language
:
string
):
TPromise
<
void
>
{
private
static
_tokenizationSupportChangedPromise
(
language
:
string
):
TPromise
<
void
>
{
...
@@ -54,7 +54,7 @@ export class Colorizer {
...
@@ -54,7 +54,7 @@ export class Colorizer {
}
}
};
};
return
new
TPromise
<
void
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
void
>
((
c
,
e
)
=>
{
listener
=
TokenizationRegistry
.
onDidChange
((
e
)
=>
{
listener
=
TokenizationRegistry
.
onDidChange
((
e
)
=>
{
if
(
e
.
changedLanguages
.
indexOf
(
language
)
>=
0
)
{
if
(
e
.
changedLanguages
.
indexOf
(
language
)
>=
0
)
{
stopListening
();
stopListening
();
...
...
src/vs/platform/integrity/node/integrityServiceImpl.ts
浏览文件 @
3bf2a074
...
@@ -133,7 +133,7 @@ export class IntegrityServiceImpl implements IIntegrityService {
...
@@ -133,7 +133,7 @@ export class IntegrityServiceImpl implements IIntegrityService {
private
_resolve
(
filename
:
string
,
expected
:
string
):
TPromise
<
ChecksumPair
>
{
private
_resolve
(
filename
:
string
,
expected
:
string
):
TPromise
<
ChecksumPair
>
{
let
fileUri
=
URI
.
parse
(
require
.
toUrl
(
filename
));
let
fileUri
=
URI
.
parse
(
require
.
toUrl
(
filename
));
return
new
TPromise
<
ChecksumPair
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
ChecksumPair
>
((
c
,
e
)
=>
{
fs
.
readFile
(
fileUri
.
fsPath
,
(
err
,
buff
)
=>
{
fs
.
readFile
(
fileUri
.
fsPath
,
(
err
,
buff
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
e
(
err
);
return
e
(
err
);
...
...
src/vs/workbench/services/extensions/node/extensionPoints.ts
浏览文件 @
3bf2a074
...
@@ -208,7 +208,7 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
...
@@ -208,7 +208,7 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
* Parses original message bundle, returns null if the original message bundle is null.
* Parses original message bundle, returns null if the original message bundle is null.
*/
*/
private
static
resolveOriginalMessageBundle
(
originalMessageBundle
:
string
,
errors
:
json
.
ParseError
[])
{
private
static
resolveOriginalMessageBundle
(
originalMessageBundle
:
string
,
errors
:
json
.
ParseError
[])
{
return
new
TPromise
<
{
[
key
:
string
]:
string
;
}
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
{
[
key
:
string
]:
string
;
}
>
((
c
,
e
)
=>
{
if
(
originalMessageBundle
)
{
if
(
originalMessageBundle
)
{
pfs
.
readFile
(
originalMessageBundle
).
then
(
originalBundleContent
=>
{
pfs
.
readFile
(
originalMessageBundle
).
then
(
originalBundleContent
=>
{
c
(
json
.
parse
(
originalBundleContent
.
toString
(),
errors
));
c
(
json
.
parse
(
originalBundleContent
.
toString
(),
errors
));
...
@@ -226,7 +226,7 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
...
@@ -226,7 +226,7 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
* If the localized file is not present, returns null for the original and marks original as localized.
* If the localized file is not present, returns null for the original and marks original as localized.
*/
*/
private
static
findMessageBundles
(
nlsConfig
:
NlsConfiguration
,
basename
:
string
):
TPromise
<
{
localized
:
string
,
original
:
string
}
>
{
private
static
findMessageBundles
(
nlsConfig
:
NlsConfiguration
,
basename
:
string
):
TPromise
<
{
localized
:
string
,
original
:
string
}
>
{
return
new
TPromise
<
{
localized
:
string
,
original
:
string
}
>
((
c
,
e
,
p
)
=>
{
return
new
TPromise
<
{
localized
:
string
,
original
:
string
}
>
((
c
,
e
)
=>
{
function
loop
(
basename
:
string
,
locale
:
string
):
void
{
function
loop
(
basename
:
string
,
locale
:
string
):
void
{
let
toCheck
=
`
${
basename
}
.nls.
${
locale
}
.json`
;
let
toCheck
=
`
${
basename
}
.nls.
${
locale
}
.json`
;
pfs
.
fileExists
(
toCheck
).
then
(
exists
=>
{
pfs
.
fileExists
(
toCheck
).
then
(
exists
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录