Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0b4d2dcd
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,发现更多精彩内容 >>
提交
0b4d2dcd
编写于
6月 28, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - reduce scope of local progress service
上级
abac09b4
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
174 addition
and
220 deletion
+174
-220
src/vs/editor/contrib/codeAction/codeActionCommands.ts
src/vs/editor/contrib/codeAction/codeActionCommands.ts
+2
-2
src/vs/editor/contrib/codeAction/codeActionModel.ts
src/vs/editor/contrib/codeAction/codeActionModel.ts
+2
-2
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
...s/editor/contrib/goToDefinition/goToDefinitionCommands.ts
+2
-2
src/vs/editor/contrib/rename/rename.ts
src/vs/editor/contrib/rename/rename.ts
+2
-2
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+3
-3
src/vs/editor/standalone/browser/standaloneServices.ts
src/vs/editor/standalone/browser/standaloneServices.ts
+3
-3
src/vs/platform/progress/common/progress.ts
src/vs/platform/progress/common/progress.ts
+13
-11
src/vs/workbench/browser/parts/compositePart.ts
src/vs/workbench/browser/parts/compositePart.ts
+13
-13
src/vs/workbench/browser/parts/editor/editorControl.ts
src/vs/workbench/browser/parts/editor/editorControl.ts
+3
-3
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
+3
-3
src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts
...orkbench/contrib/preferences/browser/preferencesEditor.ts
+3
-3
src/vs/workbench/services/panel/common/panelService.ts
src/vs/workbench/services/panel/common/panelService.ts
+2
-2
src/vs/workbench/services/progress/browser/editorProgressService.ts
...kbench/services/progress/browser/editorProgressService.ts
+13
-0
src/vs/workbench/services/progress/browser/progressIndicator.ts
.../workbench/services/progress/browser/progressIndicator.ts
+71
-77
src/vs/workbench/services/progress/browser/progressService.ts
...vs/workbench/services/progress/browser/progressService.ts
+5
-5
src/vs/workbench/services/progress/test/progressIndicator.test.ts
...orkbench/services/progress/test/progressIndicator.test.ts
+32
-87
src/vs/workbench/services/viewlet/browser/viewlet.ts
src/vs/workbench/services/viewlet/browser/viewlet.ts
+2
-2
未找到文件。
src/vs/editor/contrib/codeAction/codeActionCommands.ts
浏览文件 @
0b4d2dcd
...
...
@@ -19,7 +19,7 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
CodeActionModel
,
SUPPORTED_CODE_ACTIONS
,
CodeActionsState
}
from
'
./codeActionModel
'
;
import
{
CodeActionAutoApply
,
CodeActionFilter
,
CodeActionKind
,
CodeActionTrigger
}
from
'
./codeActionTrigger
'
;
import
{
CodeActionWidget
}
from
'
./codeActionWidget
'
;
...
...
@@ -52,7 +52,7 @@ export class QuickFixController extends Disposable implements IEditorContributio
editor
:
ICodeEditor
,
@
IMarkerService
markerService
:
IMarkerService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
I
LocalProgressService
progressService
:
ILocal
ProgressService
,
@
I
EditorProgressService
progressService
:
IEditor
ProgressService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
ICommandService
private
readonly
_commandService
:
ICommandService
,
@
IKeybindingService
private
readonly
_keybindingService
:
IKeybindingService
,
...
...
src/vs/editor/contrib/codeAction/codeActionModel.ts
浏览文件 @
0b4d2dcd
...
...
@@ -14,7 +14,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import
{
CodeActionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
getCodeActions
,
CodeActionSet
}
from
'
./codeAction
'
;
import
{
CodeActionTrigger
}
from
'
./codeActionTrigger
'
;
...
...
@@ -167,7 +167,7 @@ export class CodeActionModel extends Disposable {
private
readonly
_editor
:
ICodeEditor
,
private
readonly
_markerService
:
IMarkerService
,
contextKeyService
:
IContextKeyService
,
private
readonly
_progressService
?:
I
Local
ProgressService
private
readonly
_progressService
?:
I
Editor
ProgressService
)
{
super
();
this
.
_supportedCodeActions
=
SUPPORTED_CODE_ACTIONS
.
bindTo
(
contextKeyService
);
...
...
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
浏览文件 @
0b4d2dcd
...
...
@@ -25,7 +25,7 @@ import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
getDefinitionsAtPosition
,
getImplementationsAtPosition
,
getTypeDefinitionsAtPosition
,
getDeclarationsAtPosition
}
from
'
./goToDefinition
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
EditorStateCancellationTokenSource
,
CodeEditorStateFlag
}
from
'
vs/editor/browser/core/editorState
'
;
...
...
@@ -58,7 +58,7 @@ export class DefinitionAction extends EditorAction {
}
const
notificationService
=
accessor
.
get
(
INotificationService
);
const
editorService
=
accessor
.
get
(
ICodeEditorService
);
const
progressService
=
accessor
.
get
(
I
Local
ProgressService
);
const
progressService
=
accessor
.
get
(
I
Editor
ProgressService
);
const
symbolNavService
=
accessor
.
get
(
ISymbolNavigationService
);
const
model
=
editor
.
getModel
();
...
...
src/vs/editor/contrib/rename/rename.ts
浏览文件 @
0b4d2dcd
...
...
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import
{
illegalArgument
,
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
registerEditorAction
,
registerEditorContribution
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
registerEditorCommand
,
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
...
...
@@ -114,7 +114,7 @@ class RenameController extends Disposable implements IEditorContribution {
private
readonly
editor
:
ICodeEditor
,
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
@
IBulkEditService
private
readonly
_bulkEditService
:
IBulkEditService
,
@
I
LocalProgressService
private
readonly
_progressService
:
ILocal
ProgressService
,
@
I
EditorProgressService
private
readonly
_progressService
:
IEditor
ProgressService
,
@
IContextKeyService
private
readonly
_contextKeyService
:
IContextKeyService
,
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
)
{
...
...
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
0b4d2dcd
...
...
@@ -38,7 +38,7 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import
{
USLayoutResolvedKeybinding
}
from
'
vs/platform/keybinding/common/usLayoutResolvedKeybinding
'
;
import
{
ILabelService
,
ResourceLabelFormatter
}
from
'
vs/platform/label/common/label
'
;
import
{
INotification
,
INotificationHandle
,
INotificationService
,
IPromptChoice
,
IPromptOptions
,
NoOpNotification
,
IStatusMessageOptions
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IProgressRunner
,
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgressRunner
,
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ITelemetryInfo
,
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspace
,
IWorkspaceContextService
,
IWorkspaceFolder
,
IWorkspaceFoldersChangeEvent
,
WorkbenchState
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
IWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
...
...
@@ -137,7 +137,7 @@ export class SimpleEditorModelResolverService implements ITextModelService {
}
}
export
class
Simple
LocalProgressService
implements
ILocal
ProgressService
{
export
class
Simple
EditorProgressService
implements
IEditor
ProgressService
{
_serviceBrand
:
any
;
private
static
NULL_PROGRESS_RUNNER
:
IProgressRunner
=
{
...
...
@@ -149,7 +149,7 @@ export class SimpleLocalProgressService implements ILocalProgressService {
show
(
infinite
:
true
,
delay
?:
number
):
IProgressRunner
;
show
(
total
:
number
,
delay
?:
number
):
IProgressRunner
;
show
():
IProgressRunner
{
return
Simple
Local
ProgressService
.
NULL_PROGRESS_RUNNER
;
return
Simple
Editor
ProgressService
.
NULL_PROGRESS_RUNNER
;
}
showWhile
(
promise
:
Promise
<
any
>
,
delay
?:
number
):
Promise
<
void
>
{
...
...
src/vs/editor/standalone/browser/standaloneServices.ts
浏览文件 @
0b4d2dcd
...
...
@@ -13,7 +13,7 @@ import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
ITextResourceConfigurationService
,
ITextResourcePropertiesService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
SimpleBulkEditService
,
SimpleConfigurationService
,
SimpleDialogService
,
SimpleNotificationService
,
Simple
Local
ProgressService
,
SimpleResourceConfigurationService
,
SimpleResourcePropertiesService
,
SimpleUriLabelService
,
SimpleWorkspaceContextService
,
StandaloneCommandService
,
StandaloneKeybindingService
,
StandaloneTelemetryService
,
SimpleLayoutService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
SimpleBulkEditService
,
SimpleConfigurationService
,
SimpleDialogService
,
SimpleNotificationService
,
Simple
Editor
ProgressService
,
SimpleResourceConfigurationService
,
SimpleResourcePropertiesService
,
SimpleUriLabelService
,
SimpleWorkspaceContextService
,
StandaloneCommandService
,
StandaloneKeybindingService
,
StandaloneTelemetryService
,
SimpleLayoutService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
StandaloneCodeEditorServiceImpl
}
from
'
vs/editor/standalone/browser/standaloneCodeServiceImpl
'
;
import
{
StandaloneThemeServiceImpl
}
from
'
vs/editor/standalone/browser/standaloneThemeServiceImpl
'
;
import
{
IStandaloneThemeService
}
from
'
vs/editor/standalone/common/standaloneThemeService
'
;
...
...
@@ -36,7 +36,7 @@ import { ILogService, NullLogService } from 'vs/platform/log/common/log';
import
{
MarkerService
}
from
'
vs/platform/markers/common/markerService
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IStorageService
,
InMemoryStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -154,7 +154,7 @@ export module StaticServices {
export
const
codeEditorService
=
define
(
ICodeEditorService
,
(
o
)
=>
new
StandaloneCodeEditorServiceImpl
(
standaloneThemeService
.
get
(
o
)));
export
const
localProgressService
=
define
(
ILocalProgressService
,
()
=>
new
SimpleLocal
ProgressService
());
export
const
editorProgressService
=
define
(
IEditorProgressService
,
()
=>
new
SimpleEditor
ProgressService
());
export
const
storageService
=
define
(
IStorageService
,
()
=>
new
InMemoryStorageService
());
...
...
src/vs/platform/progress/common/progress.ts
浏览文件 @
0b4d2dcd
...
...
@@ -20,15 +20,7 @@ export interface IProgressService {
withProgress
<
R
=
any
>
(
options
:
IProgressOptions
|
IProgressNotificationOptions
|
IProgressCompositeOptions
,
task
:
(
progress
:
IProgress
<
IProgressStep
>
)
=>
Promise
<
R
>
,
onDidCancel
?:
()
=>
void
):
Promise
<
R
>
;
}
export
const
ILocalProgressService
=
createDecorator
<
ILocalProgressService
>
(
'
localProgressService
'
);
/**
* A progress service that will report progress local to the UI piece triggered from. E.g.
* if used from an action of a viewlet, the progress will be reported in that viewlet.
*/
export
interface
ILocalProgressService
{
_serviceBrand
:
ServiceIdentifier
<
ILocalProgressService
>
;
export
interface
IProgressIndicator
{
/**
* Show progress customized with the provided flags.
...
...
@@ -132,7 +124,7 @@ export class LongRunningOperation extends Disposable {
private
currentProgressTimeout
:
any
;
constructor
(
private
localProgressService
:
ILocalProgressService
private
progressIndicator
:
IProgressIndicator
)
{
super
();
}
...
...
@@ -147,7 +139,7 @@ export class LongRunningOperation extends Disposable {
const
newOperationToken
=
new
CancellationTokenSource
();
this
.
currentProgressTimeout
=
setTimeout
(()
=>
{
if
(
newOperationId
===
this
.
currentOperationId
)
{
this
.
currentProgressRunner
=
this
.
localProgressService
.
show
(
true
);
this
.
currentProgressRunner
=
this
.
progressIndicator
.
show
(
true
);
}
},
progressDelay
);
...
...
@@ -173,3 +165,13 @@ export class LongRunningOperation extends Disposable {
}
}
}
export
const
IEditorProgressService
=
createDecorator
<
IEditorProgressService
>
(
'
editorProgressService
'
);
/**
* A progress service that will report progress local to the editor triggered from.
*/
export
interface
IEditorProgressService
extends
IProgressIndicator
{
_serviceBrand
:
ServiceIdentifier
<
IEditorProgressService
>
;
}
src/vs/workbench/browser/parts/compositePart.ts
浏览文件 @
0b4d2dcd
...
...
@@ -18,13 +18,12 @@ import { IAction } from 'vs/base/common/actions';
import
{
Part
,
IPartOptions
}
from
'
vs/workbench/browser/part
'
;
import
{
Composite
,
CompositeRegistry
}
from
'
vs/workbench/browser/composite
'
;
import
{
IComposite
}
from
'
vs/workbench/common/composite
'
;
import
{
ScopedProgressService
}
from
'
vs/workbench/services/progress/browser/localProgressService
'
;
import
{
CompositeProgressIndicator
}
from
'
vs/workbench/services/progress/browser/progressIndicator
'
;
import
{
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ILocalProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgressIndicator
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -50,7 +49,7 @@ export interface ICompositeTitleLabel {
interface
CompositeItem
{
composite
:
Composite
;
disposable
:
IDisposable
;
localProgressService
:
ILocalProgressService
;
progress
:
IProgressIndicator
;
}
export
abstract
class
CompositePart
<
T
extends
Composite
>
extends
Part
{
...
...
@@ -169,17 +168,18 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Instantiate composite from registry otherwise
const
compositeDescriptor
=
this
.
registry
.
getComposite
(
id
);
if
(
compositeDescriptor
)
{
const
localProgressService
=
this
.
instantiationService
.
createInstance
(
ScopedProgressService
,
this
.
progressBar
,
compositeDescriptor
.
id
,
isActive
);
const
compositeInstantiationService
=
this
.
instantiationService
.
createChild
(
new
ServiceCollection
([
ILocalProgressService
,
localProgressService
]));
const
composite
=
compositeDescriptor
.
instantiate
(
compositeInstantiationService
);
const
disposables
=
new
DisposableStore
();
const
composite
=
compositeDescriptor
.
instantiate
(
this
.
instantiationService
);
const
disposable
=
new
DisposableStore
();
// Remember as Instantiated
this
.
instantiatedCompositeItems
.
set
(
id
,
{
composite
,
disposable
:
disposables
,
localProgressService
});
this
.
instantiatedCompositeItems
.
set
(
id
,
{
composite
,
disposable
,
progress
:
this
.
_register
(
this
.
instantiationService
.
createInstance
(
CompositeProgressIndicator
,
this
.
progressBar
,
compositeDescriptor
.
id
,
isActive
))
});
// Register to title area update events from the composite
disposable
s
.
add
(
composite
.
onTitleAreaUpdate
(()
=>
this
.
onTitleAreaUpdate
(
composite
.
getId
()),
this
));
disposable
.
add
(
composite
.
onTitleAreaUpdate
(()
=>
this
.
onTitleAreaUpdate
(
composite
.
getId
()),
this
));
return
composite
;
}
...
...
@@ -451,10 +451,10 @@ export abstract class CompositePart<T extends Composite> extends Part {
return
contentContainer
;
}
getProgressIndicator
(
id
:
string
):
I
LocalProgressService
|
null
{
getProgressIndicator
(
id
:
string
):
I
ProgressIndicator
|
null
{
const
compositeItem
=
this
.
instantiatedCompositeItems
.
get
(
id
);
return
compositeItem
?
compositeItem
.
localProgressService
:
null
;
return
compositeItem
?
compositeItem
.
progress
:
null
;
}
protected
getActions
():
ReadonlyArray
<
IAction
>
{
...
...
src/vs/workbench/browser/parts/editor/editorControl.ts
浏览文件 @
0b4d2dcd
...
...
@@ -11,7 +11,7 @@ import { IEditorRegistry, Extensions as EditorExtensions, IEditorDescriptor } fr
import
{
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
I
Local
ProgressService
,
LongRunningOperation
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
,
LongRunningOperation
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IEditorGroupView
,
DEFAULT_EDITOR_MIN_DIMENSIONS
,
DEFAULT_EDITOR_MAX_DIMENSIONS
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IVisibleEditor
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -47,11 +47,11 @@ export class EditorControl extends Disposable {
private
groupView
:
IEditorGroupView
,
@
IWorkbenchLayoutService
private
readonly
layoutService
:
IWorkbenchLayoutService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
I
LocalProgressService
localProgressService
:
ILocal
ProgressService
@
I
EditorProgressService
editorProgressService
:
IEditor
ProgressService
)
{
super
();
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
local
ProgressService
));
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
editor
ProgressService
));
}
get
activeControl
():
IVisibleEditor
|
null
{
...
...
src/vs/workbench/browser/parts/editor/editorGroupView.ts
浏览文件 @
0b4d2dcd
...
...
@@ -20,8 +20,8 @@ import { Themable, EDITOR_GROUP_HEADER_TABS_BORDER, EDITOR_GROUP_HEADER_TABS_BAC
import
{
IMoveEditorOptions
,
ICopyEditorOptions
,
ICloseEditorsFilter
,
IGroupChangeEvent
,
GroupChangeKind
,
EditorsOrder
,
GroupsOrder
,
ICloseEditorOptions
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
TabsTitleControl
}
from
'
vs/workbench/browser/parts/editor/tabsTitleControl
'
;
import
{
EditorControl
}
from
'
vs/workbench/browser/parts/editor/editorControl
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
LocalProgressService
}
from
'
vs/workbench/services/progress/browser/local
ProgressService
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
EditorProgressService
}
from
'
vs/workbench/services/progress/browser/editor
ProgressService
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
import
{
dispose
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -178,7 +178,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
const
scopedContextKeyService
=
this
.
_register
(
this
.
contextKeyService
.
createScoped
(
this
.
element
));
this
.
scopedInstantiationService
=
this
.
instantiationService
.
createChild
(
new
ServiceCollection
(
[
IContextKeyService
,
scopedContextKeyService
],
[
I
LocalProgressService
,
new
Local
ProgressService
(
this
.
progressBar
)]
[
I
EditorProgressService
,
new
Editor
ProgressService
(
this
.
progressBar
)]
));
// Context keys
...
...
src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts
浏览文件 @
0b4d2dcd
...
...
@@ -31,7 +31,7 @@ import { ConfigurationTarget } from 'vs/platform/configuration/common/configurat
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
I
Local
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
Editor
ProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -94,7 +94,7 @@ export class PreferencesEditor extends BaseEditor {
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
LocalProgressService
private
readonly
progressService
:
ILocal
ProgressService
,
@
I
EditorProgressService
private
readonly
editorProgressService
:
IEditor
ProgressService
,
@
IStorageService
storageService
:
IStorageService
)
{
super
(
PreferencesEditor
.
ID
,
telemetryService
,
themeService
,
storageService
);
...
...
@@ -237,7 +237,7 @@ export class PreferencesEditor extends BaseEditor {
if
(
query
)
{
return
Promise
.
all
([
this
.
localSearchDelayer
.
trigger
(()
=>
this
.
preferencesRenderers
.
localFilterPreferences
(
query
).
then
(()
=>
{
})),
this
.
remoteSearchThrottle
.
trigger
(()
=>
Promise
.
resolve
(
this
.
p
rogressService
.
showWhile
(
this
.
preferencesRenderers
.
remoteSearchPreferences
(
query
),
500
)))
this
.
remoteSearchThrottle
.
trigger
(()
=>
Promise
.
resolve
(
this
.
editorP
rogressService
.
showWhile
(
this
.
preferencesRenderers
.
remoteSearchPreferences
(
query
),
500
)))
]).
then
(()
=>
{
});
}
else
{
// When clearing the input, update immediately to clear it
...
...
src/vs/workbench/services/panel/common/panelService.ts
浏览文件 @
0b4d2dcd
...
...
@@ -8,7 +8,7 @@ import { IPanel } from 'vs/workbench/common/panel';
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
I
LocalProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
ProgressIndicator
}
from
'
vs/platform/progress/common/progress
'
;
export
const
IPanelService
=
createDecorator
<
IPanelService
>
(
'
panelService
'
);
...
...
@@ -53,7 +53,7 @@ export interface IPanelService {
/**
* Returns the progress indicator for the panel bar.
*/
getProgressIndicator
(
id
:
string
):
I
LocalProgressService
|
null
;
getProgressIndicator
(
id
:
string
):
I
ProgressIndicator
|
null
;
/**
* Show an activity in a panel.
...
...
src/vs/workbench/services/progress/browser/editorProgressService.ts
0 → 100644
浏览文件 @
0b4d2dcd
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IEditorProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ProgressBarIndicator
}
from
'
vs/workbench/services/progress/browser/progressIndicator
'
;
export
class
EditorProgressService
extends
ProgressBarIndicator
{
_serviceBrand
:
ServiceIdentifier
<
IEditorProgressService
>
;
}
src/vs/workbench/services/progress/browser/
localProgressService
.ts
→
src/vs/workbench/services/progress/browser/
progressIndicator
.ts
浏览文件 @
0b4d2dcd
...
...
@@ -4,14 +4,58 @@
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
{
isUndefinedOrNull
}
from
'
vs/base/common/types
'
;
import
{
ProgressBar
}
from
'
vs/base/browser/ui/progressbar/progressbar
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ILocalProgressService
,
IProgressRunner
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IProgressRunner
,
IProgressIndicator
}
from
'
vs/platform/progress/common/progress
'
;
namespace
ProgressState
{
export
class
ProgressBarIndicator
implements
IProgressIndicator
{
constructor
(
private
progressbar
:
ProgressBar
)
{
}
show
(
infinite
:
true
,
delay
?:
number
):
IProgressRunner
;
show
(
total
:
number
,
delay
?:
number
):
IProgressRunner
;
show
(
infiniteOrTotal
:
true
|
number
,
delay
?:
number
):
IProgressRunner
{
if
(
typeof
infiniteOrTotal
===
'
boolean
'
)
{
this
.
progressbar
.
infinite
().
show
(
delay
);
}
else
{
this
.
progressbar
.
total
(
infiniteOrTotal
).
show
(
delay
);
}
return
{
total
:
(
total
:
number
)
=>
{
this
.
progressbar
.
total
(
total
);
},
worked
:
(
worked
:
number
)
=>
{
if
(
this
.
progressbar
.
hasTotal
())
{
this
.
progressbar
.
worked
(
worked
);
}
else
{
this
.
progressbar
.
infinite
().
show
();
}
},
done
:
()
=>
{
this
.
progressbar
.
stop
().
hide
();
}
};
}
async
showWhile
(
promise
:
Promise
<
any
>
,
delay
?:
number
):
Promise
<
void
>
{
try
{
this
.
progressbar
.
infinite
().
show
(
delay
);
await
promise
;
}
catch
(
error
)
{
// ignore
}
finally
{
this
.
progressbar
.
stop
().
hide
();
}
}
}
namespace
ProgressIndicatorState
{
export
const
enum
Type
{
None
,
...
...
@@ -52,7 +96,7 @@ namespace ProgressState {
|
Work
;
}
export
abstract
class
ScopedServic
e
extends
Disposable
{
export
abstract
class
CompositeScop
e
extends
Disposable
{
constructor
(
private
viewletService
:
IViewletService
,
...
...
@@ -89,13 +133,10 @@ export abstract class ScopedService extends Disposable {
abstract
onScopeDeactivated
():
void
;
}
export
class
ScopedProgressService
extends
ScopedService
implements
ILocalProgressService
{
_serviceBrand
:
ServiceIdentifier
<
ILocalProgressService
>
;
export
class
CompositeProgressIndicator
extends
CompositeScope
implements
IProgressIndicator
{
private
isActive
:
boolean
;
private
progressbar
:
ProgressBar
;
private
progressState
:
Progress
State
.
State
=
Progress
State
.
None
;
private
progressState
:
Progress
IndicatorState
.
State
=
ProgressIndicator
State
.
None
;
constructor
(
progressbar
:
ProgressBar
,
...
...
@@ -107,7 +148,7 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
super
(
viewletService
,
panelService
,
scopeId
);
this
.
progressbar
=
progressbar
;
this
.
isActive
=
isActive
||
types
.
isUndefinedOrNull
(
scopeId
);
// If service is unscoped, enable by default
this
.
isActive
=
isActive
||
isUndefinedOrNull
(
scopeId
);
// If service is unscoped, enable by default
}
onScopeDeactivated
():
void
{
...
...
@@ -118,12 +159,12 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
this
.
isActive
=
true
;
// Return early if progress state indicates that progress is done
if
(
this
.
progressState
.
type
===
ProgressState
.
Done
.
type
)
{
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Done
.
type
)
{
return
;
}
// Replay Infinite Progress from Promise
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
While
)
{
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
While
)
{
let
delay
:
number
|
undefined
;
if
(
this
.
progressState
.
whileDelay
>
0
)
{
const
remainingDelay
=
this
.
progressState
.
whileDelay
-
(
Date
.
now
()
-
this
.
progressState
.
whileStart
);
...
...
@@ -136,12 +177,12 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
}
// Replay Infinite Progress
else
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
Infinite
)
{
else
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Infinite
)
{
this
.
progressbar
.
infinite
().
show
();
}
// Replay Finite Progress (Total & Worked)
else
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
Work
)
{
else
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Work
)
{
if
(
this
.
progressState
.
total
)
{
this
.
progressbar
.
total
(
this
.
progressState
.
total
).
show
();
}
...
...
@@ -158,30 +199,30 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
// Sort out Arguments
if
(
typeof
infiniteOrTotal
===
'
boolean
'
)
{
this
.
progressState
=
ProgressState
.
Infinite
;
this
.
progressState
=
Progress
Indicator
State
.
Infinite
;
}
else
{
this
.
progressState
=
new
ProgressState
.
Work
(
infiniteOrTotal
,
undefined
);
this
.
progressState
=
new
Progress
Indicator
State
.
Work
(
infiniteOrTotal
,
undefined
);
}
// Active: Show Progress
if
(
this
.
isActive
)
{
// Infinite: Start Progressbar and Show after Delay
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
Infinite
)
{
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Infinite
)
{
this
.
progressbar
.
infinite
().
show
(
delay
);
}
// Finite: Start Progressbar and Show after Delay
else
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
Work
&&
typeof
this
.
progressState
.
total
===
'
number
'
)
{
else
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Work
&&
typeof
this
.
progressState
.
total
===
'
number
'
)
{
this
.
progressbar
.
total
(
this
.
progressState
.
total
).
show
(
delay
);
}
}
return
{
total
:
(
total
:
number
)
=>
{
this
.
progressState
=
new
ProgressState
.
Work
(
this
.
progressState
=
new
Progress
Indicator
State
.
Work
(
total
,
this
.
progressState
.
type
===
ProgressState
.
Type
.
Work
?
this
.
progressState
.
worked
:
undefined
);
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Work
?
this
.
progressState
.
worked
:
undefined
);
if
(
this
.
isActive
)
{
this
.
progressbar
.
total
(
total
);
...
...
@@ -192,9 +233,9 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
// Verify first that we are either not active or the progressbar has a total set
if
(
!
this
.
isActive
||
this
.
progressbar
.
hasTotal
())
{
this
.
progressState
=
new
ProgressState
.
Work
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
Work
?
this
.
progressState
.
total
:
undefined
,
this
.
progressState
.
type
===
ProgressState
.
Type
.
Work
&&
typeof
this
.
progressState
.
worked
===
'
number
'
?
this
.
progressState
.
worked
+
worked
:
worked
);
this
.
progressState
=
new
Progress
Indicator
State
.
Work
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Work
?
this
.
progressState
.
total
:
undefined
,
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
Work
&&
typeof
this
.
progressState
.
worked
===
'
number
'
?
this
.
progressState
.
worked
+
worked
:
worked
);
if
(
this
.
isActive
)
{
this
.
progressbar
.
worked
(
worked
);
...
...
@@ -203,13 +244,13 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
// Otherwise the progress bar does not support worked(), we fallback to infinite() progress
else
{
this
.
progressState
=
ProgressState
.
Infinite
;
this
.
progressState
=
Progress
Indicator
State
.
Infinite
;
this
.
progressbar
.
infinite
().
show
();
}
},
done
:
()
=>
{
this
.
progressState
=
ProgressState
.
Done
;
this
.
progressState
=
Progress
Indicator
State
.
Done
;
if
(
this
.
isActive
)
{
this
.
progressbar
.
stop
().
hide
();
...
...
@@ -221,12 +262,12 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
async
showWhile
(
promise
:
Promise
<
any
>
,
delay
?:
number
):
Promise
<
void
>
{
// Join with existing running promise to ensure progress is accurate
if
(
this
.
progressState
.
type
===
ProgressState
.
Type
.
While
)
{
if
(
this
.
progressState
.
type
===
Progress
Indicator
State
.
Type
.
While
)
{
promise
=
Promise
.
all
([
promise
,
this
.
progressState
.
whilePromise
]);
}
// Keep Promise in State
this
.
progressState
=
new
ProgressState
.
While
(
promise
,
delay
||
0
,
Date
.
now
());
this
.
progressState
=
new
Progress
Indicator
State
.
While
(
promise
,
delay
||
0
,
Date
.
now
());
try
{
this
.
doShowWhile
(
delay
);
...
...
@@ -237,10 +278,10 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
}
finally
{
// If this is not the last promise in the list of joined promises, skip this
if
(
this
.
progressState
.
type
!==
ProgressState
.
Type
.
While
||
this
.
progressState
.
whilePromise
===
promise
)
{
if
(
this
.
progressState
.
type
!==
Progress
Indicator
State
.
Type
.
While
||
this
.
progressState
.
whilePromise
===
promise
)
{
// The while promise is either null or equal the promise we last hooked on
this
.
progressState
=
ProgressState
.
None
;
this
.
progressState
=
Progress
Indicator
State
.
None
;
if
(
this
.
isActive
)
{
this
.
progressbar
.
stop
().
hide
();
...
...
@@ -257,50 +298,3 @@ export class ScopedProgressService extends ScopedService implements ILocalProgre
}
}
}
export
class
LocalProgressService
implements
ILocalProgressService
{
_serviceBrand
:
ServiceIdentifier
<
ILocalProgressService
>
;
constructor
(
private
progressbar
:
ProgressBar
)
{
}
show
(
infinite
:
true
,
delay
?:
number
):
IProgressRunner
;
show
(
total
:
number
,
delay
?:
number
):
IProgressRunner
;
show
(
infiniteOrTotal
:
true
|
number
,
delay
?:
number
):
IProgressRunner
{
if
(
typeof
infiniteOrTotal
===
'
boolean
'
)
{
this
.
progressbar
.
infinite
().
show
(
delay
);
}
else
{
this
.
progressbar
.
total
(
infiniteOrTotal
).
show
(
delay
);
}
return
{
total
:
(
total
:
number
)
=>
{
this
.
progressbar
.
total
(
total
);
},
worked
:
(
worked
:
number
)
=>
{
if
(
this
.
progressbar
.
hasTotal
())
{
this
.
progressbar
.
worked
(
worked
);
}
else
{
this
.
progressbar
.
infinite
().
show
();
}
},
done
:
()
=>
{
this
.
progressbar
.
stop
().
hide
();
}
};
}
async
showWhile
(
promise
:
Promise
<
any
>
,
delay
?:
number
):
Promise
<
void
>
{
try
{
this
.
progressbar
.
infinite
().
show
(
delay
);
await
promise
;
}
catch
(
error
)
{
// ignore
}
finally
{
this
.
progressbar
.
stop
().
hide
();
}
}
}
src/vs/workbench/services/progress/browser/progressService.ts
浏览文件 @
0b4d2dcd
...
...
@@ -7,7 +7,7 @@ import 'vs/css!./media/progressService';
import
{
localize
}
from
'
vs/nls
'
;
import
{
IDisposable
,
dispose
,
DisposableStore
,
MutableDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IProgressService
,
IProgressOptions
,
IProgressStep
,
ProgressLocation
,
IProgress
,
Progress
,
IProgressCompositeOptions
,
IProgressNotificationOptions
,
IProgressRunner
,
I
LocalProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IProgressService
,
IProgressOptions
,
IProgressStep
,
ProgressLocation
,
IProgress
,
Progress
,
IProgressCompositeOptions
,
IProgressNotificationOptions
,
IProgressRunner
,
I
ProgressIndicator
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
StatusbarAlignment
,
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
...
...
@@ -286,7 +286,7 @@ export class ProgressService extends Disposable implements IProgressService {
return
this
.
withCompositeProgress
(
this
.
panelService
.
getProgressIndicator
(
panelid
),
task
,
options
);
}
private
withCompositeProgress
<
P
extends
Promise
<
R
>
,
R
=
unknown
>
(
compositeProgressService
:
ILocalProgressService
|
null
,
task
:
(
progress
:
IProgress
<
IProgressStep
>
)
=>
P
,
options
:
IProgressCompositeOptions
):
P
{
private
withCompositeProgress
<
P
extends
Promise
<
R
>
,
R
=
unknown
>
(
progressIndicator
:
IProgressIndicator
|
null
,
task
:
(
progress
:
IProgress
<
IProgressStep
>
)
=>
P
,
options
:
IProgressCompositeOptions
):
P
{
let
progressRunner
:
IProgressRunner
|
undefined
=
undefined
;
const
promise
=
task
({
...
...
@@ -305,12 +305,12 @@ export class ProgressService extends Disposable implements IProgressService {
}
});
if
(
compositeProgressService
)
{
if
(
progressIndicator
)
{
if
(
typeof
options
.
total
===
'
number
'
)
{
progressRunner
=
compositeProgressService
.
show
(
options
.
total
,
options
.
delay
);
progressRunner
=
progressIndicator
.
show
(
options
.
total
,
options
.
delay
);
promise
.
catch
(()
=>
undefined
/* ignore */
).
finally
(()
=>
progressRunner
?
progressRunner
.
done
()
:
undefined
);
}
else
{
compositeProgressService
.
showWhile
(
promise
,
options
.
delay
);
progressIndicator
.
showWhile
(
promise
,
options
.
delay
);
}
}
...
...
src/vs/workbench/services/progress/test/
localProgressService
.test.ts
→
src/vs/workbench/services/progress/test/
progressIndicator
.test.ts
浏览文件 @
0b4d2dcd
...
...
@@ -6,7 +6,7 @@
import
*
as
assert
from
'
assert
'
;
import
{
IAction
,
IActionViewItem
}
from
'
vs/base/common/actions
'
;
import
{
IEditorControl
}
from
'
vs/workbench/common/editor
'
;
import
{
ScopedProgressService
,
ScopedService
}
from
'
vs/workbench/services/progress/browser/localProgressService
'
;
import
{
CompositeScope
,
CompositeProgressIndicator
}
from
'
vs/workbench/services/progress/browser/progressIndicator
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
...
...
@@ -16,106 +16,55 @@ class TestViewlet implements IViewlet {
constructor
(
private
id
:
string
)
{
}
getId
():
string
{
return
this
.
id
;
}
/**
* Returns the name of this composite to show in the title area.
*/
getTitle
():
string
{
return
this
.
id
;
}
/**
* Returns the primary actions of the composite.
*/
getActions
():
IAction
[]
{
return
[];
}
/**
* Returns the secondary actions of the composite.
*/
getSecondaryActions
():
IAction
[]
{
return
[];
}
/**
* Returns an array of actions to show in the context menu of the composite
*/
public
getContextMenuActions
():
IAction
[]
{
return
[];
}
/**
* Returns the action item for a specific action.
*/
getActionViewItem
(
action
:
IAction
):
IActionViewItem
{
return
null
!
;
}
/**
* Returns the underlying control of this composite.
*/
getControl
():
IEditorControl
{
return
null
!
;
}
/**
* Asks the underlying control to focus.
*/
focus
():
void
{
}
getOptimalWidth
():
number
{
return
10
;
}
getId
():
string
{
return
this
.
id
;
}
getTitle
():
string
{
return
this
.
id
;
}
getActions
():
IAction
[]
{
return
[];
}
getSecondaryActions
():
IAction
[]
{
return
[];
}
getContextMenuActions
():
IAction
[]
{
return
[];
}
getActionViewItem
(
action
:
IAction
):
IActionViewItem
{
return
null
!
;
}
getControl
():
IEditorControl
{
return
null
!
;
}
focus
():
void
{
}
getOptimalWidth
():
number
{
return
10
;
}
}
class
Test
ScopedService
extends
ScopedServic
e
{
public
isActive
:
boolean
;
class
Test
CompositeScope
extends
CompositeScop
e
{
isActive
:
boolean
;
constructor
(
viewletService
:
IViewletService
,
panelService
:
IPanelService
,
scopeId
:
string
)
{
super
(
viewletService
,
panelService
,
scopeId
);
}
public
onScopeActivated
()
{
this
.
isActive
=
true
;
}
public
onScopeDeactivated
()
{
this
.
isActive
=
false
;
}
onScopeActivated
()
{
this
.
isActive
=
true
;
}
onScopeDeactivated
()
{
this
.
isActive
=
false
;
}
}
class
TestProgressBar
{
public
fTotal
:
number
;
public
fWorked
:
number
;
public
fInfinite
:
boolean
;
public
fDone
:
boolean
;
fTotal
:
number
;
fWorked
:
number
;
fInfinite
:
boolean
;
fDone
:
boolean
;
constructor
()
{
}
constructor
()
{
}
public
infinite
()
{
infinite
()
{
this
.
fDone
=
null
!
;
this
.
fInfinite
=
true
;
return
this
;
}
public
total
(
total
:
number
)
{
total
(
total
:
number
)
{
this
.
fDone
=
null
!
;
this
.
fTotal
=
total
;
return
this
;
}
public
hasTotal
()
{
hasTotal
()
{
return
!!
this
.
fTotal
;
}
public
worked
(
worked
:
number
)
{
worked
(
worked
:
number
)
{
this
.
fDone
=
null
!
;
if
(
this
.
fWorked
)
{
...
...
@@ -127,7 +76,7 @@ class TestProgressBar {
return
this
;
}
public
done
()
{
done
()
{
this
.
fDone
=
true
;
this
.
fInfinite
=
null
!
;
...
...
@@ -137,25 +86,21 @@ class TestProgressBar {
return
this
;
}
public
stop
()
{
stop
()
{
return
this
.
done
();
}
public
show
():
void
{
}
public
hide
():
void
{
show
():
void
{
}
}
hide
():
void
{
}
}
suite
(
'
Progress
Service
'
,
()
=>
{
suite
(
'
Progress
Indicator
'
,
()
=>
{
test
(
'
ScopedServic
e
'
,
()
=>
{
test
(
'
CompositeScop
e
'
,
()
=>
{
let
viewletService
=
new
TestViewletService
();
let
panelService
=
new
TestPanelService
();
let
service
=
new
Test
ScopedServic
e
(
viewletService
,
panelService
,
'
test.scopeId
'
);
let
service
=
new
Test
CompositeScop
e
(
viewletService
,
panelService
,
'
test.scopeId
'
);
const
testViewlet
=
new
TestViewlet
(
'
test.scopeId
'
);
assert
(
!
service
.
isActive
);
...
...
@@ -167,11 +112,11 @@ suite('Progress Service', () => {
});
test
(
'
WorkbenchProgressService
'
,
async
()
=>
{
test
(
'
CompositeProgressIndicator
'
,
async
()
=>
{
let
testProgressBar
=
new
TestProgressBar
();
let
viewletService
=
new
TestViewletService
();
let
panelService
=
new
TestPanelService
();
let
service
=
new
ScopedProgressService
((
<
any
>
testProgressBar
),
'
test.scopeId
'
,
true
,
viewletService
,
panelService
);
let
service
=
new
CompositeProgressIndicator
((
<
any
>
testProgressBar
),
'
test.scopeId
'
,
true
,
viewletService
,
panelService
);
// Active: Show (Infinite)
let
fn
=
service
.
show
(
true
);
...
...
src/vs/workbench/services/viewlet/browser/viewlet.ts
浏览文件 @
0b4d2dcd
...
...
@@ -7,7 +7,7 @@ import { IViewlet } from 'vs/workbench/common/viewlet';
import
{
createDecorator
,
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
I
LocalProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
I
ProgressIndicator
}
from
'
vs/platform/progress/common/progress
'
;
export
const
IViewletService
=
createDecorator
<
IViewletService
>
(
'
viewletService
'
);
...
...
@@ -48,7 +48,7 @@ export interface IViewletService {
/**
* Returns the progress indicator for the side bar.
*/
getProgressIndicator
(
id
:
string
):
I
LocalProgressService
|
null
;
getProgressIndicator
(
id
:
string
):
I
ProgressIndicator
|
null
;
/**
* Hide the active viewlet.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录