Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
268f0a22
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,发现更多精彩内容 >>
提交
268f0a22
编写于
1月 24, 2020
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add eventing to VDS to enable custom views
上级
1c4e2291
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
7 deletion
+35
-7
src/vs/workbench/api/browser/viewsExtensionPoint.ts
src/vs/workbench/api/browser/viewsExtensionPoint.ts
+0
-1
src/vs/workbench/browser/parts/views/customView.ts
src/vs/workbench/browser/parts/views/customView.ts
+17
-4
src/vs/workbench/common/views.ts
src/vs/workbench/common/views.ts
+2
-2
src/vs/workbench/services/views/browser/viewDescriptorService.ts
...workbench/services/views/browser/viewDescriptorService.ts
+16
-0
未找到文件。
src/vs/workbench/api/browser/viewsExtensionPoint.ts
浏览文件 @
268f0a22
...
...
@@ -37,7 +37,6 @@ import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/wor
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
// import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme';
export
interface
IUserFriendlyViewsContainerDescriptor
{
id
:
string
;
...
...
src/vs/workbench/browser/parts/views/customView.ts
浏览文件 @
268f0a22
...
...
@@ -13,7 +13,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IMenuService
,
MenuId
,
MenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextAwareMenuEntryActionViewItem
,
createAndFillInContextMenuActions
}
from
'
vs/platform/actions/browser/menuEntryActionViewItem
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ITreeView
,
ITreeItem
,
TreeItemCollapsibleState
,
ITreeViewDataProvider
,
TreeViewItemHandleArg
,
ITreeViewDescriptor
,
IViewsRegistry
,
ViewContainer
,
ITreeItemLabel
,
Extensions
,
IViewDescriptorService
,
IViewContainersRegistry
,
ViewContainerLocation
}
from
'
vs/workbench/common/views
'
;
import
{
ITreeView
,
ITreeItem
,
TreeItemCollapsibleState
,
ITreeViewDataProvider
,
TreeViewItemHandleArg
,
ITreeViewDescriptor
,
IViewsRegistry
,
ITreeItemLabel
,
Extensions
,
IViewDescriptorService
,
ViewContainer
,
ViewContainerLocation
}
from
'
vs/workbench/common/views
'
;
import
{
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -162,8 +162,8 @@ export class CustomTreeView extends Disposable implements ITreeView {
@
IProgressService
private
readonly
progressService
:
IProgressService
,
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
,
@
IKeybindingService
private
readonly
keybindingService
:
IKeybindingService
,
@
I
ViewDescriptorService
private
readonly
viewDescriptorService
:
IViewDescriptor
Service
,
@
I
NotificationService
private
readonly
notificationService
:
INotification
Service
@
I
NotificationService
private
readonly
notificationService
:
INotification
Service
,
@
I
ViewDescriptorService
private
readonly
viewDescriptorService
:
IViewDescriptor
Service
)
{
super
();
this
.
root
=
new
Root
();
...
...
@@ -174,10 +174,23 @@ export class CustomTreeView extends Disposable implements ITreeView {
this
.
doRefresh
([
this
.
root
]);
/** soft refresh **/
}
}));
this
.
_register
(
this
.
viewDescriptorService
.
onDidChangeLocation
(({
views
,
from
,
to
})
=>
{
if
(
views
.
some
(
v
=>
v
.
id
===
this
.
id
))
{
this
.
tree
?.
updateOptions
({
overrideStyles
:
{
listBackground
:
this
.
viewLocation
===
ViewContainerLocation
.
Sidebar
?
SIDE_BAR_BACKGROUND
:
PANEL_BACKGROUND
}
});
}
}));
this
.
create
();
}
get
viewContainer
():
ViewContainer
{
return
this
.
viewDescriptorService
.
getViewContainer
(
this
.
id
)
!
;
}
get
viewLocation
():
ViewContainerLocation
{
return
this
.
viewDescriptorService
.
getViewLocation
(
this
.
id
)
!
;
}
private
_dataProvider
:
ITreeViewDataProvider
|
undefined
;
get
dataProvider
():
ITreeViewDataProvider
|
undefined
{
return
this
.
_dataProvider
;
...
...
@@ -356,7 +369,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
},
multipleSelectionSupport
:
this
.
canSelectMany
,
overrideStyles
:
{
listBackground
:
SIDE_BAR
_BACKGROUND
listBackground
:
this
.
viewLocation
===
ViewContainerLocation
.
Sidebar
?
SIDE_BAR_BACKGROUND
:
PANEL
_BACKGROUND
}
})
as
WorkbenchAsyncDataTree
<
ITreeItem
,
ITreeItem
,
FuzzyScore
>
);
aligner
.
tree
=
this
.
tree
;
...
...
src/vs/workbench/common/views.ts
浏览文件 @
268f0a22
...
...
@@ -349,10 +349,8 @@ export interface IViewsViewlet extends IViewlet {
}
export
const
IViewDescriptorService
=
createDecorator
<
IViewDescriptorService
>
(
'
viewDescriptorService
'
);
export
const
IViewsService
=
createDecorator
<
IViewsService
>
(
'
viewsService
'
);
export
interface
IViewsService
{
_serviceBrand
:
undefined
;
...
...
@@ -361,12 +359,14 @@ export interface IViewsService {
openView
(
id
:
string
,
focus
?:
boolean
):
Promise
<
IView
|
null
>
;
}
export
const
IViewDescriptorService
=
createDecorator
<
IViewDescriptorService
>
(
'
viewDescriptorService
'
);
export
interface
IViewDescriptorService
{
_serviceBrand
:
undefined
;
readonly
onDidChangeContainer
:
Event
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainer
,
to
:
ViewContainer
}
>
;
readonly
onDidChangeLocation
:
Event
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainerLocation
,
to
:
ViewContainerLocation
}
>
;
moveViewToLocation
(
view
:
IViewDescriptor
,
location
:
ViewContainerLocation
):
void
;
...
...
src/vs/workbench/services/views/browser/viewDescriptorService.ts
浏览文件 @
268f0a22
...
...
@@ -184,6 +184,9 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
private
readonly
_onDidChangeContainer
:
Emitter
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainer
,
to
:
ViewContainer
}
>
=
this
.
_register
(
new
Emitter
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainer
,
to
:
ViewContainer
}
>
());
readonly
onDidChangeContainer
:
Event
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainer
,
to
:
ViewContainer
}
>
=
this
.
_onDidChangeContainer
.
event
;
private
readonly
_onDidChangeLocation
:
Emitter
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainerLocation
,
to
:
ViewContainerLocation
}
>
=
this
.
_register
(
new
Emitter
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainerLocation
,
to
:
ViewContainerLocation
}
>
());
readonly
onDidChangeLocation
:
Event
<
{
views
:
IViewDescriptor
[],
from
:
ViewContainerLocation
,
to
:
ViewContainerLocation
}
>
=
this
.
_onDidChangeLocation
.
event
;
private
readonly
viewDescriptorCollections
:
Map
<
ViewContainer
,
{
viewDescriptorCollection
:
ViewDescriptorCollection
,
disposable
:
IDisposable
;
}
>
;
private
readonly
activeViewContextKeys
:
Map
<
string
,
IContextKey
<
boolean
>>
;
private
readonly
movableViewContextKeys
:
Map
<
string
,
IContextKey
<
boolean
>>
;
...
...
@@ -298,6 +301,11 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
const
viewDescriptor
=
this
.
getViewDescriptor
(
viewId
);
if
(
viewContainer
&&
viewDescriptor
)
{
this
.
addViews
(
viewContainer
,
[
viewDescriptor
]);
const
newLocation
=
this
.
viewContainersRegistry
.
getViewContainerLocation
(
viewContainer
)
!
;
if
(
containerInfo
.
location
&&
containerInfo
.
location
!==
newLocation
)
{
this
.
_onDidChangeLocation
.
fire
({
views
:
[
viewDescriptor
],
from
:
containerInfo
.
location
,
to
:
newLocation
});
}
}
}
...
...
@@ -399,6 +407,14 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
if
(
from
&&
to
&&
from
!==
to
)
{
this
.
removeViews
(
from
,
views
);
this
.
addViews
(
to
,
views
);
const
oldLocation
=
this
.
viewContainersRegistry
.
getViewContainerLocation
(
from
)
!
;
const
newLocation
=
this
.
viewContainersRegistry
.
getViewContainerLocation
(
to
)
!
;
if
(
oldLocation
!==
newLocation
)
{
this
.
_onDidChangeLocation
.
fire
({
views
,
from
:
oldLocation
,
to
:
newLocation
});
}
this
.
_onDidChangeContainer
.
fire
({
views
,
from
,
to
});
this
.
saveViewPositionsToCache
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录