Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7352ad52
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,发现更多精彩内容 >>
提交
7352ad52
编写于
10月 17, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename positions (one, two, three)
上级
81a9436b
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
252 addition
and
251 deletion
+252
-251
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+7
-7
src/vs/workbench/browser/actions/openSettings.ts
src/vs/workbench/browser/actions/openSettings.ts
+4
-4
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+37
-37
src/vs/workbench/browser/parts/editor/editorCommands.ts
src/vs/workbench/browser/parts/editor/editorCommands.ts
+3
-3
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+30
-30
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+3
-3
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+158
-158
src/vs/workbench/electron-browser/integration.ts
src/vs/workbench/electron-browser/integration.ts
+1
-1
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+2
-1
src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts
...h/parts/extensions/electron-browser/dependenciesViewer.ts
+1
-1
src/vs/workbench/parts/files/browser/fileActions.ts
src/vs/workbench/parts/files/browser/fileActions.ts
+1
-1
src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts
...rkbench/parts/files/electron-browser/dirtyFilesTracker.ts
+1
-1
src/vs/workbench/test/browser/services.test.ts
src/vs/workbench/test/browser/services.test.ts
+1
-1
src/vs/workbench/test/common/editor/editorStacksModel.test.ts
...vs/workbench/test/common/editor/editorStacksModel.test.ts
+3
-3
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
7352ad52
...
@@ -111,17 +111,17 @@ export interface IEditor {
...
@@ -111,17 +111,17 @@ export interface IEditor {
*/
*/
export
enum
Position
{
export
enum
Position
{
/** Opens the editor in the
LEFT mo
st position replacing the input currently showing */
/** Opens the editor in the
fir
st position replacing the input currently showing */
LEFT
=
0
,
ONE
=
0
,
/** Opens the editor in the
CENTER
position replacing the input currently showing */
/** Opens the editor in the
second
position replacing the input currently showing */
CENTER
=
1
,
TWO
=
1
,
/** Opens the editor in the
RIGHT
most position replacing the input currently showing */
/** Opens the editor in the
third
most position replacing the input currently showing */
RIGHT
=
2
THREE
=
2
}
}
export
const
POSITIONS
=
[
Position
.
LEFT
,
Position
.
CENTER
,
Position
.
RIGHT
];
export
const
POSITIONS
=
[
Position
.
ONE
,
Position
.
TWO
,
Position
.
THREE
];
export
enum
Direction
{
export
enum
Direction
{
LEFT
,
LEFT
,
...
...
src/vs/workbench/browser/actions/openSettings.ts
浏览文件 @
7352ad52
...
@@ -74,12 +74,12 @@ export class BaseTwoEditorsAction extends Action {
...
@@ -74,12 +74,12 @@ export class BaseTwoEditorsAction extends Action {
return
this
.
createIfNotExists
(
editableResource
,
defaultEditableContents
).
then
(()
=>
{
return
this
.
createIfNotExists
(
editableResource
,
defaultEditableContents
).
then
(()
=>
{
return
this
.
editorService
.
createInput
({
resource
:
editableResource
}).
then
(
typedRightHandEditableInput
=>
{
return
this
.
editorService
.
createInput
({
resource
:
editableResource
}).
then
(
typedRightHandEditableInput
=>
{
const
editors
=
[
const
editors
=
[
{
input
:
leftHandDefaultInput
,
position
:
Position
.
LEFT
,
options
:
{
pinned
:
true
}
},
{
input
:
leftHandDefaultInput
,
position
:
Position
.
ONE
,
options
:
{
pinned
:
true
}
},
{
input
:
typedRightHandEditableInput
,
position
:
Position
.
CENTER
,
options
:
{
pinned
:
true
}
}
{
input
:
typedRightHandEditableInput
,
position
:
Position
.
TWO
,
options
:
{
pinned
:
true
}
}
];
];
return
this
.
editorService
.
openEditors
(
editors
).
then
(()
=>
{
return
this
.
editorService
.
openEditors
(
editors
).
then
(()
=>
{
this
.
editorGroupService
.
focusGroup
(
Position
.
CENTER
);
this
.
editorGroupService
.
focusGroup
(
Position
.
TWO
);
});
});
});
});
});
});
...
@@ -153,7 +153,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
...
@@ -153,7 +153,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
const
editorCount
=
this
.
editorService
.
getVisibleEditors
().
length
;
const
editorCount
=
this
.
editorService
.
getVisibleEditors
().
length
;
return
this
.
editorService
.
createInput
({
resource
:
this
.
contextService
.
toResource
(
WORKSPACE_CONFIG_DEFAULT_PATH
)
}).
then
(
typedInput
=>
{
return
this
.
editorService
.
createInput
({
resource
:
this
.
contextService
.
toResource
(
WORKSPACE_CONFIG_DEFAULT_PATH
)
}).
then
(
typedInput
=>
{
return
this
.
editorService
.
openEditor
(
typedInput
,
{
pinned
:
true
},
editorCount
===
2
?
Position
.
RIGHT
:
editorCount
===
1
?
Position
.
CENTER
:
void
0
);
return
this
.
editorService
.
openEditor
(
typedInput
,
{
pinned
:
true
},
editorCount
===
2
?
Position
.
THREE
:
editorCount
===
1
?
Position
.
TWO
:
void
0
);
});
});
}),
}),
new
Action
(
'
neverShowAgain
'
,
nls
.
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
null
,
true
,
()
=>
{
new
Action
(
'
neverShowAgain
'
,
nls
.
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
null
,
true
,
()
=>
{
...
...
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
7352ad52
...
@@ -72,24 +72,24 @@ export class SplitEditorAction extends Action {
...
@@ -72,24 +72,24 @@ export class SplitEditorAction extends Action {
// Open split editor to the right of left one
// Open split editor to the right of left one
case
1
:
case
1
:
targetPosition
=
Position
.
CENTER
;
targetPosition
=
Position
.
TWO
;
break
;
break
;
// Special case two editors opened
// Special case two editors opened
case
2
:
case
2
:
// Continue splitting to the right
// Continue splitting to the right
if
(
editorToSplit
.
position
===
Position
.
CENTER
)
{
if
(
editorToSplit
.
position
===
Position
.
TWO
)
{
targetPosition
=
Position
.
RIGHT
;
targetPosition
=
Position
.
THREE
;
}
}
// Push the center group to the right to make room for the splitted input
// Push the center group to the right to make room for the splitted input
else
if
(
editorToSplit
.
position
===
Position
.
LEFT
)
{
else
if
(
editorToSplit
.
position
===
Position
.
ONE
)
{
options
.
preserveFocus
=
true
;
options
.
preserveFocus
=
true
;
return
this
.
editorService
.
openEditor
(
editorToSplit
.
input
,
options
,
Position
.
RIGHT
).
then
(()
=>
{
return
this
.
editorService
.
openEditor
(
editorToSplit
.
input
,
options
,
Position
.
THREE
).
then
(()
=>
{
this
.
editorGroupService
.
moveGroup
(
Position
.
RIGHT
,
Position
.
CENTER
);
this
.
editorGroupService
.
moveGroup
(
Position
.
THREE
,
Position
.
TWO
);
this
.
editorGroupService
.
focusGroup
(
Position
.
CENTER
);
this
.
editorGroupService
.
focusGroup
(
Position
.
TWO
);
});
});
}
}
}
}
...
@@ -179,8 +179,8 @@ export class FocusFirstGroupAction extends Action {
...
@@ -179,8 +179,8 @@ export class FocusFirstGroupAction extends Action {
// Find left editor and focus it
// Find left editor and focus it
const
editors
=
this
.
editorService
.
getVisibleEditors
();
const
editors
=
this
.
editorService
.
getVisibleEditors
();
for
(
let
editor
of
editors
)
{
for
(
let
editor
of
editors
)
{
if
(
editor
.
position
===
Position
.
LEFT
)
{
if
(
editor
.
position
===
Position
.
ONE
)
{
this
.
editorGroupService
.
focusGroup
(
Position
.
LEFT
);
this
.
editorGroupService
.
focusGroup
(
Position
.
ONE
);
return
TPromise
.
as
(
true
);
return
TPromise
.
as
(
true
);
}
}
...
@@ -193,10 +193,10 @@ export class FocusFirstGroupAction extends Action {
...
@@ -193,10 +193,10 @@ export class FocusFirstGroupAction extends Action {
// For now only support to open files from history to the side
// For now only support to open files from history to the side
if
(
input
instanceof
EditorInput
)
{
if
(
input
instanceof
EditorInput
)
{
if
(
!!
getUntitledOrFileResource
(
input
))
{
if
(
!!
getUntitledOrFileResource
(
input
))
{
return
this
.
editorService
.
openEditor
(
input
,
null
,
Position
.
LEFT
);
return
this
.
editorService
.
openEditor
(
input
,
null
,
Position
.
ONE
);
}
}
}
else
{
}
else
{
return
this
.
editorService
.
openEditor
(
input
as
IResourceInput
,
Position
.
LEFT
);
return
this
.
editorService
.
openEditor
(
input
as
IResourceInput
,
Position
.
ONE
);
}
}
}
}
...
@@ -293,11 +293,11 @@ export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
...
@@ -293,11 +293,11 @@ export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
}
}
protected
getReferenceEditorSide
():
Position
{
protected
getReferenceEditorSide
():
Position
{
return
Position
.
LEFT
;
return
Position
.
ONE
;
}
}
protected
getTargetEditorSide
():
Position
{
protected
getTargetEditorSide
():
Position
{
return
Position
.
CENTER
;
return
Position
.
TWO
;
}
}
}
}
...
@@ -317,11 +317,11 @@ export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
...
@@ -317,11 +317,11 @@ export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
}
}
protected
getReferenceEditorSide
():
Position
{
protected
getReferenceEditorSide
():
Position
{
return
Position
.
CENTER
;
return
Position
.
TWO
;
}
}
protected
getTargetEditorSide
():
Position
{
protected
getTargetEditorSide
():
Position
{
return
Position
.
RIGHT
;
return
Position
.
THREE
;
}
}
}
}
...
@@ -349,9 +349,9 @@ export class FocusPreviousGroup extends Action {
...
@@ -349,9 +349,9 @@ export class FocusPreviousGroup extends Action {
// Find the next position to the left
// Find the next position to the left
let
nextPosition
:
Position
=
Position
.
LEFT
;
let
nextPosition
:
Position
=
Position
.
ONE
;
if
(
activeEditor
.
position
===
Position
.
RIGHT
)
{
if
(
activeEditor
.
position
===
Position
.
THREE
)
{
nextPosition
=
Position
.
CENTER
;
nextPosition
=
Position
.
TWO
;
}
}
// Focus next position if provided
// Focus next position if provided
...
@@ -377,9 +377,9 @@ export class FocusNextGroup extends Action {
...
@@ -377,9 +377,9 @@ export class FocusNextGroup extends Action {
super
(
id
,
label
);
super
(
id
,
label
);
this
.
navigateActions
=
[];
this
.
navigateActions
=
[];
this
.
navigateActions
[
Position
.
LEFT
]
=
instantiationService
.
createInstance
(
FocusFirstGroupAction
,
FocusFirstGroupAction
.
ID
,
FocusFirstGroupAction
.
LABEL
);
this
.
navigateActions
[
Position
.
ONE
]
=
instantiationService
.
createInstance
(
FocusFirstGroupAction
,
FocusFirstGroupAction
.
ID
,
FocusFirstGroupAction
.
LABEL
);
this
.
navigateActions
[
Position
.
CENTER
]
=
instantiationService
.
createInstance
(
FocusSecondGroupAction
,
FocusSecondGroupAction
.
ID
,
FocusSecondGroupAction
.
LABEL
);
this
.
navigateActions
[
Position
.
TWO
]
=
instantiationService
.
createInstance
(
FocusSecondGroupAction
,
FocusSecondGroupAction
.
ID
,
FocusSecondGroupAction
.
LABEL
);
this
.
navigateActions
[
Position
.
RIGHT
]
=
instantiationService
.
createInstance
(
FocusThirdGroupAction
,
FocusThirdGroupAction
.
ID
,
FocusThirdGroupAction
.
LABEL
);
this
.
navigateActions
[
Position
.
THREE
]
=
instantiationService
.
createInstance
(
FocusThirdGroupAction
,
FocusThirdGroupAction
.
ID
,
FocusThirdGroupAction
.
LABEL
);
}
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
public
run
(
event
?:
any
):
TPromise
<
any
>
{
...
@@ -388,11 +388,11 @@ export class FocusNextGroup extends Action {
...
@@ -388,11 +388,11 @@ export class FocusNextGroup extends Action {
let
nextPosition
:
Position
;
let
nextPosition
:
Position
;
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
!
activeEditor
)
{
if
(
!
activeEditor
)
{
nextPosition
=
Position
.
LEFT
;
nextPosition
=
Position
.
ONE
;
}
else
if
(
activeEditor
.
position
===
Position
.
LEFT
)
{
}
else
if
(
activeEditor
.
position
===
Position
.
ONE
)
{
nextPosition
=
Position
.
CENTER
;
nextPosition
=
Position
.
TWO
;
}
else
if
(
activeEditor
.
position
===
Position
.
CENTER
)
{
}
else
if
(
activeEditor
.
position
===
Position
.
TWO
)
{
nextPosition
=
Position
.
RIGHT
;
nextPosition
=
Position
.
THREE
;
}
}
// Run the action for the target next position
// Run the action for the target next position
...
@@ -419,7 +419,7 @@ export class OpenToSideAction extends Action {
...
@@ -419,7 +419,7 @@ export class OpenToSideAction extends Action {
private
updateEnablement
():
void
{
private
updateEnablement
():
void
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
RIGHT
);
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
THREE
);
}
}
public
run
(
context
:
any
):
TPromise
<
any
>
{
public
run
(
context
:
any
):
TPromise
<
any
>
{
...
@@ -676,13 +676,13 @@ export class MoveGroupLeftAction extends Action {
...
@@ -676,13 +676,13 @@ export class MoveGroupLeftAction extends Action {
let
position
=
context
?
this
.
editorGroupService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
let
position
=
context
?
this
.
editorGroupService
.
getStacksModel
().
positionOfGroup
(
context
.
group
)
:
null
;
if
(
typeof
position
!==
'
number
'
)
{
if
(
typeof
position
!==
'
number
'
)
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
&&
(
activeEditor
.
position
===
Position
.
CENTER
||
activeEditor
.
position
===
Position
.
RIGHT
))
{
if
(
activeEditor
&&
(
activeEditor
.
position
===
Position
.
TWO
||
activeEditor
.
position
===
Position
.
THREE
))
{
position
=
activeEditor
.
position
;
position
=
activeEditor
.
position
;
}
}
}
}
if
(
typeof
position
===
'
number
'
)
{
if
(
typeof
position
===
'
number
'
)
{
const
newPosition
=
(
position
===
Position
.
CENTER
)
?
Position
.
LEFT
:
Position
.
CENTER
;
const
newPosition
=
(
position
===
Position
.
TWO
)
?
Position
.
ONE
:
Position
.
TWO
;
// Move group
// Move group
this
.
editorGroupService
.
moveGroup
(
position
,
newPosition
);
this
.
editorGroupService
.
moveGroup
(
position
,
newPosition
);
...
@@ -712,13 +712,13 @@ export class MoveGroupRightAction extends Action {
...
@@ -712,13 +712,13 @@ export class MoveGroupRightAction extends Action {
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
editors
=
this
.
editorService
.
getVisibleEditors
();
const
editors
=
this
.
editorService
.
getVisibleEditors
();
if
((
editors
.
length
===
2
&&
activeEditor
.
position
===
Position
.
LEFT
)
||
(
editors
.
length
===
3
&&
activeEditor
.
position
!==
Position
.
RIGHT
))
{
if
((
editors
.
length
===
2
&&
activeEditor
.
position
===
Position
.
ONE
)
||
(
editors
.
length
===
3
&&
activeEditor
.
position
!==
Position
.
THREE
))
{
position
=
activeEditor
.
position
;
position
=
activeEditor
.
position
;
}
}
}
}
if
(
typeof
position
===
'
number
'
)
{
if
(
typeof
position
===
'
number
'
)
{
const
newPosition
=
(
position
===
Position
.
LEFT
)
?
Position
.
CENTER
:
Position
.
RIGHT
;
const
newPosition
=
(
position
===
Position
.
ONE
)
?
Position
.
TWO
:
Position
.
THREE
;
// Move group
// Move group
this
.
editorGroupService
.
moveGroup
(
position
,
newPosition
);
this
.
editorGroupService
.
moveGroup
(
position
,
newPosition
);
...
@@ -1014,9 +1014,9 @@ export class ShowEditorsInGroupAction extends Action {
...
@@ -1014,9 +1014,9 @@ export class ShowEditorsInGroupAction extends Action {
}
}
switch
(
stacks
.
positionOfGroup
(
context
.
group
))
{
switch
(
stacks
.
positionOfGroup
(
context
.
group
))
{
case
Position
.
CENTER
:
case
Position
.
TWO
:
return
this
.
quickOpenService
.
show
((
groupCount
===
2
)
?
NAVIGATE_IN_RIGHT_GROUP_PREFIX
:
NAVIGATE_IN_CENTER_GROUP_PREFIX
);
return
this
.
quickOpenService
.
show
((
groupCount
===
2
)
?
NAVIGATE_IN_RIGHT_GROUP_PREFIX
:
NAVIGATE_IN_CENTER_GROUP_PREFIX
);
case
Position
.
RIGHT
:
case
Position
.
THREE
:
return
this
.
quickOpenService
.
show
(
NAVIGATE_IN_RIGHT_GROUP_PREFIX
);
return
this
.
quickOpenService
.
show
(
NAVIGATE_IN_RIGHT_GROUP_PREFIX
);
}
}
...
@@ -1057,9 +1057,9 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
...
@@ -1057,9 +1057,9 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
const
count
=
stacks
.
groups
.
length
;
const
count
=
stacks
.
groups
.
length
;
let
prefix
=
NAVIGATE_IN_LEFT_GROUP_PREFIX
;
let
prefix
=
NAVIGATE_IN_LEFT_GROUP_PREFIX
;
if
(
activePosition
===
Position
.
CENTER
&&
count
===
3
)
{
if
(
activePosition
===
Position
.
TWO
&&
count
===
3
)
{
prefix
=
NAVIGATE_IN_CENTER_GROUP_PREFIX
;
prefix
=
NAVIGATE_IN_CENTER_GROUP_PREFIX
;
}
else
if
(
activePosition
===
Position
.
RIGHT
||
(
activePosition
===
Position
.
CENTER
&&
count
===
2
))
{
}
else
if
(
activePosition
===
Position
.
THREE
||
(
activePosition
===
Position
.
TWO
&&
count
===
2
))
{
prefix
=
NAVIGATE_IN_RIGHT_GROUP_PREFIX
;
prefix
=
NAVIGATE_IN_RIGHT_GROUP_PREFIX
;
}
}
...
@@ -1238,7 +1238,7 @@ export class MoveEditorToLeftGroupAction extends Action {
...
@@ -1238,7 +1238,7 @@ export class MoveEditorToLeftGroupAction extends Action {
public
run
():
TPromise
<
any
>
{
public
run
():
TPromise
<
any
>
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
&&
activeEditor
.
position
!==
Position
.
LEFT
)
{
if
(
activeEditor
&&
activeEditor
.
position
!==
Position
.
ONE
)
{
this
.
editorGroupService
.
moveEditor
(
activeEditor
.
input
,
activeEditor
.
position
,
activeEditor
.
position
-
1
);
this
.
editorGroupService
.
moveEditor
(
activeEditor
.
input
,
activeEditor
.
position
,
activeEditor
.
position
-
1
);
}
}
...
@@ -1262,7 +1262,7 @@ export class MoveEditorToRightGroupAction extends Action {
...
@@ -1262,7 +1262,7 @@ export class MoveEditorToRightGroupAction extends Action {
public
run
():
TPromise
<
any
>
{
public
run
():
TPromise
<
any
>
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
&&
activeEditor
.
position
!==
Position
.
RIGHT
)
{
if
(
activeEditor
&&
activeEditor
.
position
!==
Position
.
THREE
)
{
this
.
editorGroupService
.
moveEditor
(
activeEditor
.
input
,
activeEditor
.
position
,
activeEditor
.
position
+
1
);
this
.
editorGroupService
.
moveEditor
(
activeEditor
.
input
,
activeEditor
.
position
,
activeEditor
.
position
+
1
);
}
}
...
...
src/vs/workbench/browser/parts/editor/editorCommands.ts
浏览文件 @
7352ad52
...
@@ -127,13 +127,13 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, activeEditor:
...
@@ -127,13 +127,13 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, activeEditor:
newPosition
=
newPosition
+
1
;
newPosition
=
newPosition
+
1
;
break
;
break
;
case
ActiveEditorMovePositioning
.
FIRST
:
case
ActiveEditorMovePositioning
.
FIRST
:
newPosition
=
Position
.
LEFT
;
newPosition
=
Position
.
ONE
;
break
;
break
;
case
ActiveEditorMovePositioning
.
LAST
:
case
ActiveEditorMovePositioning
.
LAST
:
newPosition
=
Position
.
RIGHT
;
newPosition
=
Position
.
THREE
;
break
;
break
;
case
ActiveEditorMovePositioning
.
CENTER
:
case
ActiveEditorMovePositioning
.
CENTER
:
newPosition
=
Position
.
CENTER
;
newPosition
=
Position
.
TWO
;
break
;
break
;
case
ActiveEditorMovePositioning
.
POSITION
:
case
ActiveEditorMovePositioning
.
POSITION
:
newPosition
=
args
.
value
-
1
;
newPosition
=
args
.
value
-
1
;
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
7352ad52
...
@@ -204,7 +204,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -204,7 +204,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
// Opened to the side
// Opened to the side
if
(
position
!==
Position
.
LEFT
)
{
if
(
position
!==
Position
.
ONE
)
{
this
.
telemetryService
.
publicLog
(
'
workbenchSideEditorOpened
'
,
{
position
:
position
});
this
.
telemetryService
.
publicLog
(
'
workbenchSideEditorOpened
'
,
{
position
:
position
});
}
}
...
@@ -915,13 +915,13 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -915,13 +915,13 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
ratio
?:
number
[]):
TPromise
<
BaseEditor
[]
>
{
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
ratio
?:
number
[]):
TPromise
<
BaseEditor
[]
>
{
const
leftEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
LEFT
);
const
leftEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
ONE
);
const
centerEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
CENTER
);
const
centerEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
TWO
);
const
rightEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
RIGHT
);
const
rightEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
THREE
);
const
leftGroup
=
this
.
stacks
.
groupAt
(
Position
.
LEFT
);
const
leftGroup
=
this
.
stacks
.
groupAt
(
Position
.
ONE
);
const
centerGroup
=
this
.
stacks
.
groupAt
(
Position
.
CENTER
);
const
centerGroup
=
this
.
stacks
.
groupAt
(
Position
.
TWO
);
const
rightGroup
=
this
.
stacks
.
groupAt
(
Position
.
RIGHT
);
const
rightGroup
=
this
.
stacks
.
groupAt
(
Position
.
THREE
);
// Compute the imaginary count if we const all editors open as the way requested
// Compute the imaginary count if we const all editors open as the way requested
const
leftCount
=
leftEditors
.
length
+
(
leftGroup
?
leftGroup
.
count
:
0
);
const
leftCount
=
leftEditors
.
length
+
(
leftGroup
?
leftGroup
.
count
:
0
);
...
@@ -938,7 +938,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -938,7 +938,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Validate active input
// Validate active input
if
(
typeof
activePosition
!==
'
number
'
)
{
if
(
typeof
activePosition
!==
'
number
'
)
{
activePosition
=
Position
.
LEFT
;
activePosition
=
Position
.
ONE
;
}
}
// Validate ratios
// Validate ratios
...
@@ -1173,7 +1173,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1173,7 +1173,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const
visibleEditors
=
this
.
getVisibleEditors
();
const
visibleEditors
=
this
.
getVisibleEditors
();
const
activeEditor
=
this
.
getActiveEditor
();
const
activeEditor
=
this
.
getActiveEditor
();
if
(
visibleEditors
.
length
===
0
||
!
activeEditor
)
{
if
(
visibleEditors
.
length
===
0
||
!
activeEditor
)
{
return
Position
.
LEFT
;
// can only be LEFT
return
Position
.
ONE
;
// can only be LEFT
}
}
// Respect option to reveal an editor if it is already visible
// Respect option to reveal an editor if it is already visible
...
@@ -1193,17 +1193,17 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1193,17 +1193,17 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
if
(
types
.
isUndefinedOrNull
(
arg1
)
||
arg1
===
false
)
{
if
(
types
.
isUndefinedOrNull
(
arg1
)
||
arg1
===
false
)
{
const
lastActivePosition
=
this
.
sideBySideControl
.
getActivePosition
();
const
lastActivePosition
=
this
.
sideBySideControl
.
getActivePosition
();
return
lastActivePosition
||
Position
.
LEFT
;
return
lastActivePosition
||
Position
.
ONE
;
}
}
// Position is sideBySide: Find position relative to active editor
// Position is sideBySide: Find position relative to active editor
if
(
arg1
===
true
)
{
if
(
arg1
===
true
)
{
switch
(
activeEditor
.
position
)
{
switch
(
activeEditor
.
position
)
{
case
Position
.
LEFT
:
case
Position
.
ONE
:
return
Position
.
CENTER
;
return
Position
.
TWO
;
case
Position
.
CENTER
:
case
Position
.
TWO
:
return
Position
.
RIGHT
;
return
Position
.
THREE
;
case
Position
.
RIGHT
:
case
Position
.
THREE
:
return
null
;
// Cannot open to the side of the right most editor
return
null
;
// Cannot open to the side of the right most editor
}
}
...
@@ -1211,8 +1211,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1211,8 +1211,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
// Position is provided, validate it
// Position is provided, validate it
if
(
arg1
===
Position
.
RIGHT
&&
visibleEditors
.
length
===
1
)
{
if
(
arg1
===
Position
.
THREE
&&
visibleEditors
.
length
===
1
)
{
return
Position
.
CENTER
;
return
Position
.
TWO
;
}
}
return
arg1
;
return
arg1
;
...
@@ -1260,15 +1260,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1260,15 +1260,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
if
(
types
.
isUndefinedOrNull
(
arg2
))
{
if
(
types
.
isUndefinedOrNull
(
arg2
))
{
const
rochade
=
<
Rochade
>
arg1
;
const
rochade
=
<
Rochade
>
arg1
;
switch
(
rochade
)
{
switch
(
rochade
)
{
case
Rochade
.
CENTER_TO_LEFT
:
case
Rochade
.
TWO_TO_ONE
:
this
.
rochade
(
Position
.
CENTER
,
Position
.
LEFT
);
this
.
rochade
(
Position
.
TWO
,
Position
.
ONE
);
break
;
break
;
case
Rochade
.
RIGHT_TO_CENTER
:
case
Rochade
.
THREE_TO_TWO
:
this
.
rochade
(
Position
.
RIGHT
,
Position
.
CENTER
);
this
.
rochade
(
Position
.
THREE
,
Position
.
TWO
);
break
;
break
;
case
Rochade
.
CENTER_AND_RIGHT_TO_LEFT
:
case
Rochade
.
TWO_AND_THREE_TO_ONE
:
this
.
rochade
(
Position
.
CENTER
,
Position
.
LEFT
);
this
.
rochade
(
Position
.
TWO
,
Position
.
ONE
);
this
.
rochade
(
Position
.
RIGHT
,
Position
.
CENTER
);
this
.
rochade
(
Position
.
THREE
,
Position
.
TWO
);
}
}
}
else
{
}
else
{
const
from
=
<
Position
>
arg1
;
const
from
=
<
Position
>
arg1
;
...
@@ -1329,20 +1329,20 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
...
@@ -1329,20 +1329,20 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// LEFT | CENTER | RIGHT
// LEFT | CENTER | RIGHT
if
(
groups
.
length
>
2
)
{
if
(
groups
.
length
>
2
)
{
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
LEFT
),
EditorPart
.
GROUP_LEFT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
ONE
),
EditorPart
.
GROUP_LEFT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
CENTER
),
EditorPart
.
GROUP_CENTER_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
TWO
),
EditorPart
.
GROUP_CENTER_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
RIGHT
),
EditorPart
.
GROUP_RIGHT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
THREE
),
EditorPart
.
GROUP_RIGHT_LABEL
);
}
}
// LEFT | RIGHT
// LEFT | RIGHT
else
if
(
groups
.
length
>
1
)
{
else
if
(
groups
.
length
>
1
)
{
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
LEFT
),
EditorPart
.
GROUP_LEFT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
ONE
),
EditorPart
.
GROUP_LEFT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
CENTER
),
EditorPart
.
GROUP_RIGHT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
TWO
),
EditorPart
.
GROUP_RIGHT_LABEL
);
}
}
// LEFT
// LEFT
else
{
else
{
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
LEFT
),
EditorPart
.
GROUP_LEFT_LABEL
);
this
.
stacks
.
renameGroup
(
this
.
stacks
.
groupAt
(
Position
.
ONE
),
EditorPart
.
GROUP_LEFT_LABEL
);
}
}
}
}
}
}
...
...
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
7352ad52
...
@@ -217,7 +217,7 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
...
@@ -217,7 +217,7 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
export
class
LeftEditorGroupPicker
extends
EditorGroupPicker
{
export
class
LeftEditorGroupPicker
extends
EditorGroupPicker
{
protected
getPosition
():
Position
{
protected
getPosition
():
Position
{
return
Position
.
LEFT
;
return
Position
.
ONE
;
}
}
}
}
...
@@ -226,7 +226,7 @@ export class CenterEditorGroupPicker extends EditorGroupPicker {
...
@@ -226,7 +226,7 @@ export class CenterEditorGroupPicker extends EditorGroupPicker {
protected
getPosition
():
Position
{
protected
getPosition
():
Position
{
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
return
stacks
.
groups
.
length
>
2
?
Position
.
CENTER
:
-
1
;
// with 2 groups open, the center one is not available
return
stacks
.
groups
.
length
>
2
?
Position
.
TWO
:
-
1
;
// with 2 groups open, the center one is not available
}
}
}
}
...
@@ -235,7 +235,7 @@ export class RightEditorGroupPicker extends EditorGroupPicker {
...
@@ -235,7 +235,7 @@ export class RightEditorGroupPicker extends EditorGroupPicker {
protected
getPosition
():
Position
{
protected
getPosition
():
Position
{
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
return
stacks
.
groups
.
length
>
2
?
Position
.
RIGHT
:
Position
.
CENTER
;
return
stacks
.
groups
.
length
>
2
?
Position
.
THREE
:
Position
.
TWO
;
}
}
}
}
...
...
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
7352ad52
此差异已折叠。
点击以展开。
src/vs/workbench/electron-browser/integration.ts
浏览文件 @
7352ad52
...
@@ -257,7 +257,7 @@ export class ElectronIntegration {
...
@@ -257,7 +257,7 @@ export class ElectronIntegration {
return
this
.
editorService
.
openEditors
(
resources
.
map
((
r
,
index
)
=>
{
return
this
.
editorService
.
openEditors
(
resources
.
map
((
r
,
index
)
=>
{
return
{
return
{
input
:
r
,
input
:
r
,
position
:
activeEditor
?
activeEditor
.
position
:
Position
.
LEFT
position
:
activeEditor
?
activeEditor
.
position
:
Position
.
ONE
};
};
}));
}));
});
});
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
7352ad52
...
@@ -20,6 +20,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
...
@@ -20,6 +20,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
isWindows
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
isWindows
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
IOptions
}
from
'
vs/workbench/common/options
'
;
import
{
IOptions
}
from
'
vs/workbench/common/options
'
;
import
{
Position
as
EditorPosition
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
,
TextEditorOptions
,
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
,
TextEditorOptions
,
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
...
@@ -248,7 +249,7 @@ export class Workbench implements IPartService {
...
@@ -248,7 +249,7 @@ export class Workbench implements IPartService {
return
{
return
{
input
:
inputWithOptions
.
input
,
input
:
inputWithOptions
.
input
,
options
:
inputWithOptions
.
options
,
options
:
inputWithOptions
.
options
,
position
:
Position
.
LEFT
position
:
EditorPosition
.
ONE
};
};
});
});
...
...
src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts
浏览文件 @
7352ad52
...
@@ -217,7 +217,7 @@ class OpenExtensionToSideAction extends Action {
...
@@ -217,7 +217,7 @@ class OpenExtensionToSideAction extends Action {
private
updateEnablement
():
void
{
private
updateEnablement
():
void
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
RIGHT
);
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
THREE
);
}
}
run
(
context
:
{
extension
:
IExtension
}):
TPromise
<
any
>
{
run
(
context
:
{
extension
:
IExtension
}):
TPromise
<
any
>
{
...
...
src/vs/workbench/parts/files/browser/fileActions.ts
浏览文件 @
7352ad52
...
@@ -1175,7 +1175,7 @@ export class OpenToSideAction extends Action {
...
@@ -1175,7 +1175,7 @@ export class OpenToSideAction extends Action {
private
updateEnablement
():
void
{
private
updateEnablement
():
void
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
RIGHT
);
this
.
enabled
=
(
!
activeEditor
||
activeEditor
.
position
!==
Position
.
THREE
);
}
}
public
run
():
TPromise
<
any
>
{
public
run
():
TPromise
<
any
>
{
...
...
src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts
浏览文件 @
7352ad52
...
@@ -104,7 +104,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
...
@@ -104,7 +104,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
this
.
pendingDirtyResources
=
[];
this
.
pendingDirtyResources
=
[];
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
activePosition
=
activeEditor
?
activeEditor
.
position
:
Position
.
LEFT
;
const
activePosition
=
activeEditor
?
activeEditor
.
position
:
Position
.
ONE
;
// Open
// Open
this
.
editorService
.
openEditors
(
dirtyNotOpenedResources
.
map
(
resource
=>
{
this
.
editorService
.
openEditors
(
dirtyNotOpenedResources
.
map
(
resource
=>
{
...
...
src/vs/workbench/test/browser/services.test.ts
浏览文件 @
7352ad52
...
@@ -290,7 +290,7 @@ suite('Workbench UI Services', () => {
...
@@ -290,7 +290,7 @@ suite('Workbench UI Services', () => {
assert
(
service
.
getVisibleEditors
()[
0
]
===
editor
);
assert
(
service
.
getVisibleEditors
()[
0
]
===
editor
);
});
});
service
.
openEditor
(
activeInput
,
null
,
Position
.
LEFT
).
then
((
editor
)
=>
{
service
.
openEditor
(
activeInput
,
null
,
Position
.
ONE
).
then
((
editor
)
=>
{
assert
.
strictEqual
(
openedEditorInput
,
activeInput
);
assert
.
strictEqual
(
openedEditorInput
,
activeInput
);
assert
.
strictEqual
(
openedEditorOptions
,
null
);
assert
.
strictEqual
(
openedEditorOptions
,
null
);
assert
.
strictEqual
(
editor
,
activeEditor
);
assert
.
strictEqual
(
editor
,
activeEditor
);
...
...
src/vs/workbench/test/common/editor/editorStacksModel.test.ts
浏览文件 @
7352ad52
...
@@ -296,9 +296,9 @@ suite('Editor Stacks Model', () => {
...
@@ -296,9 +296,9 @@ suite('Editor Stacks Model', () => {
const
group2
=
model
.
openGroup
(
'
second
'
);
const
group2
=
model
.
openGroup
(
'
second
'
);
const
group3
=
model
.
openGroup
(
'
third
'
);
const
group3
=
model
.
openGroup
(
'
third
'
);
assert
.
equal
(
Position
.
LEFT
,
model
.
positionOfGroup
(
group1
));
assert
.
equal
(
Position
.
ONE
,
model
.
positionOfGroup
(
group1
));
assert
.
equal
(
Position
.
CENTER
,
model
.
positionOfGroup
(
group2
));
assert
.
equal
(
Position
.
TWO
,
model
.
positionOfGroup
(
group2
));
assert
.
equal
(
Position
.
RIGHT
,
model
.
positionOfGroup
(
group3
));
assert
.
equal
(
Position
.
THREE
,
model
.
positionOfGroup
(
group3
));
});
});
test
(
'
Groups - Rename Group
'
,
function
()
{
test
(
'
Groups - Rename Group
'
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录