Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c769f398
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,发现更多精彩内容 >>
提交
c769f398
编写于
10月 17, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
widthRatio => ratio
上级
c7c960ed
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
32 deletion
+32
-32
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+22
-22
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+10
-10
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
c769f398
...
...
@@ -54,7 +54,7 @@ class ProgressMonitor {
}
interface
IEditorPartUIState
{
widthR
atio
:
number
[];
r
atio
:
number
[];
}
interface
IEditorReplacement
extends
EditorIdentifier
{
...
...
@@ -178,14 +178,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
position
?:
Position
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg3
?:
any
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
{
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
position
?:
Position
,
ratio
?:
number
[]):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg3
?:
any
,
ratio
?:
number
[]):
TPromise
<
BaseEditor
>
{
// Normalize some values
if
(
!
options
)
{
options
=
null
;
}
// Determine position to open editor in (left, center, right)
const
position
=
this
.
findPosition
(
input
,
options
,
arg3
,
widthRatios
);
const
position
=
this
.
findPosition
(
input
,
options
,
arg3
,
ratio
);
// Some conditions under which we prevent the request
if
(
...
...
@@ -209,10 +209,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Open through UI
return
this
.
doOpenEditor
(
position
,
descriptor
,
input
,
options
,
widthRatios
);
return
this
.
doOpenEditor
(
position
,
descriptor
,
input
,
options
,
ratio
);
}
private
doOpenEditor
(
position
:
Position
,
descriptor
:
IEditorDescriptor
,
input
:
EditorInput
,
options
:
EditorOptions
,
widthRatios
:
number
[]):
TPromise
<
BaseEditor
>
{
private
doOpenEditor
(
position
:
Position
,
descriptor
:
IEditorDescriptor
,
input
:
EditorInput
,
options
:
EditorOptions
,
ratio
:
number
[]):
TPromise
<
BaseEditor
>
{
// Update stacks: We do this early on before the UI is there because we want our stacks model to have
// a consistent view of the editor world and updating it later async after the UI is there will cause
...
...
@@ -243,7 +243,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}));
// Show editor
return
this
.
doShowEditor
(
group
,
descriptor
,
input
,
options
,
widthRatios
,
monitor
).
then
(
editor
=>
{
return
this
.
doShowEditor
(
group
,
descriptor
,
input
,
options
,
ratio
,
monitor
).
then
(
editor
=>
{
if
(
!
editor
)
{
return
TPromise
.
as
<
BaseEditor
>
(
null
);
// canceled or other error
}
...
...
@@ -253,7 +253,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
});
}
private
doShowEditor
(
group
:
EditorGroup
,
descriptor
:
IEditorDescriptor
,
input
:
EditorInput
,
options
:
EditorOptions
,
widthRatios
:
number
[],
monitor
:
ProgressMonitor
):
TPromise
<
BaseEditor
>
{
private
doShowEditor
(
group
:
EditorGroup
,
descriptor
:
IEditorDescriptor
,
input
:
EditorInput
,
options
:
EditorOptions
,
ratio
:
number
[],
monitor
:
ProgressMonitor
):
TPromise
<
BaseEditor
>
{
const
position
=
this
.
stacks
.
positionOfGroup
(
group
);
const
editorAtPosition
=
this
.
visibleEditors
[
position
];
...
...
@@ -281,7 +281,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Show in side by side control
this
.
sideBySideControl
.
show
(
editor
,
position
,
options
&&
options
.
preserveFocus
,
widthRatios
);
this
.
sideBySideControl
.
show
(
editor
,
position
,
options
&&
options
.
preserveFocus
,
ratio
);
// Indicate to editor that it is now visible
editor
.
setVisible
(
true
,
position
);
...
...
@@ -886,9 +886,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
activePosition
=
this
.
stacks
.
positionOfGroup
(
this
.
stacks
.
activeGroup
);
}
const
widthRatios
=
this
.
sideBySideControl
.
getWidthRatios
();
const
ratio
=
this
.
sideBySideControl
.
getRatio
();
return
this
.
doOpenEditors
(
editors
,
activePosition
,
widthRatios
);
return
this
.
doOpenEditors
(
editors
,
activePosition
,
ratio
);
}
public
restoreEditors
():
TPromise
<
BaseEditor
[]
>
{
...
...
@@ -911,10 +911,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const
editorState
:
IEditorPartUIState
=
this
.
memento
[
EditorPart
.
EDITOR_PART_UI_STATE_STORAGE_KEY
];
return
this
.
doOpenEditors
(
editors
,
activePosition
,
editorState
&&
editorState
.
widthR
atio
);
return
this
.
doOpenEditors
(
editors
,
activePosition
,
editorState
&&
editorState
.
r
atio
);
}
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
widthRatios
?:
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
centerEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
CENTER
);
const
rightEditors
=
editors
.
filter
(
e
=>
e
.
position
===
Position
.
RIGHT
);
...
...
@@ -943,11 +943,11 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Validate width ratios
const
positions
=
rightEditors
.
length
?
3
:
centerEditors
.
length
?
2
:
1
;
if
(
!
widthRatios
||
widthRatios
.
length
!==
positions
)
{
if
(
!
ratio
||
ratio
.
length
!==
positions
)
{
if
(
!
this
.
getVisibleEditors
().
length
)
{
widthRatios
=
(
positions
===
3
)
?
[
0.33
,
0.33
,
0.34
]
:
(
positions
===
2
)
?
[
0.5
,
0.5
]
:
[
1
];
ratio
=
(
positions
===
3
)
?
[
0.33
,
0.33
,
0.34
]
:
(
positions
===
2
)
?
[
0.5
,
0.5
]
:
[
1
];
}
else
{
widthRatios
=
void
0
;
ratio
=
void
0
;
}
}
...
...
@@ -981,7 +981,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
options
=
EditorOptions
.
create
({
preserveFocus
});
}
promises
.
push
(
this
.
openEditor
(
input
,
options
,
position
,
widthRatios
));
promises
.
push
(
this
.
openEditor
(
input
,
options
,
position
,
ratio
));
});
return
TPromise
.
join
(
promises
).
then
(
editors
=>
{
...
...
@@ -1106,7 +1106,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
public
shutdown
():
void
{
// Persist UI State
const
editorState
:
IEditorPartUIState
=
{
widthRatio
:
this
.
sideBySideControl
.
getWidthRatios
()
};
const
editorState
:
IEditorPartUIState
=
{
ratio
:
this
.
sideBySideControl
.
getRatio
()
};
this
.
memento
[
EditorPart
.
EDITOR_PART_UI_STATE_STORAGE_KEY
]
=
editorState
;
// Unload all Instantiated Editors
...
...
@@ -1160,12 +1160,12 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
super
.
dispose
();
}
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
,
widthRatios
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
desiredPosition
?:
Position
,
widthRatios
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg1
?:
any
,
widthRatios
?:
number
[]):
Position
{
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
,
ratio
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
desiredPosition
?:
Position
,
ratio
?:
number
[]):
Position
;
private
findPosition
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg1
?:
any
,
ratio
?:
number
[]):
Position
{
// With defined width ratios, always trust the provided position
if
(
widthRatios
&&
types
.
isNumber
(
arg1
))
{
if
(
ratio
&&
types
.
isNumber
(
arg1
))
{
return
arg1
;
}
...
...
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
c769f398
...
...
@@ -54,7 +54,7 @@ export interface ISideBySideEditorControl {
onGroupFocusChanged
:
Event
<
void
>
;
show
(
editor
:
BaseEditor
,
position
:
Position
,
preserveActive
:
boolean
,
widthRatios
?:
number
[]):
void
;
show
(
editor
:
BaseEditor
,
position
:
Position
,
preserveActive
:
boolean
,
ratio
?:
number
[]):
void
;
hide
(
editor
:
BaseEditor
,
position
:
Position
,
layoutAndRochade
:
boolean
):
Rochade
;
setActive
(
editor
:
BaseEditor
):
void
;
...
...
@@ -77,7 +77,7 @@ export interface ISideBySideEditorControl {
arrangeGroups
(
arrangement
:
GroupArrangement
):
void
;
get
WidthRatios
():
number
[];
get
Ratio
():
number
[];
dispose
():
void
;
}
...
...
@@ -247,7 +247,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
return
this
.
_onGroupFocusChanged
.
event
;
}
public
show
(
editor
:
BaseEditor
,
position
:
Position
,
preserveActive
:
boolean
,
widthRatios
?:
number
[]):
void
{
public
show
(
editor
:
BaseEditor
,
position
:
Position
,
preserveActive
:
boolean
,
ratio
?:
number
[]):
void
{
const
visibleEditorCount
=
this
.
getVisibleEditorCount
();
// Store into editor bucket
...
...
@@ -266,25 +266,25 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
editor
.
getContainer
().
build
(
target
);
// Adjust layout according to provided ratios (used when restoring multiple editors at once)
if
(
widthRatios
&&
(
widthRatios
.
length
===
2
||
widthRatios
.
length
===
3
))
{
if
(
ratio
&&
(
ratio
.
length
===
2
||
ratio
.
length
===
3
))
{
const
hasLayoutInfo
=
this
.
dimension
&&
this
.
dimension
.
width
;
// We received width ratios but were not layouted yet. So we keep these ratios for when we layout()
if
(
!
hasLayoutInfo
)
{
this
.
siloInitialRatios
=
widthRatios
;
this
.
siloInitialRatios
=
ratio
;
}
// Adjust layout: -> [!][!]
if
(
widthRatios
.
length
===
2
)
{
if
(
ratio
.
length
===
2
)
{
if
(
hasLayoutInfo
)
{
this
.
siloWidths
[
position
]
=
this
.
dimension
.
width
*
widthRatios
[
position
];
this
.
siloWidths
[
position
]
=
this
.
dimension
.
width
*
ratio
[
position
];
}
}
// Adjust layout: -> [!][!][!]
else
if
(
widthRatios
.
length
===
3
)
{
else
if
(
ratio
.
length
===
3
)
{
if
(
hasLayoutInfo
)
{
this
.
siloWidths
[
position
]
=
this
.
dimension
.
width
*
widthRatios
[
position
];
this
.
siloWidths
[
position
]
=
this
.
dimension
.
width
*
ratio
[
position
];
}
if
(
this
.
rightSash
.
isHidden
())
{
...
...
@@ -715,7 +715,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
layoutControl
(
this
.
dimension
);
}
public
get
WidthRatios
():
number
[]
{
public
get
Ratio
():
number
[]
{
const
ratio
:
number
[]
=
[];
if
(
this
.
dimension
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录