Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
683d774e
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,发现更多精彩内容 >>
提交
683d774e
编写于
6月 06, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
loaded scripts: use Map
#74948
上级
54ad623f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
17 deletion
+18
-17
src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
+18
-17
未找到文件。
src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
浏览文件 @
683d774e
...
...
@@ -45,16 +45,15 @@ type LoadedScriptsItem = BaseTreeItem;
class
BaseTreeItem
{
private
_showedMoreThanOne
:
boolean
;
private
_children
:
{
[
key
:
string
]:
BaseTreeItem
;
}
;
private
_children
=
new
Map
<
string
,
BaseTreeItem
>
()
;
private
_source
:
Source
;
constructor
(
private
_parent
:
BaseTreeItem
|
undefined
,
private
_label
:
string
)
{
this
.
_children
=
{};
this
.
_showedMoreThanOne
=
false
;
}
isLeaf
():
boolean
{
return
Object
.
keys
(
this
.
_children
).
length
===
0
;
return
this
.
_children
.
size
===
0
;
}
getSession
():
IDebugSession
|
undefined
{
...
...
@@ -66,12 +65,12 @@ class BaseTreeItem {
setSource
(
session
:
IDebugSession
,
source
:
Source
):
void
{
this
.
_source
=
source
;
this
.
_children
=
{}
;
this
.
_children
.
clear
()
;
if
(
source
.
raw
&&
source
.
raw
.
sources
)
{
for
(
const
src
of
source
.
raw
.
sources
)
{
if
(
src
.
name
&&
src
.
path
)
{
const
s
=
new
BaseTreeItem
(
this
,
src
.
name
);
this
.
_children
[
src
.
path
]
=
s
;
this
.
_children
.
set
(
src
.
path
,
s
)
;
const
ss
=
session
.
getSource
(
src
);
s
.
setSource
(
session
,
ss
);
}
...
...
@@ -80,26 +79,26 @@ class BaseTreeItem {
}
createIfNeeded
<
T
extends
BaseTreeItem
>
(
key
:
string
,
factory
:
(
parent
:
BaseTreeItem
,
label
:
string
)
=>
T
):
T
{
let
child
=
<
T
>
this
.
_children
[
key
]
;
let
child
=
<
T
>
this
.
_children
.
get
(
key
)
;
if
(
!
child
)
{
child
=
factory
(
this
,
key
);
this
.
_children
[
key
]
=
child
;
this
.
_children
.
set
(
key
,
child
)
;
}
return
child
;
}
getChild
(
key
:
string
):
BaseTreeItem
{
return
this
.
_children
[
key
]
;
getChild
(
key
:
string
):
BaseTreeItem
|
undefined
{
return
this
.
_children
.
get
(
key
)
;
}
remove
(
key
:
string
):
void
{
delete
this
.
_children
[
key
]
;
this
.
_children
.
delete
(
key
)
;
}
removeFromParent
():
void
{
if
(
this
.
_parent
)
{
this
.
_parent
.
remove
(
this
.
_label
);
if
(
Object
.
keys
(
this
.
_parent
.
_children
).
length
===
0
)
{
if
(
this
.
_parent
.
_children
.
size
===
0
)
{
this
.
_parent
.
removeFromParent
();
}
}
...
...
@@ -142,7 +141,7 @@ class BaseTreeItem {
if
(
child
)
{
return
child
.
hasChildren
();
}
return
Object
.
keys
(
this
.
_children
).
length
>
0
;
return
this
.
_children
.
size
>
0
;
}
// skips intermediate single-child nodes
...
...
@@ -151,7 +150,10 @@ class BaseTreeItem {
if
(
child
)
{
return
child
.
getChildren
();
}
const
array
=
Object
.
keys
(
this
.
_children
).
map
(
key
=>
this
.
_children
[
key
]);
const
array
=
[];
for
(
let
child
of
this
.
_children
.
values
())
{
array
.
push
(
child
);
}
return
Promise
.
resolve
(
array
.
sort
((
a
,
b
)
=>
this
.
compare
(
a
,
b
)));
}
...
...
@@ -199,12 +201,11 @@ class BaseTreeItem {
private
oneChild
():
BaseTreeItem
|
undefined
{
if
(
SMART
&&
!
this
.
_source
&&
!
this
.
_showedMoreThanOne
&&
!
(
this
instanceof
RootFolderTreeItem
)
&&
!
(
this
instanceof
SessionTreeItem
))
{
const
keys
=
Object
.
keys
(
this
.
_children
);
if
(
keys
.
length
===
1
)
{
return
this
.
_children
[
keys
[
0
]];
if
(
this
.
_children
.
size
===
1
)
{
return
this
.
_children
.
values
().
next
().
value
;
}
// if a node had more than one child once, it will never be skipped again
if
(
keys
.
length
>
1
)
{
if
(
this
.
_children
.
size
>
1
)
{
this
.
_showedMoreThanOne
=
true
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录