Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
23c4c8d1
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,发现更多精彩内容 >>
提交
23c4c8d1
编写于
1月 19, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
progress - make window progress get a title
上级
f5de1525
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
31 deletion
+44
-31
src/vs/platform/progress/common/progress.ts
src/vs/platform/progress/common/progress.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+3
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+3
-1
src/vs/workbench/api/node/extHostProgress.ts
src/vs/workbench/api/node/extHostProgress.ts
+8
-6
src/vs/workbench/api/node/mainThreadProgress.ts
src/vs/workbench/api/node/mainThreadProgress.ts
+11
-12
src/vs/workbench/services/progress/browser/progressService2.ts
...s/workbench/services/progress/browser/progressService2.ts
+17
-7
未找到文件。
src/vs/platform/progress/common/progress.ts
浏览文件 @
23c4c8d1
...
@@ -62,7 +62,7 @@ export interface IProgressService2 {
...
@@ -62,7 +62,7 @@ export interface IProgressService2 {
_serviceBrand
:
any
;
_serviceBrand
:
any
;
withWindowProgress
(
task
:
(
progress
:
IProgress
<
string
>
)
=>
TPromise
<
any
>
):
void
;
withWindowProgress
(
t
itle
:
string
,
t
ask
:
(
progress
:
IProgress
<
string
>
)
=>
TPromise
<
any
>
):
void
;
withViewletProgress
(
viewletId
:
string
,
task
:
(
progress
:
IProgress
<
number
>
)
=>
TPromise
<
any
>
):
void
;
withViewletProgress
(
viewletId
:
string
,
task
:
(
progress
:
IProgress
<
number
>
)
=>
TPromise
<
any
>
):
void
;
}
}
src/vs/vscode.proposed.d.ts
浏览文件 @
23c4c8d1
...
@@ -27,7 +27,7 @@ declare module 'vscode' {
...
@@ -27,7 +27,7 @@ declare module 'vscode' {
*
*
* @param task A function callback that represents a long running operation.
* @param task A function callback that represents a long running operation.
*/
*/
export
function
withWindowProgress
<
R
>
(
task
:
(
progress
:
Progress
<
string
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
;
export
function
withWindowProgress
<
R
>
(
t
itle
:
string
,
t
ask
:
(
progress
:
Progress
<
string
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
;
export
function
withScmProgress
<
R
>
(
task
:
(
progress
:
Progress
<
number
>
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
;
export
function
withScmProgress
<
R
>
(
task
:
(
progress
:
Progress
<
number
>
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
;
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
23c4c8d1
...
@@ -308,10 +308,10 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
...
@@ -308,10 +308,10 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
setStatusBarMessage
(
text
:
string
,
timeoutOrThenable
?:
number
|
Thenable
<
any
>
):
vscode
.
Disposable
{
setStatusBarMessage
(
text
:
string
,
timeoutOrThenable
?:
number
|
Thenable
<
any
>
):
vscode
.
Disposable
{
return
extHostStatusBar
.
setStatusBarMessage
(
text
,
timeoutOrThenable
);
return
extHostStatusBar
.
setStatusBarMessage
(
text
,
timeoutOrThenable
);
},
},
withWindowProgress
:
proposedApiFunction
(
extension
,
<
R
>
(
task
:
(
progress
:
vscode
.
Progress
<
string
>
,
token
:
vscode
.
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
=>
{
withWindowProgress
:
proposedApiFunction
(
extension
,
<
R
>
(
t
itle
:
string
,
t
ask
:
(
progress
:
vscode
.
Progress
<
string
>
,
token
:
vscode
.
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
=>
{
return
extHostProgress
.
withWindowProgress
(
extension
,
task
);
return
extHostProgress
.
withWindowProgress
(
extension
,
t
itle
,
t
ask
);
}),
}),
withScmProgress
:
proposedApiFunction
(
extension
,
(
task
:
(
progress
:
vscode
.
Progress
<
number
>
)
=>
Thenable
<
any
>
)
=>
{
withScmProgress
:
proposedApiFunction
(
extension
,
<
R
>
(
task
:
(
progress
:
vscode
.
Progress
<
number
>
)
=>
Thenable
<
R
>
)
=>
{
return
extHostProgress
.
withScmProgress
(
extension
,
task
);
return
extHostProgress
.
withScmProgress
(
extension
,
task
);
}),
}),
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
23c4c8d1
...
@@ -186,7 +186,9 @@ export abstract class MainThreadOutputServiceShape {
...
@@ -186,7 +186,9 @@ export abstract class MainThreadOutputServiceShape {
}
}
export
abstract
class
MainThreadProgressShape
{
export
abstract
class
MainThreadProgressShape
{
$progressStart
(
handle
:
number
,
extensionId
:
string
,
location
:
string
):
void
{
throw
ni
();
}
$startWindow
(
handle
:
number
,
title
:
string
):
void
{
throw
ni
();
};
$startScm
(
handle
:
number
):
void
{
throw
ni
();
};
$progressReport
(
handle
:
number
,
message
:
string
):
void
{
throw
ni
();
}
$progressReport
(
handle
:
number
,
message
:
string
):
void
{
throw
ni
();
}
$progressEnd
(
handle
:
number
):
void
{
throw
ni
();
}
$progressEnd
(
handle
:
number
):
void
{
throw
ni
();
}
}
}
...
...
src/vs/workbench/api/node/extHostProgress.ts
浏览文件 @
23c4c8d1
...
@@ -17,18 +17,20 @@ export class ExtHostProgress {
...
@@ -17,18 +17,20 @@ export class ExtHostProgress {
this
.
_proxy
=
proxy
;
this
.
_proxy
=
proxy
;
}
}
withWindowProgress
<
R
>
(
extension
:
IExtensionDescription
,
task
:
(
progress
:
Progress
<
string
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
withWindowProgress
<
R
>
(
extension
:
IExtensionDescription
,
title
:
string
,
task
:
(
progress
:
Progress
<
string
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
return
this
.
_withProgress
(
extension
,
'
window
'
,
task
);
const
handle
=
this
.
_handles
++
;
this
.
_proxy
.
$startWindow
(
handle
,
title
);
return
this
.
_withProgress
(
handle
,
task
);
}
}
withScmProgress
<
R
>
(
extension
:
IExtensionDescription
,
task
:
(
progress
:
Progress
<
number
>
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
withScmProgress
<
R
>
(
extension
:
IExtensionDescription
,
task
:
(
progress
:
Progress
<
number
>
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
return
this
.
_withProgress
(
extension
,
'
scm
'
,
task
);
const
handle
=
this
.
_handles
++
;
this
.
_proxy
.
$startScm
(
handle
);
return
this
.
_withProgress
(
handle
,
task
);
}
}
private
_withProgress
<
R
>
(
extension
:
IExtensionDescription
,
type
:
string
,
task
:
(
progress
:
Progress
<
any
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
private
_withProgress
<
R
>
(
handle
:
number
,
task
:
(
progress
:
Progress
<
any
>
,
token
:
CancellationToken
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
const
handle
=
this
.
_handles
++
;
this
.
_proxy
.
$progressStart
(
handle
,
extension
.
id
,
type
);
const
progress
=
{
const
progress
=
{
report
:
(
message
:
string
)
=>
{
report
:
(
message
:
string
)
=>
{
this
.
_proxy
.
$progressReport
(
handle
,
message
);
this
.
_proxy
.
$progressReport
(
handle
,
message
);
...
...
src/vs/workbench/api/node/mainThreadProgress.ts
浏览文件 @
23c4c8d1
...
@@ -21,23 +21,22 @@ export class MainThreadProgress extends MainThreadProgressShape {
...
@@ -21,23 +21,22 @@ export class MainThreadProgress extends MainThreadProgressShape {
}
}
$progressStart
(
handle
:
number
,
extensionId
:
string
,
where
:
string
):
void
{
$startWindow
(
handle
:
number
,
title
:
string
):
void
{
const
task
=
this
.
_createTask
(
handle
);
this
.
_progressService
.
withWindowProgress
(
title
,
task
);
}
$startScm
(
handle
:
number
):
void
{
const
task
=
this
.
_createTask
(
handle
);
this
.
_progressService
.
withViewletProgress
(
'
workbench.view.scm
'
,
task
);
}
const
task
=
(
progress
:
IProgress
<
any
>
)
=>
{
private
_createTask
(
handle
:
number
)
{
return
(
progress
:
IProgress
<
any
>
)
=>
{
return
new
TPromise
<
any
>
(
resolve
=>
{
return
new
TPromise
<
any
>
(
resolve
=>
{
this
.
progress
.
set
(
handle
,
{
resolve
,
progress
});
this
.
progress
.
set
(
handle
,
{
resolve
,
progress
});
});
});
};
};
switch
(
where
)
{
case
'
window
'
:
this
.
_progressService
.
withWindowProgress
(
task
);
break
;
case
'
scm
'
:
this
.
_progressService
.
withViewletProgress
(
'
workbench.view.scm
'
,
task
);
break
;
}
}
}
$progressReport
(
handle
:
number
,
message
:
any
):
void
{
$progressReport
(
handle
:
number
,
message
:
any
):
void
{
...
...
src/vs/workbench/services/progress/browser/progressService2.ts
浏览文件 @
23c4c8d1
...
@@ -48,12 +48,17 @@ class WindowProgressItem implements IStatusbarItem {
...
@@ -48,12 +48,17 @@ class WindowProgressItem implements IStatusbarItem {
}
}
}
}
interface
IWindowProgressTask
{
title
:
string
;
progress
:
Progress
<
string
>
;
}
export
class
ProgressService2
implements
IProgressService2
{
export
class
ProgressService2
implements
IProgressService2
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
private
_stack
:
Progress
<
string
>
[]
=
[];
private
_stack
:
IWindowProgressTask
[]
=
[];
constructor
(
constructor
(
@
IActivityBarService
private
_activityBar
:
IActivityBarService
,
@
IActivityBarService
private
_activityBar
:
IActivityBarService
,
...
@@ -62,15 +67,19 @@ export class ProgressService2 implements IProgressService2 {
...
@@ -62,15 +67,19 @@ export class ProgressService2 implements IProgressService2 {
//
//
}
}
withWindowProgress
(
task
:
(
progress
:
IProgress
<
string
>
)
=>
TPromise
<
any
>
):
void
{
withWindowProgress
(
title
:
string
,
callback
:
(
progress
:
IProgress
<
string
>
)
=>
TPromise
<
any
>
):
void
{
const
task
=
{
progress
:
new
Progress
<
string
>
(()
=>
this
.
_updateProgress
()),
title
};
const
progress
=
new
Progress
<
string
>
(()
=>
this
.
_updateProgress
());
this
.
_stack
.
unshift
(
task
);
this
.
_stack
.
unshift
(
progress
);
const
promise
=
task
(
progress
);
const
promise
=
callback
(
task
.
progress
);
always
(
promise
,
()
=>
{
always
(
promise
,
()
=>
{
const
idx
=
this
.
_stack
.
indexOf
(
progress
);
const
idx
=
this
.
_stack
.
indexOf
(
task
);
this
.
_stack
.
splice
(
idx
,
1
);
this
.
_stack
.
splice
(
idx
,
1
);
this
.
_updateProgress
();
this
.
_updateProgress
();
});
});
...
@@ -80,8 +89,9 @@ export class ProgressService2 implements IProgressService2 {
...
@@ -80,8 +89,9 @@ export class ProgressService2 implements IProgressService2 {
if
(
this
.
_stack
.
length
===
0
)
{
if
(
this
.
_stack
.
length
===
0
)
{
WindowProgressItem
.
Instance
.
hide
();
WindowProgressItem
.
Instance
.
hide
();
}
else
{
}
else
{
const
{
title
,
progress
}
=
this
.
_stack
[
0
];
WindowProgressItem
.
Instance
.
text
=
progress
.
value
||
title
;
WindowProgressItem
.
Instance
.
show
();
WindowProgressItem
.
Instance
.
show
();
WindowProgressItem
.
Instance
.
text
=
this
.
_stack
[
0
].
value
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录