Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b833336
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,发现更多精彩内容 >>
提交
5b833336
编写于
1月 10, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editor service: allow to open multiple editors at once side by side
上级
f9f3333b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
8 deletion
+23
-8
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+13
-3
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+10
-5
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
5b833336
...
...
@@ -1100,7 +1100,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return
res
;
}
public
openEditors
(
editors
:
{
input
:
EditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[]):
TPromise
<
IEditor
[]
>
{
public
openEditors
(
editors
:
{
input
:
EditorInput
,
position
?:
Position
,
options
?:
EditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
{
input
:
EditorInput
,
options
?:
EditorOptions
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
{
input
:
EditorInput
,
position
?:
Position
,
options
?:
EditorOptions
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
{
if
(
!
editors
.
length
)
{
return
TPromise
.
as
<
IEditor
[]
>
([]);
}
...
...
@@ -1112,7 +1114,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const
ratio
=
this
.
editorGroupsControl
.
getRatio
();
return
this
.
doOpenEditors
(
editors
,
activePosition
,
ratio
);
return
this
.
doOpenEditors
(
editors
,
activePosition
,
ratio
,
sideBySide
);
}
public
hasEditorsToRestore
():
boolean
{
...
...
@@ -1143,7 +1145,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return
this
.
_onEditorsChanged
.
throttle
(
this
.
doOpenEditors
(
editors
,
activePosition
,
editorState
&&
editorState
.
ratio
));
}
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
ratio
?:
number
[]):
TPromise
<
IEditor
[]
>
{
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
?:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
ratio
?:
number
[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
{
// Find position if not provided already from calling side
editors
.
forEach
(
editor
=>
{
if
(
typeof
editor
.
position
!==
'
number
'
)
{
editor
.
position
=
this
.
findPosition
(
editor
.
input
,
editor
.
options
,
sideBySide
);
}
});
const
positionOneEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
ONE
);
const
positionTwoEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
TWO
);
const
positionThreeEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
THREE
);
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
5b833336
...
...
@@ -68,8 +68,10 @@ export interface IWorkbenchEditorService extends IEditorService {
* Similar to #openEditor() but allows to open multiple editors for different positions at the same time. If there are
* more than one editor per position, only the first one will be active and the others stacked behind inactive.
*/
openEditors
(
editors
:
{
input
:
IResourceInputType
,
position
:
Position
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
position
:
Position
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IResourceInputType
,
position
?:
Position
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
position
?:
Position
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IResourceInputType
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
/**
* Given a list of editors to replace, will look across all groups where this editor is open (active or hidden)
...
...
@@ -104,7 +106,8 @@ export interface IWorkbenchEditorService extends IEditorService {
export
interface
IEditorPart
{
openEditor
(
input
?:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
IEditor
>
;
openEditor
(
input
?:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
position
?:
Position
):
TPromise
<
IEditor
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
position
:
Position
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
position
?:
Position
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
openEditors
(
editors
:
{
input
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
replaceEditors
(
editors
:
{
toReplace
:
IEditorInput
,
replaceWith
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
}[],
position
?:
Position
):
TPromise
<
IEditor
[]
>
;
closeEditor
(
position
:
Position
,
input
:
IEditorInput
):
TPromise
<
void
>
;
closeEditors
(
position
:
Position
,
filter
?:
{
except
?:
IEditorInput
,
direction
?:
Direction
,
unmodifiedOnly
?:
boolean
}):
TPromise
<
void
>
;
...
...
@@ -208,7 +211,9 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
public
openEditors
(
editors
:
{
input
:
IResourceInputType
,
position
:
Position
}[]):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
{
input
:
IEditorInput
,
position
:
Position
,
options
?:
IEditorOptions
}[]):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
any
[]):
TPromise
<
IEditor
[]
>
{
public
openEditors
(
editors
:
{
input
:
IResourceInputType
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
{
input
:
IEditorInput
,
options
?:
IEditorOptions
}[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
;
public
openEditors
(
editors
:
any
[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
{
const
inputs
=
editors
.
map
(
editor
=>
this
.
createInput
(
editor
.
input
));
const
typedInputs
:
{
input
:
IEditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[]
=
inputs
.
map
((
input
,
index
)
=>
{
const
options
=
editors
[
index
].
input
instanceof
EditorInput
?
this
.
toOptions
(
editors
[
index
].
options
)
:
TextEditorOptions
.
from
(
editors
[
index
].
input
);
...
...
@@ -220,7 +225,7 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
};
});
return
this
.
editorPart
.
openEditors
(
typedInputs
);
return
this
.
editorPart
.
openEditors
(
typedInputs
,
sideBySide
);
}
public
replaceEditors
(
editors
:
{
toReplace
:
IResourceInputType
,
replaceWith
:
IResourceInputType
}[],
position
?:
Position
):
TPromise
<
IEditor
[]
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录