Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
390ab6ec
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,发现更多精彩内容 >>
提交
390ab6ec
编写于
7月 10, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use DisposableStore in breadcrumbs
Replace uses of `IDisposable[]` with a `DisposableStore`
上级
2addbfc5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
24 deletion
+21
-24
src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts
src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts
+8
-9
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
+13
-15
未找到文件。
src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts
浏览文件 @
390ab6ec
...
...
@@ -57,7 +57,7 @@ export interface IBreadcrumbsItemEvent {
export
class
BreadcrumbsWidget
{
private
readonly
_disposables
=
new
Array
<
IDisposable
>
();
private
readonly
_disposables
=
new
DisposableStore
();
private
readonly
_domNode
:
HTMLDivElement
;
private
readonly
_styleElement
:
HTMLStyleElement
;
private
readonly
_scrollable
:
DomScrollableElement
;
...
...
@@ -94,26 +94,25 @@ export class BreadcrumbsWidget {
useShadows
:
false
,
scrollYToX
:
true
});
this
.
_disposables
.
push
(
this
.
_scrollable
);
this
.
_disposables
.
push
(
dom
.
addStandardDisposableListener
(
this
.
_domNode
,
'
click
'
,
e
=>
this
.
_onClick
(
e
)));
this
.
_disposables
.
add
(
this
.
_scrollable
);
this
.
_disposables
.
add
(
dom
.
addStandardDisposableListener
(
this
.
_domNode
,
'
click
'
,
e
=>
this
.
_onClick
(
e
)));
container
.
appendChild
(
this
.
_scrollable
.
getDomNode
());
this
.
_styleElement
=
dom
.
createStyleSheet
(
this
.
_domNode
);
le
t
focusTracker
=
dom
.
trackFocus
(
this
.
_domNode
);
this
.
_disposables
.
push
(
focusTracker
);
this
.
_disposables
.
push
(
focusTracker
.
onDidBlur
(
_
=>
this
.
_onDidChangeFocus
.
fire
(
false
)));
this
.
_disposables
.
push
(
focusTracker
.
onDidFocus
(
_
=>
this
.
_onDidChangeFocus
.
fire
(
true
)));
cons
t
focusTracker
=
dom
.
trackFocus
(
this
.
_domNode
);
this
.
_disposables
.
add
(
focusTracker
);
this
.
_disposables
.
add
(
focusTracker
.
onDidBlur
(
_
=>
this
.
_onDidChangeFocus
.
fire
(
false
)));
this
.
_disposables
.
add
(
focusTracker
.
onDidFocus
(
_
=>
this
.
_onDidChangeFocus
.
fire
(
true
)));
}
dispose
():
void
{
dispose
(
this
.
_disposables
);
this
.
_disposables
.
dispose
(
);
dispose
(
this
.
_pendingLayout
);
this
.
_onDidSelectItem
.
dispose
();
this
.
_onDidFocusItem
.
dispose
();
this
.
_onDidChangeFocus
.
dispose
();
this
.
_domNode
.
remove
();
this
.
_disposables
.
length
=
0
;
this
.
_nodes
.
length
=
0
;
this
.
_freeNodes
.
length
=
0
;
}
...
...
src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts
浏览文件 @
390ab6ec
...
...
@@ -9,7 +9,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
createMatches
,
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
{
dispose
,
IDisposabl
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStor
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
posix
}
from
'
vs/base/common/path
'
;
import
{
basename
,
dirname
,
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -55,7 +55,7 @@ export interface SelectEvent {
export
abstract
class
BreadcrumbsPicker
{
protected
readonly
_disposables
=
new
Array
<
IDisposable
>
();
protected
readonly
_disposables
=
new
DisposableStore
();
protected
readonly
_domNode
:
HTMLDivElement
;
protected
_arrow
:
HTMLDivElement
;
protected
_treeContainer
:
HTMLDivElement
;
...
...
@@ -81,7 +81,7 @@ export abstract class BreadcrumbsPicker {
}
dispose
():
void
{
dispose
(
this
.
_disposables
);
this
.
_disposables
.
dispose
(
);
this
.
_onDidPickElement
.
dispose
();
this
.
_tree
.
dispose
();
}
...
...
@@ -105,7 +105,7 @@ export abstract class BreadcrumbsPicker {
this
.
_layoutInfo
=
{
maxHeight
,
width
,
arrowSize
,
arrowOffset
,
inputHeight
:
0
};
this
.
_tree
=
this
.
_createTree
(
this
.
_treeContainer
);
this
.
_disposables
.
push
(
this
.
_tree
.
onDidChangeSelection
(
e
=>
{
this
.
_disposables
.
add
(
this
.
_tree
.
onDidChangeSelection
(
e
=>
{
if
(
e
.
browserEvent
!==
this
.
_fakeEvent
)
{
const
target
=
this
.
_getTargetFromEvent
(
e
.
elements
[
0
]);
if
(
target
)
{
...
...
@@ -115,13 +115,13 @@ export abstract class BreadcrumbsPicker {
}
}
}));
this
.
_disposables
.
push
(
this
.
_tree
.
onDidChangeFocus
(
e
=>
{
this
.
_disposables
.
add
(
this
.
_tree
.
onDidChangeFocus
(
e
=>
{
const
target
=
this
.
_getTargetFromEvent
(
e
.
elements
[
0
]);
if
(
target
)
{
this
.
_onDidFocusElement
.
fire
({
target
,
browserEvent
:
e
.
browserEvent
||
new
UIEvent
(
'
fake
'
)
});
}
}));
this
.
_disposables
.
push
(
this
.
_tree
.
onDidChangeContentHeight
(()
=>
{
this
.
_disposables
.
add
(
this
.
_tree
.
onDidChangeContentHeight
(()
=>
{
this
.
_layout
();
}));
...
...
@@ -276,7 +276,7 @@ class FileNavigationLabelProvider implements IKeyboardNavigationLabelProvider<IW
class
FileFilter
implements
ITreeFilter
<
IWorkspaceFolder
|
IFileStat
>
{
private
readonly
_cachedExpressions
=
new
Map
<
string
,
glob
.
ParsedExpression
>
();
private
readonly
_disposables
:
IDisposable
[]
=
[]
;
private
readonly
_disposables
=
new
DisposableStore
()
;
constructor
(
@
IWorkspaceContextService
private
readonly
_workspaceService
:
IWorkspaceContextService
,
...
...
@@ -306,15 +306,13 @@ class FileFilter implements ITreeFilter<IWorkspaceFolder | IFileStat> {
});
};
update
();
this
.
_disposables
.
push
(
config
,
config
.
onDidChange
(
update
),
_workspaceService
.
onDidChangeWorkspaceFolders
(
update
)
);
this
.
_disposables
.
add
(
config
);
this
.
_disposables
.
add
(
config
.
onDidChange
(
update
));
this
.
_disposables
.
add
(
_workspaceService
.
onDidChangeWorkspaceFolders
(
update
));
}
dispose
():
void
{
dispose
(
this
.
_disposables
);
this
.
_disposables
.
dispose
(
);
}
filter
(
element
:
IWorkspaceFolder
|
IFileStat
,
_parentVisibility
:
TreeVisibility
):
boolean
{
...
...
@@ -371,11 +369,11 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
dom
.
toggleClass
(
this
.
_treeContainer
,
'
align-icons-and-twisties
'
,
fileIconTheme
.
hasFileIcons
&&
!
fileIconTheme
.
hasFolderIcons
);
dom
.
toggleClass
(
this
.
_treeContainer
,
'
hide-arrows
'
,
fileIconTheme
.
hidesExplorerArrows
===
true
);
};
this
.
_disposables
.
push
(
this
.
_themeService
.
onDidFileIconThemeChange
(
onFileIconThemeChange
));
this
.
_disposables
.
add
(
this
.
_themeService
.
onDidFileIconThemeChange
(
onFileIconThemeChange
));
onFileIconThemeChange
(
this
.
_themeService
.
getFileIconTheme
());
const
labels
=
this
.
_instantiationService
.
createInstance
(
ResourceLabels
,
DEFAULT_LABELS_CONTAINER
/* TODO@Jo visibility propagation */
);
this
.
_disposables
.
push
(
labels
);
this
.
_disposables
.
add
(
labels
);
return
this
.
_instantiationService
.
createInstance
(
WorkbenchAsyncDataTree
,
container
,
new
FileVirtualDelegate
(),
[
this
.
_instantiationService
.
createInstance
(
FileRenderer
,
labels
)],
this
.
_instantiationService
.
createInstance
(
FileDataSource
),
{
multipleSelectionSupport
:
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录