Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
364e1a85
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,发现更多精彩内容 >>
提交
364e1a85
编写于
11月 07, 2018
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert TPromise -> Promise.
上级
362e69ad
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
34 addition
and
35 deletion
+34
-35
src/vs/base/node/processes.ts
src/vs/base/node/processes.ts
+22
-21
src/vs/workbench/parts/tasks/common/problemMatcher.ts
src/vs/workbench/parts/tasks/common/problemMatcher.ts
+8
-9
src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts
...vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts
+4
-5
未找到文件。
src/vs/base/node/processes.ts
浏览文件 @
364e1a85
...
...
@@ -7,7 +7,6 @@ import * as path from 'path';
import
*
as
fs
from
'
fs
'
;
import
*
as
cp
from
'
child_process
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
TPromise
,
TValueCallback
,
ErrorCallback
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
Types
from
'
vs/base/common/types
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
import
*
as
Objects
from
'
vs/base/common/objects
'
;
...
...
@@ -18,7 +17,9 @@ import { CommandOptions, ForkOptions, SuccessData, Source, TerminateResponse, Te
import
{
getPathFromAmdModule
}
from
'
vs/base/common/amd
'
;
export
{
CommandOptions
,
ForkOptions
,
SuccessData
,
Source
,
TerminateResponse
,
TerminateResponseCode
};
export
type
TProgressCallback
<
T
>
=
(
progress
:
T
)
=>
void
;
export
type
ValueCallback
<
T
>
=
(
value
?:
T
|
Thenable
<
T
>
)
=>
void
;
export
type
ErrorCallback
=
(
error
?:
any
)
=>
void
;
export
type
ProgressCallback
<
T
>
=
(
progress
:
T
)
=>
void
;
export
interface
LineData
{
line
:
string
;
...
...
@@ -78,8 +79,8 @@ export abstract class AbstractProcess<TProgressData> {
protected
shell
:
boolean
;
private
childProcess
:
cp
.
ChildProcess
|
null
;
protected
childProcessPromise
:
T
Promise
<
cp
.
ChildProcess
>
|
null
;
private
pidResolve
?:
T
ValueCallback
<
number
>
;
protected
childProcessPromise
:
Promise
<
cp
.
ChildProcess
>
|
null
;
private
pidResolve
?:
ValueCallback
<
number
>
;
protected
terminateRequested
:
boolean
;
private
static
WellKnowCommands
:
IStringDictionary
<
boolean
>
=
{
...
...
@@ -146,14 +147,14 @@ export abstract class AbstractProcess<TProgressData> {
return
'
other
'
;
}
public
start
(
pp
:
TProgressCallback
<
TProgressData
>
):
T
Promise
<
SuccessData
>
{
public
start
(
pp
:
ProgressCallback
<
TProgressData
>
):
Promise
<
SuccessData
>
{
if
(
Platform
.
isWindows
&&
((
this
.
options
&&
this
.
options
.
cwd
&&
TPath
.
isUNC
(
this
.
options
.
cwd
))
||
!
this
.
options
&&
TPath
.
isUNC
(
process
.
cwd
())))
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
TaskRunner.UNC
'
,
'
Can
\'
t execute a shell command on a UNC drive.
'
)));
return
Promise
.
reject
(
new
Error
(
nls
.
localize
(
'
TaskRunner.UNC
'
,
'
Can
\'
t execute a shell command on a UNC drive.
'
)));
}
return
this
.
useExec
().
then
((
useExec
)
=>
{
let
cc
:
T
ValueCallback
<
SuccessData
>
;
let
cc
:
ValueCallback
<
SuccessData
>
;
let
ee
:
ErrorCallback
;
let
result
=
new
T
Promise
<
any
>
((
c
,
e
)
=>
{
let
result
=
new
Promise
<
any
>
((
c
,
e
)
=>
{
cc
=
c
;
ee
=
e
;
});
...
...
@@ -229,7 +230,7 @@ export abstract class AbstractProcess<TProgressData> {
}
if
(
childProcess
)
{
this
.
childProcess
=
childProcess
;
this
.
childProcessPromise
=
TPromise
.
as
(
childProcess
);
this
.
childProcessPromise
=
Promise
.
resolve
(
childProcess
);
if
(
this
.
pidResolve
)
{
this
.
pidResolve
(
Types
.
isNumber
(
childProcess
.
pid
)
?
childProcess
.
pid
:
-
1
);
this
.
pidResolve
=
undefined
;
...
...
@@ -248,10 +249,10 @@ export abstract class AbstractProcess<TProgressData> {
});
}
protected
abstract
handleExec
(
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
TProgressData
>
,
error
:
Error
|
null
,
stdout
:
Buffer
,
stderr
:
Buffer
):
void
;
protected
abstract
handleSpawn
(
childProcess
:
cp
.
ChildProcess
,
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
TProgressData
>
,
ee
:
ErrorCallback
,
sync
:
boolean
):
void
;
protected
abstract
handleExec
(
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
TProgressData
>
,
error
:
Error
|
null
,
stdout
:
Buffer
,
stderr
:
Buffer
):
void
;
protected
abstract
handleSpawn
(
childProcess
:
cp
.
ChildProcess
,
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
TProgressData
>
,
ee
:
ErrorCallback
,
sync
:
boolean
):
void
;
protected
handleClose
(
data
:
any
,
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
TProgressData
>
,
ee
:
ErrorCallback
):
void
{
protected
handleClose
(
data
:
any
,
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
TProgressData
>
,
ee
:
ErrorCallback
):
void
{
// Default is to do nothing.
}
...
...
@@ -270,19 +271,19 @@ export abstract class AbstractProcess<TProgressData> {
}
}
public
get
pid
():
T
Promise
<
number
>
{
public
get
pid
():
Promise
<
number
>
{
if
(
this
.
childProcessPromise
)
{
return
this
.
childProcessPromise
.
then
(
childProcess
=>
childProcess
.
pid
,
err
=>
-
1
);
}
else
{
return
new
T
Promise
<
number
>
((
resolve
)
=>
{
return
new
Promise
<
number
>
((
resolve
)
=>
{
this
.
pidResolve
=
resolve
;
});
}
}
public
terminate
():
T
Promise
<
TerminateResponse
>
{
public
terminate
():
Promise
<
TerminateResponse
>
{
if
(
!
this
.
childProcessPromise
)
{
return
TPromise
.
as
<
TerminateResponse
>
({
success
:
true
});
return
Promise
.
resolve
<
TerminateResponse
>
({
success
:
true
});
}
return
this
.
childProcessPromise
.
then
((
childProcess
)
=>
{
this
.
terminateRequested
=
true
;
...
...
@@ -296,8 +297,8 @@ export abstract class AbstractProcess<TProgressData> {
});
}
private
useExec
():
T
Promise
<
boolean
>
{
return
new
T
Promise
<
boolean
>
((
c
,
e
)
=>
{
private
useExec
():
Promise
<
boolean
>
{
return
new
Promise
<
boolean
>
((
c
,
e
)
=>
{
if
(
!
this
.
shell
||
!
Platform
.
isWindows
)
{
c
(
false
);
}
...
...
@@ -323,7 +324,7 @@ export class LineProcess extends AbstractProcess<LineData> {
super
(
<
any
>
arg1
,
arg2
,
<
any
>
arg3
,
arg4
);
}
protected
handleExec
(
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
LineData
>
,
error
:
Error
,
stdout
:
Buffer
,
stderr
:
Buffer
)
{
protected
handleExec
(
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
LineData
>
,
error
:
Error
,
stdout
:
Buffer
,
stderr
:
Buffer
)
{
[
stdout
,
stderr
].
forEach
((
buffer
:
Buffer
,
index
:
number
)
=>
{
let
lineDecoder
=
new
LineDecoder
();
let
lines
=
lineDecoder
.
write
(
buffer
);
...
...
@@ -338,7 +339,7 @@ export class LineProcess extends AbstractProcess<LineData> {
cc
({
terminated
:
this
.
terminateRequested
,
error
:
error
});
}
protected
handleSpawn
(
childProcess
:
cp
.
ChildProcess
,
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
LineData
>
,
ee
:
ErrorCallback
,
sync
:
boolean
):
void
{
protected
handleSpawn
(
childProcess
:
cp
.
ChildProcess
,
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
LineData
>
,
ee
:
ErrorCallback
,
sync
:
boolean
):
void
{
this
.
stdoutLineDecoder
=
new
LineDecoder
();
this
.
stderrLineDecoder
=
new
LineDecoder
();
childProcess
.
stdout
.
on
(
'
data
'
,
(
data
:
Buffer
)
=>
{
...
...
@@ -351,7 +352,7 @@ export class LineProcess extends AbstractProcess<LineData> {
});
}
protected
handleClose
(
data
:
any
,
cc
:
TValueCallback
<
SuccessData
>
,
pp
:
T
ProgressCallback
<
LineData
>
,
ee
:
ErrorCallback
):
void
{
protected
handleClose
(
data
:
any
,
cc
:
ValueCallback
<
SuccessData
>
,
pp
:
ProgressCallback
<
LineData
>
,
ee
:
ErrorCallback
):
void
{
[
this
.
stdoutLineDecoder
.
end
(),
this
.
stderrLineDecoder
.
end
()].
forEach
((
line
,
index
)
=>
{
if
(
line
)
{
pp
({
line
:
line
,
source
:
index
===
0
?
Source
.
stdout
:
Source
.
stderr
});
...
...
src/vs/workbench/parts/tasks/common/problemMatcher.ts
浏览文件 @
364e1a85
...
...
@@ -14,7 +14,6 @@ import * as UUID from 'vs/base/common/uuid';
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
ValidationStatus
,
ValidationState
,
IProblemReporter
,
Parser
}
from
'
vs/base/common/parsers
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
...
...
@@ -1099,7 +1098,7 @@ let problemPatternExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.Na
});
export
interface
IProblemPatternRegistry
{
onReady
():
T
Promise
<
void
>
;
onReady
():
Promise
<
void
>
;
get
(
key
:
string
):
ProblemPattern
|
MultiLineProblemPattern
;
}
...
...
@@ -1107,12 +1106,12 @@ export interface IProblemPatternRegistry {
class
ProblemPatternRegistryImpl
implements
IProblemPatternRegistry
{
private
patterns
:
IStringDictionary
<
ProblemPattern
|
ProblemPattern
[]
>
;
private
readyPromise
:
T
Promise
<
void
>
;
private
readyPromise
:
Promise
<
void
>
;
constructor
()
{
this
.
patterns
=
Object
.
create
(
null
);
this
.
fillDefaults
();
this
.
readyPromise
=
new
T
Promise
<
void
>
((
resolve
,
reject
)
=>
{
this
.
readyPromise
=
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
problemPatternExtPoint
.
setHandler
((
extensions
)
=>
{
// We get all statically know extension during startup in one batch
try
{
...
...
@@ -1149,7 +1148,7 @@ class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
});
}
public
onReady
():
T
Promise
<
void
>
{
public
onReady
():
Promise
<
void
>
{
return
this
.
readyPromise
;
}
...
...
@@ -1667,7 +1666,7 @@ let problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.N
});
export
interface
IProblemMatcherRegistry
{
onReady
():
T
Promise
<
void
>
;
onReady
():
Promise
<
void
>
;
get
(
name
:
string
):
NamedProblemMatcher
;
keys
():
string
[];
}
...
...
@@ -1675,12 +1674,12 @@ export interface IProblemMatcherRegistry {
class
ProblemMatcherRegistryImpl
implements
IProblemMatcherRegistry
{
private
matchers
:
IStringDictionary
<
NamedProblemMatcher
>
;
private
readyPromise
:
T
Promise
<
void
>
;
private
readyPromise
:
Promise
<
void
>
;
constructor
()
{
this
.
matchers
=
Object
.
create
(
null
);
this
.
fillDefaults
();
this
.
readyPromise
=
new
T
Promise
<
void
>
((
resolve
,
reject
)
=>
{
this
.
readyPromise
=
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
problemMatchersExtPoint
.
setHandler
((
extensions
)
=>
{
try
{
extensions
.
forEach
(
extension
=>
{
...
...
@@ -1704,7 +1703,7 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
});
}
public
onReady
():
T
Promise
<
void
>
{
public
onReady
():
Promise
<
void
>
{
ProblemPatternRegistry
.
onReady
();
return
this
.
readyPromise
;
}
...
...
src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts
浏览文件 @
364e1a85
...
...
@@ -6,7 +6,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
IJSONSchema
,
IJSONSchemaMap
}
from
'
vs/base/common/jsonSchema
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
Types
from
'
vs/base/common/types
'
;
import
*
as
Objects
from
'
vs/base/common/objects
'
;
...
...
@@ -75,7 +74,7 @@ const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Config
});
export
interface
ITaskDefinitionRegistry
{
onReady
():
T
Promise
<
void
>
;
onReady
():
Promise
<
void
>
;
get
(
key
:
string
):
Tasks
.
TaskDefinition
;
all
():
Tasks
.
TaskDefinition
[];
...
...
@@ -85,12 +84,12 @@ export interface ITaskDefinitionRegistry {
class
TaskDefinitionRegistryImpl
implements
ITaskDefinitionRegistry
{
private
taskTypes
:
IStringDictionary
<
Tasks
.
TaskDefinition
>
;
private
readyPromise
:
T
Promise
<
void
>
;
private
readyPromise
:
Promise
<
void
>
;
private
_schema
:
IJSONSchema
;
constructor
()
{
this
.
taskTypes
=
Object
.
create
(
null
);
this
.
readyPromise
=
new
T
Promise
<
void
>
((
resolve
,
reject
)
=>
{
this
.
readyPromise
=
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
taskDefinitionsExtPoint
.
setHandler
((
extensions
)
=>
{
try
{
for
(
let
extension
of
extensions
)
{
...
...
@@ -109,7 +108,7 @@ class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
});
}
public
onReady
():
T
Promise
<
void
>
{
public
onReady
():
Promise
<
void
>
{
return
this
.
readyPromise
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录