Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
acaf2503
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,发现更多精彩内容 >>
提交
acaf2503
编写于
12月 16, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editorgroup - reduce lookup overhead for known editors
上级
5f72d181
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
20 deletion
+19
-20
src/vs/workbench/common/editor/editorGroup.ts
src/vs/workbench/common/editor/editorGroup.ts
+19
-20
未找到文件。
src/vs/workbench/common/editor/editorGroup.ts
浏览文件 @
acaf2503
...
...
@@ -222,7 +222,7 @@ export class EditorGroup extends Disposable {
// Handle active
if
(
makeActive
)
{
this
.
s
etActive
(
newEditor
);
this
.
doS
etActive
(
newEditor
);
}
return
newEditor
;
...
...
@@ -233,12 +233,12 @@ export class EditorGroup extends Disposable {
// Pin it
if
(
makePinned
)
{
this
.
p
in
(
existingEditor
);
this
.
doP
in
(
existingEditor
);
}
// Activate it
if
(
makeActive
)
{
this
.
s
etActive
(
existingEditor
);
this
.
doS
etActive
(
existingEditor
);
}
// Respect index
...
...
@@ -328,7 +328,7 @@ export class EditorGroup extends Disposable {
}
}
this
.
s
etActive
(
newActive
);
this
.
doS
etActive
(
newActive
);
}
// One Editor
...
...
@@ -406,6 +406,10 @@ export class EditorGroup extends Disposable {
return
;
// not found
}
this
.
doSetActive
(
editor
);
}
private
doSetActive
(
editor
:
EditorInput
):
void
{
if
(
this
.
matches
(
this
.
active
,
editor
))
{
return
;
// already active
}
...
...
@@ -413,7 +417,9 @@ export class EditorGroup extends Disposable {
this
.
active
=
editor
;
// Bring to front in MRU list
this
.
setMostRecentlyUsed
(
editor
);
const
mruIndex
=
this
.
indexOf
(
editor
,
this
.
mru
);
this
.
mru
.
splice
(
mruIndex
,
1
);
this
.
mru
.
unshift
(
editor
);
// Event
this
.
_onDidEditorActivate
.
fire
(
editor
);
...
...
@@ -425,6 +431,10 @@ export class EditorGroup extends Disposable {
return
;
// not found
}
this
.
doPin
(
editor
);
}
private
doPin
(
editor
:
EditorInput
):
void
{
if
(
!
this
.
isPreview
(
editor
))
{
return
;
// can only pin a preview editor
}
...
...
@@ -442,6 +452,10 @@ export class EditorGroup extends Disposable {
return
;
// not found
}
this
.
doUnpin
(
editor
);
}
private
doUnpin
(
editor
:
EditorInput
):
void
{
if
(
!
this
.
isPinned
(
editor
))
{
return
;
// can only unpin a pinned editor
}
...
...
@@ -565,21 +579,6 @@ export class EditorGroup extends Disposable {
return
false
;
}
private
setMostRecentlyUsed
(
candidate
:
EditorInput
):
void
{
const
editor
=
this
.
findEditor
(
candidate
);
if
(
!
editor
)
{
return
;
// not found
}
const
mruIndex
=
this
.
indexOf
(
editor
,
this
.
mru
);
// Remove old index
this
.
mru
.
splice
(
mruIndex
,
1
);
// Set editor as most recent one (first)
this
.
mru
.
unshift
(
editor
);
}
private
matches
(
editorA
:
IEditorInput
|
null
,
editorB
:
IEditorInput
|
null
):
boolean
{
return
!!
editorA
&&
!!
editorB
&&
editorA
.
matches
(
editorB
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录