Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
14657a93
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,发现更多精彩内容 >>
提交
14657a93
编写于
3月 06, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move viewlet & panel registry into views service
上级
6f230c5f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
40 addition
and
45 deletion
+40
-45
src/vs/workbench/browser/parts/views/views.ts
src/vs/workbench/browser/parts/views/views.ts
+40
-45
未找到文件。
src/vs/workbench/browser/parts/views/views.ts
浏览文件 @
14657a93
...
...
@@ -486,11 +486,10 @@ export class ViewsService extends Disposable implements IViewsService {
this
.
_register
(
this
.
viewContainersRegistry
.
onDidRegister
(({
viewContainer
,
viewContainerLocation
})
=>
this
.
onDidRegisterViewContainer
(
viewContainer
,
viewContainerLocation
)));
}
registerViewPaneContainer
(
viewPaneContainer
:
ViewPaneContainer
):
ViewPaneContainer
{
private
registerViewPaneContainer
(
viewPaneContainer
:
ViewPaneContainer
):
void
{
this
.
_register
(
viewPaneContainer
.
onDidAddViews
(
views
=>
this
.
onViewsAdded
(
views
)));
this
.
_register
(
viewPaneContainer
.
onDidChangeViewVisibility
(
view
=>
this
.
onViewsVisibilityChanged
(
view
,
view
.
isBodyVisible
())));
this
.
_register
(
viewPaneContainer
.
onDidRemoveViews
(
views
=>
this
.
onViewsRemoved
(
views
)));
return
viewPaneContainer
;
}
private
onViewsAdded
(
added
:
IView
[]):
void
{
...
...
@@ -520,7 +519,8 @@ export class ViewsService extends Disposable implements IViewsService {
return
contextKey
;
}
private
onDidRegisterViewContainer
(
viewContainer
:
ViewContainer
,
location
:
ViewContainerLocation
):
void
{
private
onDidRegisterViewContainer
(
viewContainer
:
ViewContainer
,
viewContainerLocation
:
ViewContainerLocation
):
void
{
this
.
registerViewletOrPanel
(
viewContainer
,
viewContainerLocation
);
const
viewDescriptorCollection
=
this
.
viewDescriptorService
.
getViewDescriptors
(
viewContainer
);
this
.
onViewDescriptorsAdded
(
viewDescriptorCollection
.
allViewDescriptors
,
viewContainer
);
this
.
_register
(
viewDescriptorCollection
.
onDidChangeViews
(({
added
,
removed
})
=>
{
...
...
@@ -698,26 +698,22 @@ export class ViewsService extends Disposable implements IViewsService {
return
null
;
}
}
export
function
createFileIconThemableTreeContainerScope
(
container
:
HTMLElement
,
themeService
:
IThemeService
):
IDisposable
{
addClass
(
container
,
'
file-icon-themable-tree
'
);
addClass
(
container
,
'
show-file-icons
'
);
const
onDidChangeFileIconTheme
=
(
theme
:
IFileIconTheme
)
=>
{
toggleClass
(
container
,
'
align-icons-and-twisties
'
,
theme
.
hasFileIcons
&&
!
theme
.
hasFolderIcons
);
toggleClass
(
container
,
'
hide-arrows
'
,
theme
.
hidesExplorerArrows
===
true
);
};
onDidChangeFileIconTheme
(
themeService
.
getFileIconTheme
());
return
themeService
.
onDidFileIconThemeChange
(
onDidChangeFileIconTheme
);
}
registerSingleton
(
IViewsService
,
ViewsService
);
private
registerViewletOrPanel
(
viewContainer
:
ViewContainer
,
viewContainerLocation
:
ViewContainerLocation
):
void
{
switch
(
viewContainerLocation
)
{
case
ViewContainerLocation
.
Panel
:
this
.
registerPanel
(
viewContainer
);
break
;
case
ViewContainerLocation
.
Sidebar
:
if
(
viewContainer
.
ctorDescriptor
)
{
this
.
registerViewlet
(
viewContainer
);
}
break
;
}
}
// Viewlets & Panels
(
function
registerViewletsAndPanels
():
void
{
const
registerPanel
=
(
viewContainer
:
ViewContainer
):
void
=>
{
private
registerPanel
(
viewContainer
:
ViewContainer
):
void
{
const
that
=
this
;
class
PaneContainerPanel
extends
PaneCompositePanel
{
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
...
...
@@ -727,11 +723,11 @@ registerSingleton(IViewsService, ViewsService);
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IExtensionService
extensionService
:
IExtensionService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IViewsService
viewsService
:
ViewsService
)
{
// Use composite's instantiation service to get the editor progress service for any editors instantiated within the composite
const
viewPaneContainer
=
viewsService
.
registerViewPaneContainer
((
instantiationService
as
any
).
createInstance
(
viewContainer
.
ctorDescriptor
!
.
ctor
,
...(
viewContainer
.
ctorDescriptor
!
.
staticArguments
||
[])
));
const
viewPaneContainer
=
(
instantiationService
as
any
).
createInstance
(
viewContainer
.
ctorDescriptor
!
.
ctor
,
...(
viewContainer
.
ctorDescriptor
!
.
staticArguments
||
[]
));
super
(
viewContainer
.
id
,
viewPaneContainer
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextMenuService
,
extensionService
,
contextService
);
that
.
registerViewPaneContainer
(
this
.
viewPaneContainer
);
}
}
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
registerPanel
(
PanelDescriptor
.
create
(
...
...
@@ -742,9 +738,10 @@ registerSingleton(IViewsService, ViewsService);
viewContainer
.
order
,
viewContainer
.
focusCommand
?.
id
,
));
}
;
}
const
registerViewlet
=
(
viewContainer
:
ViewContainer
):
void
=>
{
private
registerViewlet
(
viewContainer
:
ViewContainer
):
void
{
const
that
=
this
;
class
PaneContainerViewlet
extends
Viewlet
{
constructor
(
@
IConfigurationService
configurationService
:
IConfigurationService
,
...
...
@@ -756,37 +753,35 @@ registerSingleton(IViewsService, ViewsService);
@
IThemeService
themeService
:
IThemeService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IExtensionService
extensionService
:
IExtensionService
,
@
IViewsService
viewsService
:
ViewsService
)
{
// Use composite's instantiation service to get the editor progress service for any editors instantiated within the composite
const
viewPaneContainer
=
viewsService
.
registerViewPaneContainer
((
instantiationService
as
any
).
createInstance
(
viewContainer
.
ctorDescriptor
!
.
ctor
,
...(
viewContainer
.
ctorDescriptor
!
.
staticArguments
||
[])
));
const
viewPaneContainer
=
(
instantiationService
as
any
).
createInstance
(
viewContainer
.
ctorDescriptor
!
.
ctor
,
...(
viewContainer
.
ctorDescriptor
!
.
staticArguments
||
[]
));
super
(
viewContainer
.
id
,
viewPaneContainer
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextMenuService
,
extensionService
,
contextService
,
layoutService
,
configurationService
);
that
.
registerViewPaneContainer
(
this
.
viewPaneContainer
);
}
}
const
viewletDescriptor
=
ViewletDescriptor
.
create
(
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
).
registerViewlet
(
ViewletDescriptor
.
create
(
PaneContainerViewlet
,
viewContainer
.
id
,
viewContainer
.
name
,
isString
(
viewContainer
.
icon
)
?
viewContainer
.
icon
:
undefined
,
viewContainer
.
order
,
viewContainer
.
icon
instanceof
URI
?
viewContainer
.
icon
:
undefined
);
));
}
}
export
function
createFileIconThemableTreeContainerScope
(
container
:
HTMLElement
,
themeService
:
IThemeService
):
IDisposable
{
addClass
(
container
,
'
file-icon-themable-tree
'
);
addClass
(
container
,
'
show-file-icons
'
);
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
).
registerViewlet
(
viewletDescriptor
);
const
onDidChangeFileIconTheme
=
(
theme
:
IFileIconTheme
)
=>
{
toggleClass
(
container
,
'
align-icons-and-twisties
'
,
theme
.
hasFileIcons
&&
!
theme
.
hasFolderIcons
);
toggleClass
(
container
,
'
hide-arrows
'
,
theme
.
hidesExplorerArrows
===
true
);
};
const
viewContainerRegistry
=
Registry
.
as
<
IViewContainersRegistry
>
(
ViewExtensions
.
ViewContainersRegistry
);
viewContainerRegistry
.
getViewContainers
(
ViewContainerLocation
.
Panel
).
forEach
(
viewContainer
=>
registerPanel
(
viewContainer
));
viewContainerRegistry
.
onDidRegister
(({
viewContainer
,
viewContainerLocation
})
=>
{
switch
(
viewContainerLocation
)
{
case
ViewContainerLocation
.
Panel
:
registerPanel
(
viewContainer
);
return
;
case
ViewContainerLocation
.
Sidebar
:
if
(
viewContainer
.
ctorDescriptor
)
{
registerViewlet
(
viewContainer
);
}
return
;
}
});
})();
onDidChangeFileIconTheme
(
themeService
.
getFileIconTheme
());
return
themeService
.
onDidFileIconThemeChange
(
onDidChangeFileIconTheme
);
}
registerSingleton
(
IViewsService
,
ViewsService
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录