Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dc348340
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,发现更多精彩内容 >>
提交
dc348340
编写于
5月 02, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editor groups - resolve #96725
上级
2348a4f2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
5 deletion
+41
-5
src/vs/workbench/common/editor/editorGroup.ts
src/vs/workbench/common/editor/editorGroup.ts
+1
-1
src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts
.../workbench/test/browser/parts/editor/editorGroups.test.ts
+40
-4
未找到文件。
src/vs/workbench/common/editor/editorGroup.ts
浏览文件 @
dc348340
...
@@ -662,7 +662,7 @@ export class EditorGroup extends Disposable {
...
@@ -662,7 +662,7 @@ export class EditorGroup extends Disposable {
return
null
;
return
null
;
}));
}));
this
.
mru
=
data
.
mru
.
map
(
i
=>
this
.
editors
[
i
]
);
this
.
mru
=
coalesce
(
data
.
mru
.
map
(
i
=>
this
.
editors
[
i
])
);
this
.
active
=
this
.
mru
[
0
];
this
.
active
=
this
.
mru
[
0
];
...
...
src/vs/workbench/test/browser/parts/editor/editorGroups.test.ts
浏览文件 @
dc348340
...
@@ -145,11 +145,18 @@ interface ISerializedTestInput {
...
@@ -145,11 +145,18 @@ interface ISerializedTestInput {
class
TestEditorInputFactory
implements
IEditorInputFactory
{
class
TestEditorInputFactory
implements
IEditorInputFactory
{
static
disableSerialize
=
false
;
static
disableDeserialize
=
false
;
canSerialize
(
editorInput
:
EditorInput
):
boolean
{
canSerialize
(
editorInput
:
EditorInput
):
boolean
{
return
true
;
return
true
;
}
}
serialize
(
editorInput
:
EditorInput
):
string
{
serialize
(
editorInput
:
EditorInput
):
string
|
undefined
{
if
(
TestEditorInputFactory
.
disableSerialize
)
{
return
undefined
;
}
let
testEditorInput
=
<
TestEditorInput
>
editorInput
;
let
testEditorInput
=
<
TestEditorInput
>
editorInput
;
let
testInput
:
ISerializedTestInput
=
{
let
testInput
:
ISerializedTestInput
=
{
id
:
testEditorInput
.
id
id
:
testEditorInput
.
id
...
@@ -158,7 +165,11 @@ class TestEditorInputFactory implements IEditorInputFactory {
...
@@ -158,7 +165,11 @@ class TestEditorInputFactory implements IEditorInputFactory {
return
JSON
.
stringify
(
testInput
);
return
JSON
.
stringify
(
testInput
);
}
}
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
EditorInput
{
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
EditorInput
|
undefined
{
if
(
TestEditorInputFactory
.
disableDeserialize
)
{
return
undefined
;
}
let
testInput
:
ISerializedTestInput
=
JSON
.
parse
(
serializedEditorInput
);
let
testInput
:
ISerializedTestInput
=
JSON
.
parse
(
serializedEditorInput
);
return
new
TestEditorInput
(
testInput
.
id
);
return
new
TestEditorInput
(
testInput
.
id
);
...
@@ -170,6 +181,9 @@ suite('Workbench editor groups', () => {
...
@@ -170,6 +181,9 @@ suite('Workbench editor groups', () => {
let
disposables
:
IDisposable
[]
=
[];
let
disposables
:
IDisposable
[]
=
[];
setup
(()
=>
{
setup
(()
=>
{
TestEditorInputFactory
.
disableSerialize
=
false
;
TestEditorInputFactory
.
disableDeserialize
=
false
;
disposables
.
push
(
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorExtensions
.
EditorInputFactories
).
registerEditorInputFactory
(
'
testEditorInputForGroups
'
,
TestEditorInputFactory
));
disposables
.
push
(
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorExtensions
.
EditorInputFactories
).
registerEditorInputFactory
(
'
testEditorInputForGroups
'
,
TestEditorInputFactory
));
});
});
...
@@ -296,18 +310,40 @@ suite('Workbench editor groups', () => {
...
@@ -296,18 +310,40 @@ suite('Workbench editor groups', () => {
const
input2
=
input
();
const
input2
=
input
();
const
input3
=
input
();
const
input3
=
input
();
// Pinned and Active
// Case 1: inputs can be serialized and deserialized
group
.
openEditor
(
input1
,
{
pinned
:
true
,
active
:
true
});
group
.
openEditor
(
input1
,
{
pinned
:
true
,
active
:
true
});
group
.
openEditor
(
input2
,
{
pinned
:
true
,
active
:
true
});
group
.
openEditor
(
input2
,
{
pinned
:
true
,
active
:
true
});
group
.
openEditor
(
input3
,
{
pinned
:
false
,
active
:
true
});
group
.
openEditor
(
input3
,
{
pinned
:
false
,
active
:
true
});
cons
t
deserialized
=
createGroup
(
group
.
serialize
());
le
t
deserialized
=
createGroup
(
group
.
serialize
());
assert
.
equal
(
group
.
id
,
deserialized
.
id
);
assert
.
equal
(
group
.
id
,
deserialized
.
id
);
assert
.
equal
(
deserialized
.
count
,
3
);
assert
.
equal
(
deserialized
.
count
,
3
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
SEQUENTIAL
).
length
,
3
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
MOST_RECENTLY_ACTIVE
).
length
,
3
);
assert
.
equal
(
deserialized
.
isPinned
(
input1
),
true
);
assert
.
equal
(
deserialized
.
isPinned
(
input1
),
true
);
assert
.
equal
(
deserialized
.
isPinned
(
input2
),
true
);
assert
.
equal
(
deserialized
.
isPinned
(
input2
),
true
);
assert
.
equal
(
deserialized
.
isPinned
(
input3
),
false
);
assert
.
equal
(
deserialized
.
isPinned
(
input3
),
false
);
assert
.
equal
(
deserialized
.
isActive
(
input3
),
true
);
assert
.
equal
(
deserialized
.
isActive
(
input3
),
true
);
// Case 2: inputs cannot be serialized
TestEditorInputFactory
.
disableSerialize
=
true
;
deserialized
=
createGroup
(
group
.
serialize
());
assert
.
equal
(
group
.
id
,
deserialized
.
id
);
assert
.
equal
(
deserialized
.
count
,
0
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
SEQUENTIAL
).
length
,
0
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
MOST_RECENTLY_ACTIVE
).
length
,
0
);
// Case 3: inputs cannot be deserialized
TestEditorInputFactory
.
disableSerialize
=
false
;
TestEditorInputFactory
.
disableDeserialize
=
true
;
deserialized
=
createGroup
(
group
.
serialize
());
assert
.
equal
(
group
.
id
,
deserialized
.
id
);
assert
.
equal
(
deserialized
.
count
,
0
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
SEQUENTIAL
).
length
,
0
);
assert
.
equal
(
deserialized
.
getEditors
(
EditorsOrder
.
MOST_RECENTLY_ACTIVE
).
length
,
0
);
});
});
test
(
'
One Editor
'
,
function
()
{
test
(
'
One Editor
'
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录