Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2540182a
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,发现更多精彩内容 >>
提交
2540182a
编写于
1月 16, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #66598
上级
0ad67db1
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
68 addition
and
48 deletion
+68
-48
src/vs/workbench/api/browser/viewsExtensionPoint.ts
src/vs/workbench/api/browser/viewsExtensionPoint.ts
+67
-47
src/vs/workbench/common/views.ts
src/vs/workbench/common/views.ts
+1
-1
未找到文件。
src/vs/workbench/api/browser/viewsExtensionPoint.ts
浏览文件 @
2540182a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
forEach
}
from
'
vs/base/common/collections
'
;
import
{
forEach
}
from
'
vs/base/common/collections
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
ExtensionMessageCollector
,
ExtensionsRegistry
,
IExtensionPoint
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
ExtensionMessageCollector
,
ExtensionsRegistry
,
IExtensionPoint
,
IExtensionPointUser
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
ViewContainer
,
ViewsRegistry
,
ICustomViewDescriptor
,
IViewContainersRegistry
,
Extensions
as
ViewContainerExtensions
}
from
'
vs/workbench/common/views
'
;
import
{
ViewContainer
,
ViewsRegistry
,
ICustomViewDescriptor
,
IViewContainersRegistry
,
Extensions
as
ViewContainerExtensions
}
from
'
vs/workbench/common/views
'
;
import
{
CustomTreeViewPanel
,
CustomTreeView
}
from
'
vs/workbench/browser/parts/views/customView
'
;
import
{
CustomTreeViewPanel
,
CustomTreeView
}
from
'
vs/workbench/browser/parts/views/customView
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
@@ -82,11 +82,12 @@ const viewsContribution: IJSONSchema = {
...
@@ -82,11 +82,12 @@ const viewsContribution: IJSONSchema = {
}
}
};
};
type
ViewExtensionPointType
=
{
[
loc
:
string
]:
IUserFriendlyViewDescriptor
[]
};
const
viewsExtensionPoint
:
IExtensionPoint
<
{
[
loc
:
string
]:
IUserFriendlyViewDescriptor
[]
}
>
=
ExtensionsRegistry
.
registerExtensionPoint
<
{
[
loc
:
string
]:
IUserFriendlyViewDescriptor
[]
}
>
({
const
viewsExtensionPoint
:
IExtensionPoint
<
ViewExtensionPointType
>
=
ExtensionsRegistry
.
registerExtensionPoint
<
ViewExtensionPointType
>
({
extensionPoint
:
'
views
'
,
extensionPoint
:
'
views
'
,
deps
:
[
viewsContainersExtensionPoint
],
deps
:
[
viewsContainersExtensionPoint
],
jsonSchema
:
viewsContribution
jsonSchema
:
viewsContribution
,
isDynamic
:
true
});
});
class
ViewsContainersExtensionHandler
implements
IWorkbenchContribution
{
class
ViewsContainersExtensionHandler
implements
IWorkbenchContribution
{
...
@@ -101,8 +102,18 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
...
@@ -101,8 +102,18 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
}
}
private
handleAndRegisterCustomViews
()
{
private
handleAndRegisterCustomViews
()
{
viewsExtensionPoint
.
setHandler
(
extensions
=>
{
viewsExtensionPoint
.
setHandler
((
extensions
,
{
added
,
removed
})
=>
{
for
(
let
extension
of
extensions
)
{
if
(
removed
.
length
)
{
this
.
removeViews
(
removed
);
}
if
(
added
.
length
)
{
this
.
addViews
(
added
);
}
});
}
private
addViews
(
extensions
:
IExtensionPointUser
<
ViewExtensionPointType
>
[]):
void
{
for
(
const
extension
of
extensions
)
{
const
{
value
,
collector
}
=
extension
;
const
{
value
,
collector
}
=
extension
;
forEach
(
value
,
entry
=>
{
forEach
(
value
,
entry
=>
{
...
@@ -137,7 +148,8 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
...
@@ -137,7 +148,8 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
canToggleVisibility
:
true
,
canToggleVisibility
:
true
,
collapsed
:
this
.
showCollapsed
(
container
),
collapsed
:
this
.
showCollapsed
(
container
),
treeView
:
this
.
instantiationService
.
createInstance
(
CustomTreeView
,
item
.
id
,
container
),
treeView
:
this
.
instantiationService
.
createInstance
(
CustomTreeView
,
item
.
id
,
container
),
order
:
ExtensionIdentifier
.
equals
(
extension
.
description
.
identifier
,
container
.
extensionId
)
?
index
+
1
:
undefined
order
:
ExtensionIdentifier
.
equals
(
extension
.
description
.
identifier
,
container
.
extensionId
)
?
index
+
1
:
undefined
,
extensionId
:
extension
.
description
.
identifier
};
};
viewIds
.
push
(
viewDescriptor
.
id
);
viewIds
.
push
(
viewDescriptor
.
id
);
...
@@ -146,7 +158,16 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
...
@@ -146,7 +158,16 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
ViewsRegistry
.
registerViews
(
viewDescriptors
);
ViewsRegistry
.
registerViews
(
viewDescriptors
);
});
});
}
}
});
}
private
removeViews
(
extensions
:
IExtensionPointUser
<
ViewExtensionPointType
>
[]):
void
{
const
removedExtensions
:
Set
<
string
>
=
extensions
.
reduce
((
result
,
e
)
=>
{
result
.
add
(
ExtensionIdentifier
.
toKey
(
e
.
description
.
identifier
));
return
result
;
},
new
Set
<
string
>
());
for
(
const
viewContainer
of
this
.
viewContainersRegistry
.
all
)
{
const
removedViews
=
ViewsRegistry
.
getViews
(
viewContainer
).
filter
((
v
:
ICustomViewDescriptor
)
=>
v
.
extensionId
&&
removedExtensions
.
has
(
ExtensionIdentifier
.
toKey
(
v
.
extensionId
)));
if
(
removedViews
.
length
)
{
ViewsRegistry
.
deregisterViews
(
removedViews
.
map
(
v
=>
v
.
id
),
viewContainer
);
}
}
}
}
private
isValidViewDescriptors
(
viewDescriptors
:
IUserFriendlyViewDescriptor
[],
collector
:
ExtensionMessageCollector
):
boolean
{
private
isValidViewDescriptors
(
viewDescriptors
:
IUserFriendlyViewDescriptor
[],
collector
:
ExtensionMessageCollector
):
boolean
{
...
@@ -173,7 +194,6 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
...
@@ -173,7 +194,6 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
return
true
;
return
true
;
}
}
private
getViewContainer
(
value
:
string
):
ViewContainer
{
private
getViewContainer
(
value
:
string
):
ViewContainer
{
switch
(
value
)
{
switch
(
value
)
{
case
'
explorer
'
:
return
this
.
viewContainersRegistry
.
get
(
EXPLORER
);
case
'
explorer
'
:
return
this
.
viewContainersRegistry
.
get
(
EXPLORER
);
...
...
src/vs/workbench/common/views.ts
浏览文件 @
2540182a
...
@@ -297,7 +297,7 @@ export interface IRevealOptions {
...
@@ -297,7 +297,7 @@ export interface IRevealOptions {
export
interface
ICustomViewDescriptor
extends
IViewDescriptor
{
export
interface
ICustomViewDescriptor
extends
IViewDescriptor
{
readonly
treeView
:
ITreeView
;
readonly
treeView
:
ITreeView
;
readonly
extensionId
:
ExtensionIdentifier
;
}
}
export
type
TreeViewItemHandleArg
=
{
export
type
TreeViewItemHandleArg
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录