Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
30e7a527
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,发现更多精彩内容 >>
未验证
提交
30e7a527
编写于
1月 29, 2020
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tree.hasElement()
related to #86201
上级
a172a75b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
0 deletion
+37
-0
src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts
src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts
+8
-0
src/vs/base/browser/ui/tree/indexTreeModel.ts
src/vs/base/browser/ui/tree/indexTreeModel.ts
+19
-0
src/vs/base/browser/ui/tree/objectTree.ts
src/vs/base/browser/ui/tree/objectTree.ts
+4
-0
src/vs/base/browser/ui/tree/objectTreeModel.ts
src/vs/base/browser/ui/tree/objectTreeModel.ts
+4
-0
src/vs/base/browser/ui/tree/tree.ts
src/vs/base/browser/ui/tree/tree.ts
+2
-0
未找到文件。
src/vs/base/browser/ui/tree/compressedObjectTreeModel.ts
浏览文件 @
30e7a527
...
...
@@ -205,6 +205,10 @@ export class CompressedObjectTreeModel<T extends NonNullable<any>, TFilterData e
this
.
model
.
setChildren
(
node
,
children
,
_onDidCreateNode
,
_onDidDeleteNode
);
}
has
(
element
:
T
|
null
):
boolean
{
return
this
.
nodes
.
has
(
element
);
}
getListIndex
(
location
:
T
|
null
):
number
{
const
node
=
this
.
getCompressedNode
(
location
);
return
this
.
model
.
getListIndex
(
node
);
...
...
@@ -421,6 +425,10 @@ export class CompressibleObjectTreeModel<T extends NonNullable<any>, TFilterData
this
.
model
.
setCompressionEnabled
(
enabled
);
}
has
(
location
:
T
|
null
):
boolean
{
return
this
.
model
.
has
(
location
);
}
getListIndex
(
location
:
T
|
null
):
number
{
return
this
.
model
.
getListIndex
(
location
);
}
...
...
src/vs/base/browser/ui/tree/indexTreeModel.ts
浏览文件 @
30e7a527
...
...
@@ -199,6 +199,10 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
}
}
has
(
location
:
number
[]):
boolean
{
return
this
.
hasTreeNode
(
location
);
}
getListIndex
(
location
:
number
[]):
number
{
const
{
listIndex
,
visible
,
revealed
}
=
this
.
getTreeNodeWithListIndex
(
location
);
return
visible
&&
revealed
?
listIndex
:
-
1
;
...
...
@@ -516,6 +520,21 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
}
}
// cheap
private
hasTreeNode
(
location
:
number
[],
node
:
IIndexTreeNode
<
T
,
TFilterData
>
=
this
.
root
):
boolean
{
if
(
!
location
||
location
.
length
===
0
)
{
return
true
;
}
const
[
index
,
...
rest
]
=
location
;
if
(
index
<
0
||
index
>
node
.
children
.
length
)
{
return
false
;
}
return
this
.
hasTreeNode
(
rest
,
node
.
children
[
index
]);
}
// cheap
private
getTreeNode
(
location
:
number
[],
node
:
IIndexTreeNode
<
T
,
TFilterData
>
=
this
.
root
):
IIndexTreeNode
<
T
,
TFilterData
>
{
if
(
!
location
||
location
.
length
===
0
)
{
...
...
src/vs/base/browser/ui/tree/objectTree.ts
浏览文件 @
30e7a527
...
...
@@ -50,6 +50,10 @@ export class ObjectTree<T extends NonNullable<any>, TFilterData = void> extends
this
.
model
.
resort
(
element
,
recursive
);
}
hasElement
(
element
:
T
):
boolean
{
return
this
.
model
.
has
(
element
);
}
protected
createModel
(
user
:
string
,
view
:
ISpliceable
<
ITreeNode
<
T
,
TFilterData
>>
,
options
:
IObjectTreeOptions
<
T
,
TFilterData
>
):
ITreeModel
<
T
|
null
,
TFilterData
,
T
|
null
>
{
return
new
ObjectTreeModel
(
user
,
view
,
options
);
}
...
...
src/vs/base/browser/ui/tree/objectTreeModel.ts
浏览文件 @
30e7a527
...
...
@@ -195,6 +195,10 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
return
this
.
model
.
getLastElementAncestor
(
location
);
}
has
(
element
:
T
|
null
):
boolean
{
return
this
.
nodes
.
has
(
element
);
}
getListIndex
(
element
:
T
|
null
):
number
{
const
location
=
this
.
getElementLocation
(
element
);
return
this
.
model
.
getListIndex
(
location
);
...
...
src/vs/base/browser/ui/tree/tree.ts
浏览文件 @
30e7a527
...
...
@@ -108,6 +108,8 @@ export interface ITreeModel<T, TFilterData, TRef> {
readonly
onDidChangeCollapseState
:
Event
<
ICollapseStateChangeEvent
<
T
,
TFilterData
>>
;
readonly
onDidChangeRenderNodeCount
:
Event
<
ITreeNode
<
T
,
TFilterData
>>
;
has
(
location
:
TRef
):
boolean
;
getListIndex
(
location
:
TRef
):
number
;
getListRenderCount
(
location
:
TRef
):
number
;
getNode
(
location
?:
TRef
):
ITreeNode
<
T
,
any
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录