Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0157b3c1
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,发现更多精彩内容 >>
提交
0157b3c1
编写于
4月 18, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #72558
上级
f89390fc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
9 deletion
+39
-9
src/vs/platform/progress/common/progress.ts
src/vs/platform/progress/common/progress.ts
+7
-0
src/vs/workbench/api/browser/mainThreadProgress.ts
src/vs/workbench/api/browser/mainThreadProgress.ts
+26
-3
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostProgress.ts
src/vs/workbench/api/common/extHostProgress.ts
+1
-1
src/vs/workbench/services/progress/browser/progressService2.ts
...s/workbench/services/progress/browser/progressService2.ts
+4
-4
未找到文件。
src/vs/platform/progress/common/progress.ts
浏览文件 @
0157b3c1
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
CancellationToken
,
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
CancellationToken
,
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
export
const
IProgressService
=
createDecorator
<
IProgressService
>
(
'
progressService
'
);
export
const
IProgressService
=
createDecorator
<
IProgressService
>
(
'
progressService
'
);
...
@@ -42,6 +43,12 @@ export interface IProgressOptions {
...
@@ -42,6 +43,12 @@ export interface IProgressOptions {
cancellable
?:
boolean
;
cancellable
?:
boolean
;
}
}
export
interface
IProgressNotificationOptions
extends
IProgressOptions
{
location
:
ProgressLocation
.
Notification
;
primaryActions
?:
IAction
[];
secondaryActions
?:
IAction
[];
}
export
interface
IProgressStep
{
export
interface
IProgressStep
{
message
?:
string
;
message
?:
string
;
increment
?:
number
;
increment
?:
number
;
...
...
src/vs/workbench/api/browser/mainThreadProgress.ts
浏览文件 @
0157b3c1
...
@@ -3,9 +3,21 @@
...
@@ -3,9 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
{
IProgress
,
IProgressService2
,
IProgressStep
,
IProgress
Options
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgress
,
IProgressService2
,
IProgressStep
,
ProgressLocation
,
IProgressOptions
,
IProgressNotification
Options
}
from
'
vs/platform/progress/common/progress
'
;
import
{
MainThreadProgressShape
,
MainContext
,
IExtHostContext
,
ExtHostProgressShape
,
ExtHostContext
}
from
'
../common/extHost.protocol
'
;
import
{
MainThreadProgressShape
,
MainContext
,
IExtHostContext
,
ExtHostProgressShape
,
ExtHostContext
}
from
'
../common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
ExtensionIdentifier
,
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
localize
}
from
'
vs/nls
'
;
class
ManageExtensionAction
extends
Action
{
constructor
(
id
:
ExtensionIdentifier
,
label
:
string
,
commandService
:
ICommandService
)
{
super
(
id
.
value
,
label
,
undefined
,
true
,
()
=>
{
return
commandService
.
executeCommand
(
'
_extensions.manage
'
,
id
.
value
);
});
}
}
@
extHostNamedCustomer
(
MainContext
.
MainThreadProgress
)
@
extHostNamedCustomer
(
MainContext
.
MainThreadProgress
)
export
class
MainThreadProgress
implements
MainThreadProgressShape
{
export
class
MainThreadProgress
implements
MainThreadProgressShape
{
...
@@ -16,7 +28,8 @@ export class MainThreadProgress implements MainThreadProgressShape {
...
@@ -16,7 +28,8 @@ export class MainThreadProgress implements MainThreadProgressShape {
constructor
(
constructor
(
extHostContext
:
IExtHostContext
,
extHostContext
:
IExtHostContext
,
@
IProgressService2
progressService
:
IProgressService2
@
IProgressService2
progressService
:
IProgressService2
,
@
ICommandService
private
readonly
_commandService
:
ICommandService
)
{
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostProgress
);
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostProgress
);
this
.
_progressService
=
progressService
;
this
.
_progressService
=
progressService
;
...
@@ -27,9 +40,19 @@ export class MainThreadProgress implements MainThreadProgressShape {
...
@@ -27,9 +40,19 @@ export class MainThreadProgress implements MainThreadProgressShape {
this
.
_progress
.
clear
();
this
.
_progress
.
clear
();
}
}
$startProgress
(
handle
:
number
,
options
:
IProgressOptions
):
void
{
$startProgress
(
handle
:
number
,
options
:
IProgressOptions
,
extension
?:
IExtensionDescription
):
void
{
const
task
=
this
.
_createTask
(
handle
);
const
task
=
this
.
_createTask
(
handle
);
if
(
options
.
location
===
ProgressLocation
.
Notification
&&
extension
&&
!
extension
.
isUnderDevelopment
)
{
const
notificationOptions
:
IProgressNotificationOptions
=
{
...
options
,
location
:
ProgressLocation
.
Notification
,
secondaryActions
:
[
new
ManageExtensionAction
(
extension
.
identifier
,
localize
(
'
manageExtension
'
,
"
Manage Extension
"
),
this
.
_commandService
)]
};
options
=
notificationOptions
;
}
this
.
_progressService
.
withProgress
(
options
,
task
,
()
=>
this
.
_proxy
.
$acceptProgressCanceled
(
handle
));
this
.
_progressService
.
withProgress
(
options
,
task
,
()
=>
this
.
_proxy
.
$acceptProgressCanceled
(
handle
));
}
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
0157b3c1
...
@@ -376,7 +376,7 @@ export interface MainThreadOutputServiceShape extends IDisposable {
...
@@ -376,7 +376,7 @@ export interface MainThreadOutputServiceShape extends IDisposable {
export
interface
MainThreadProgressShape
extends
IDisposable
{
export
interface
MainThreadProgressShape
extends
IDisposable
{
$startProgress
(
handle
:
number
,
options
:
IProgressOptions
):
void
;
$startProgress
(
handle
:
number
,
options
:
IProgressOptions
,
extension
?:
IExtensionDescription
):
void
;
$progressReport
(
handle
:
number
,
message
:
IProgressStep
):
void
;
$progressReport
(
handle
:
number
,
message
:
IProgressStep
):
void
;
$progressEnd
(
handle
:
number
):
void
;
$progressEnd
(
handle
:
number
):
void
;
}
}
...
...
src/vs/workbench/api/common/extHostProgress.ts
浏览文件 @
0157b3c1
...
@@ -26,7 +26,7 @@ export class ExtHostProgress implements ExtHostProgressShape {
...
@@ -26,7 +26,7 @@ export class ExtHostProgress implements ExtHostProgressShape {
const
handle
=
this
.
_handles
++
;
const
handle
=
this
.
_handles
++
;
const
{
title
,
location
,
cancellable
}
=
options
;
const
{
title
,
location
,
cancellable
}
=
options
;
const
source
=
localize
(
'
extensionSource
'
,
"
{0} (Extension)
"
,
extension
.
displayName
||
extension
.
name
);
const
source
=
localize
(
'
extensionSource
'
,
"
{0} (Extension)
"
,
extension
.
displayName
||
extension
.
name
);
this
.
_proxy
.
$startProgress
(
handle
,
{
location
:
ProgressLocation
.
from
(
location
),
title
,
source
,
cancellable
});
this
.
_proxy
.
$startProgress
(
handle
,
{
location
:
ProgressLocation
.
from
(
location
),
title
,
source
,
cancellable
}
,
extension
);
return
this
.
_withProgress
(
handle
,
task
,
!!
cancellable
);
return
this
.
_withProgress
(
handle
,
task
,
!!
cancellable
);
}
}
...
...
src/vs/workbench/services/progress/browser/progressService2.ts
浏览文件 @
0157b3c1
...
@@ -7,7 +7,7 @@ import 'vs/css!./media/progressService2';
...
@@ -7,7 +7,7 @@ import 'vs/css!./media/progressService2';
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IProgressService2
,
IProgressOptions
,
IProgressStep
,
ProgressLocation
,
IProgress
,
emptyProgress
,
Progress
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgressService2
,
IProgressOptions
,
IProgressStep
,
ProgressLocation
,
IProgress
,
emptyProgress
,
Progress
,
IProgressNotificationOptions
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
StatusbarAlignment
,
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
StatusbarAlignment
,
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
...
@@ -54,7 +54,7 @@ export class ProgressService2 implements IProgressService2 {
...
@@ -54,7 +54,7 @@ export class ProgressService2 implements IProgressService2 {
switch
(
location
)
{
switch
(
location
)
{
case
ProgressLocation
.
Notification
:
case
ProgressLocation
.
Notification
:
return
this
.
_withNotificationProgress
(
options
,
task
,
onDidCancel
);
return
this
.
_withNotificationProgress
(
{
...
options
,
location
:
ProgressLocation
.
Notification
}
,
task
,
onDidCancel
);
case
ProgressLocation
.
Window
:
case
ProgressLocation
.
Window
:
return
this
.
_withWindowProgress
(
options
,
task
);
return
this
.
_withWindowProgress
(
options
,
task
);
case
ProgressLocation
.
Explorer
:
case
ProgressLocation
.
Explorer
:
...
@@ -138,7 +138,7 @@ export class ProgressService2 implements IProgressService2 {
...
@@ -138,7 +138,7 @@ export class ProgressService2 implements IProgressService2 {
}
}
}
}
private
_withNotificationProgress
<
P
extends
Promise
<
R
>
,
R
=
unknown
>
(
options
:
IProgressOptions
,
callback
:
(
progress
:
IProgress
<
{
message
?:
string
,
increment
?:
number
}
>
)
=>
P
,
onDidCancel
?:
()
=>
void
):
P
{
private
_withNotificationProgress
<
P
extends
Promise
<
R
>
,
R
=
unknown
>
(
options
:
IProgress
Notification
Options
,
callback
:
(
progress
:
IProgress
<
{
message
?:
string
,
increment
?:
number
}
>
)
=>
P
,
onDidCancel
?:
()
=>
void
):
P
{
const
toDispose
:
IDisposable
[]
=
[];
const
toDispose
:
IDisposable
[]
=
[];
const
createNotification
=
(
message
:
string
|
undefined
,
increment
?:
number
):
INotificationHandle
|
undefined
=>
{
const
createNotification
=
(
message
:
string
|
undefined
,
increment
?:
number
):
INotificationHandle
|
undefined
=>
{
...
@@ -146,7 +146,7 @@ export class ProgressService2 implements IProgressService2 {
...
@@ -146,7 +146,7 @@ export class ProgressService2 implements IProgressService2 {
return
undefined
;
// we need a message at least
return
undefined
;
// we need a message at least
}
}
const
actions
:
INotificationActions
=
{
primary
:
[]
};
const
actions
:
INotificationActions
=
{
primary
:
options
.
primaryActions
||
[],
secondary
:
options
.
secondaryActions
||
[]
};
if
(
options
.
cancellable
)
{
if
(
options
.
cancellable
)
{
const
cancelAction
=
new
class
extends
Action
{
const
cancelAction
=
new
class
extends
Action
{
constructor
()
{
constructor
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录