Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
744b5161
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,发现更多精彩内容 >>
提交
744b5161
编写于
11月 18, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #79519
上级
8031c495
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
37 deletion
+21
-37
src/vs/workbench/browser/parts/views/views.ts
src/vs/workbench/browser/parts/views/views.ts
+20
-36
src/vs/workbench/browser/parts/views/viewsViewlet.ts
src/vs/workbench/browser/parts/views/viewsViewlet.ts
+1
-1
未找到文件。
src/vs/workbench/browser/parts/views/views.ts
浏览文件 @
744b5161
...
...
@@ -11,7 +11,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IContextKeyService
,
IContextKeyChangeEvent
,
IReadableSet
,
IContextKey
,
RawContextKey
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
sortedDiff
,
firstIndex
,
move
,
isNonEmptyArray
}
from
'
vs/base/common/arrays
'
;
import
{
firstIndex
,
move
,
isNonEmptyArray
}
from
'
vs/base/common/arrays
'
;
import
{
isUndefinedOrNull
,
isUndefined
}
from
'
vs/base/common/types
'
;
import
{
MenuId
,
MenuRegistry
,
ICommandAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -223,7 +223,11 @@ export interface IAddedViewDescriptorRef extends IViewDescriptorRef {
export
class
ContributableViewsModel
extends
Disposable
{
readonly
viewDescriptors
:
IViewDescriptor
[]
=
[];
private
_viewDescriptors
:
IViewDescriptor
[]
=
[];
get
viewDescriptors
():
ReadonlyArray
<
IViewDescriptor
>
{
return
this
.
_viewDescriptors
;
}
get
visibleViewDescriptors
():
IViewDescriptor
[]
{
return
this
.
viewDescriptors
.
filter
(
v
=>
this
.
isViewDescriptorVisible
(
v
));
}
...
...
@@ -240,8 +244,8 @@ export class ContributableViewsModel extends Disposable {
private
_onDidChangeViewState
=
this
.
_register
(
new
Emitter
<
IViewDescriptorRef
>
());
protected
readonly
onDidChangeViewState
:
Event
<
IViewDescriptorRef
>
=
this
.
_onDidChangeViewState
.
event
;
private
_onDidChangeActiveViews
=
this
.
_register
(
new
Emitter
<
IViewDescriptor
[]
>
());
readonly
onDidChangeActiveViews
:
Event
<
IViewDescriptor
[]
>
=
this
.
_onDidChangeActiveViews
.
event
;
private
_onDidChangeActiveViews
=
this
.
_register
(
new
Emitter
<
ReadonlyArray
<
IViewDescriptor
>
>
());
readonly
onDidChangeActiveViews
:
Event
<
ReadonlyArray
<
IViewDescriptor
>
>
=
this
.
_onDidChangeActiveViews
.
event
;
constructor
(
container
:
ViewContainer
,
...
...
@@ -338,7 +342,7 @@ export class ContributableViewsModel extends Disposable {
const
fromViewDescriptor
=
this
.
viewDescriptors
[
fromIndex
];
const
toViewDescriptor
=
this
.
viewDescriptors
[
toIndex
];
move
(
this
.
viewDescriptors
,
fromIndex
,
toIndex
);
move
(
this
.
_
viewDescriptors
,
fromIndex
,
toIndex
);
for
(
let
index
=
0
;
index
<
this
.
viewDescriptors
.
length
;
index
++
)
{
const
state
=
this
.
viewStates
.
get
(
this
.
viewDescriptors
[
index
].
id
)
!
;
...
...
@@ -384,7 +388,7 @@ export class ContributableViewsModel extends Disposable {
return
0
;
}
return
(
this
.
getViewOrder
(
a
)
-
this
.
getViewOrder
(
b
))
||
this
.
getGroupOrderResult
(
a
,
b
)
||
(
a
.
id
<
b
.
id
?
-
1
:
1
)
;
return
(
this
.
getViewOrder
(
a
)
-
this
.
getViewOrder
(
b
))
||
this
.
getGroupOrderResult
(
a
,
b
);
}
private
getGroupOrderResult
(
a
:
IViewDescriptor
,
b
:
IViewDescriptor
)
{
...
...
@@ -406,14 +410,6 @@ export class ContributableViewsModel extends Disposable {
}
private
onDidChangeViewDescriptors
(
viewDescriptors
:
IViewDescriptor
[]):
void
{
const
ids
=
new
Set
<
string
>
();
for
(
const
viewDescriptor
of
this
.
viewDescriptors
)
{
ids
.
add
(
viewDescriptor
.
id
);
}
viewDescriptors
=
viewDescriptors
.
sort
(
this
.
compareViewDescriptors
.
bind
(
this
));
for
(
const
viewDescriptor
of
viewDescriptors
)
{
const
viewState
=
this
.
viewStates
.
get
(
viewDescriptor
.
id
);
if
(
viewState
)
{
...
...
@@ -433,38 +429,26 @@ export class ContributableViewsModel extends Disposable {
}
}
const
splices
=
sortedDiff
<
IViewDescriptor
>
(
this
.
viewDescriptors
,
viewDescriptors
,
this
.
compareViewDescriptors
.
bind
(
this
)
).
reverse
();
const
toRemove
:
{
index
:
number
,
viewDescriptor
:
IViewDescriptor
;
}[]
=
[];
const
toAdd
:
{
index
:
number
,
viewDescriptor
:
IViewDescriptor
,
size
?:
number
,
collapsed
:
boolean
;
}[]
=
[];
for
(
const
splice
of
splices
)
{
const
startViewDescriptor
=
this
.
viewDescriptors
[
splice
.
start
];
let
startIndex
=
startViewDescriptor
?
this
.
find
(
startViewDescriptor
.
id
).
visibleIndex
:
this
.
viewDescriptors
.
length
;
for
(
let
i
=
0
;
i
<
splice
.
deleteCount
;
i
++
)
{
const
viewDescriptor
=
this
.
viewDescriptors
[
splice
.
start
+
i
];
const
previous
=
this
.
_viewDescriptors
;
this
.
_viewDescriptors
=
viewDescriptors
.
sort
(
this
.
compareViewDescriptors
.
bind
(
this
));
if
(
this
.
isViewDescriptorVisible
(
viewDescriptor
)
)
{
toRemove
.
push
({
index
:
startIndex
++
,
viewDescriptor
});
}
for
(
let
index
=
0
;
index
<
previous
.
length
;
index
++
)
{
if
(
this
.
_viewDescriptors
.
every
(
viewDescriptor
=>
viewDescriptor
.
id
!==
previous
[
index
].
id
))
{
toRemove
.
push
({
index
,
viewDescriptor
:
previous
[
index
]
});
}
}
for
(
const
viewDescriptor
of
splice
.
toInsert
)
{
for
(
let
index
=
0
;
index
<
this
.
_viewDescriptors
.
length
;
index
++
)
{
const
viewDescriptor
=
this
.
_viewDescriptors
[
index
];
if
(
previous
.
every
(
previousViewDescriptor
=>
previousViewDescriptor
.
id
!==
viewDescriptor
.
id
))
{
const
state
=
this
.
viewStates
.
get
(
viewDescriptor
.
id
)
!
;
if
(
this
.
isViewDescriptorVisible
(
viewDescriptor
))
{
toAdd
.
push
({
index
:
startIndex
++
,
viewDescriptor
,
size
:
state
.
size
,
collapsed
:
!!
state
.
collapsed
});
}
toAdd
.
push
({
index
,
viewDescriptor
,
size
:
state
.
size
,
collapsed
:
!!
state
.
collapsed
});
}
}
this
.
viewDescriptors
.
splice
(
0
,
this
.
viewDescriptors
.
length
,
...
viewDescriptors
);
if
(
toRemove
.
length
)
{
this
.
_onDidRemove
.
fire
(
toRemove
);
}
...
...
src/vs/workbench/browser/parts/views/viewsViewlet.ts
浏览文件 @
744b5161
...
...
@@ -354,7 +354,7 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet {
}));
}
private
updateAllViews
(
viewDescriptors
:
IViewDescriptor
[]
)
{
private
updateAllViews
(
viewDescriptors
:
ReadonlyArray
<
IViewDescriptor
>
)
{
viewDescriptors
.
forEach
(
descriptor
=>
{
let
filterOnValue
=
this
.
getFilterOn
(
descriptor
);
if
(
!
filterOnValue
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录