Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
68624f14
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,发现更多精彩内容 >>
提交
68624f14
编写于
5月 09, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - implement group arrangement
上级
2d4bf2d7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
74 addition
and
22 deletion
+74
-22
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+8
-2
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+12
-10
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+4
-8
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
+31
-2
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
...orkbench/services/group/common/nextEditorGroupsService.ts
+19
-0
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
68624f14
...
...
@@ -120,7 +120,7 @@ export class Grid<T extends IView> implements IDisposable {
this
.
gridview
=
new
GridView
(
container
);
this
.
disposables
.
push
(
this
.
gridview
);
this
.
gridview
.
onDidSashReset
(
this
.
onDidSashReset
,
this
,
this
.
disposables
);
this
.
gridview
.
onDidSashReset
(
this
.
doResetViewSize
,
this
,
this
.
disposables
);
this
.
_addView
(
view
,
0
,
[
0
]);
}
...
...
@@ -202,6 +202,12 @@ export class Grid<T extends IView> implements IDisposable {
return
getLocationOrientation
(
this
.
orientation
,
location
);
}
resetViewSize
(
view
:
T
):
void
{
const
location
=
this
.
getViewLocation
(
view
);
this
.
doResetViewSize
(
location
);
}
private
getViewLocation
(
view
:
T
):
number
[]
{
const
element
=
this
.
views
.
get
(
view
);
...
...
@@ -212,7 +218,7 @@ export class Grid<T extends IView> implements IDisposable {
return
getGridLocation
(
element
);
}
private
onDidSashReset
(
location
:
number
[]):
void
{
private
doResetViewSize
(
location
:
number
[]):
void
{
if
(
this
.
sashResetSizing
===
Sizing
.
Split
)
{
const
orientation
=
getLocationOrientation
(
this
.
orientation
,
location
);
const
firstViewSize
=
getSize
(
this
.
gridview
.
getViewSize
(
location
),
orientation
);
...
...
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
68624f14
...
...
@@ -18,12 +18,13 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import
{
Position
,
IEditor
,
Direction
,
IResourceInput
,
IEditorInput
,
POSITIONS
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IEditorGroupService
,
GroupArrangement
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
CLOSE_EDITOR_COMMAND_ID
,
NAVIGATE_IN_GROUP_ONE_PREFIX
,
NAVIGATE_ALL_EDITORS_GROUP_PREFIX
,
NAVIGATE_IN_GROUP_THREE_PREFIX
,
NAVIGATE_IN_GROUP_TWO_PREFIX
}
from
'
vs/workbench/browser/parts/editor/editorCommands
'
;
import
{
INextEditorGroupsService
,
GroupDirection
as
SplitDirection
,
INextEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorGroupsService
,
GroupDirection
as
SplitDirection
,
INextEditorGroup
,
GroupsArrangement
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
// TODo@grid this action should be removed in favour of the split vertical/horizontal actions
export
class
SplitEditorAction
extends
Action
{
...
...
@@ -874,12 +875,12 @@ export class MinimizeOtherGroupsAction extends Action {
public
static
readonly
ID
=
'
workbench.action.minimizeOtherEditors
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
minimizeOtherEditorGroups
'
,
"
Minimize Other Editor Groups
"
);
constructor
(
id
:
string
,
label
:
string
,
@
I
EditorGroupService
private
editorGroupService
:
IEditorGroup
Service
)
{
constructor
(
id
:
string
,
label
:
string
,
@
I
NextEditorGroupsService
private
editorGroupService
:
INextEditorGroups
Service
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
this
.
editorGroupService
.
arrangeGroups
(
GroupArrangement
.
MINIMIZE_OTHERS
);
this
.
editorGroupService
.
arrangeGroups
(
Group
s
Arrangement
.
MINIMIZE_OTHERS
);
return
TPromise
.
as
(
false
);
}
...
...
@@ -890,12 +891,12 @@ export class EvenGroupWidthsAction extends Action {
public
static
readonly
ID
=
'
workbench.action.evenEditorWidths
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
evenEditorGroups
'
,
"
Even Editor Group Widths
"
);
constructor
(
id
:
string
,
label
:
string
,
@
I
EditorGroupService
private
editorGroupService
:
IEditorGroup
Service
)
{
constructor
(
id
:
string
,
label
:
string
,
@
I
NextEditorGroupsService
private
editorGroupService
:
INextEditorGroups
Service
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
this
.
editorGroupService
.
arrangeGroups
(
GroupArrangement
.
EVEN
);
this
.
editorGroupService
.
arrangeGroups
(
Group
s
Arrangement
.
EVEN
);
return
TPromise
.
as
(
false
);
}
...
...
@@ -909,16 +910,17 @@ export class MaximizeGroupAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
EditorGroupService
private
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
I
NextEditorGroupsService
private
editorGroupService
:
INextEditorGroups
Service
,
@
IPartService
private
partService
:
IPartService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
if
(
this
.
editorService
.
getActiveEditor
())
{
this
.
editorGroupService
.
arrangeGroups
(
GroupArrangement
.
MINIMIZE_OTHERS
);
if
(
this
.
editorService
.
activeEditor
)
{
this
.
editorGroupService
.
arrangeGroups
(
GroupsArrangement
.
MINIMIZE_OTHERS
);
return
this
.
partService
.
setSideBarHidden
(
true
);
}
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
68624f14
...
...
@@ -304,14 +304,6 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
//#endregion
//#region TODO@grid group arrangement
public
arrangeGroups
(
arrangement
:
GroupArrangement
):
void
{
this
.
editorGroupsControl
.
arrangeGroups
(
arrangement
);
}
//#endregion
//#region TODO@grid group orientation
public
get
onGroupOrientationChanged
():
Event
<
void
>
{
...
...
@@ -1175,6 +1167,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return
editor
;
}
public
arrangeGroups
(
arrangement
:
GroupArrangement
):
void
{
this
.
editorGroupsControl
.
arrangeGroups
(
arrangement
);
}
private
doSetInput
(
group
:
EditorGroup
,
editor
:
BaseEditor
,
input
:
EditorInput
,
options
:
EditorOptions
,
monitor
:
ProgressMonitor
):
TPromise
<
BaseEditor
>
{
// Emit Input-Changed Event as appropiate
...
...
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
浏览文件 @
68624f14
...
...
@@ -11,14 +11,14 @@ import { Part } from 'vs/workbench/browser/part';
import
{
Dimension
,
isAncestor
,
toggleClass
,
addClass
,
clearNode
}
from
'
vs/base/browser/dom
'
;
import
{
Event
,
Emitter
,
once
}
from
'
vs/base/common/event
'
;
import
{
contrastBorder
,
editorBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
INextEditorGroupsService
,
GroupDirection
,
IAddGroupOptions
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorGroupsService
,
GroupDirection
,
IAddGroupOptions
,
GroupsArrangement
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Direction
,
SerializableGrid
,
Sizing
,
ISerializedGrid
,
Orientation
,
ISerializedNode
}
from
'
vs/base/browser/ui/grid/grid
'
;
import
{
GroupIdentifier
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
EDITOR_GROUP_BORDER
}
from
'
vs/workbench/common/theme
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
INextEditorGroupsAccessor
,
INextEditorGroupView
,
INextEditorPartOptions
,
getEditorPartOptions
,
impactsEditorPartOptions
,
INextEditorPartOptionsChangeEvent
}
from
'
vs/workbench/browser/parts/editor2/editor2
'
;
import
{
INextEditorGroupsAccessor
,
INextEditorGroupView
,
INextEditorPartOptions
,
getEditorPartOptions
,
impactsEditorPartOptions
,
INextEditorPartOptionsChangeEvent
,
EDITOR_MAX_DIMENSIONS
,
EDITOR_MIN_DIMENSIONS
}
from
'
vs/workbench/browser/parts/editor2/editor2
'
;
import
{
NextEditorGroupView
}
from
'
vs/workbench/browser/parts/editor2/nextEditorGroupView
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -205,6 +205,35 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
return
groupView
;
}
arrangeGroups
(
arrangement
:
GroupsArrangement
):
void
{
if
(
this
.
count
<
2
)
{
return
;
// require at least 2 groups to show
}
// Even all group sizes
if
(
arrangement
===
GroupsArrangement
.
EVEN
)
{
this
.
groups
.
forEach
(
group
=>
{
this
.
gridWidget
.
resetViewSize
(
group
);
});
}
// Maximize the current active group
else
{
this
.
groups
.
forEach
(
group
=>
{
const
orientation
=
this
.
gridWidget
.
getOrientation
(
group
);
let
newSize
:
number
;
if
(
this
.
activeGroup
===
group
)
{
newSize
=
orientation
===
Orientation
.
HORIZONTAL
?
EDITOR_MAX_DIMENSIONS
.
width
:
EDITOR_MAX_DIMENSIONS
.
height
;
}
else
{
newSize
=
orientation
===
Orientation
.
HORIZONTAL
?
EDITOR_MIN_DIMENSIONS
.
width
:
EDITOR_MIN_DIMENSIONS
.
height
;
}
this
.
gridWidget
.
resizeView
(
group
,
newSize
);
});
}
}
addGroup
(
location
:
INextEditorGroupView
|
GroupIdentifier
,
direction
:
GroupDirection
,
options
?:
IAddGroupOptions
):
INextEditorGroupView
{
const
locationView
=
this
.
assertGroupView
(
location
);
...
...
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
浏览文件 @
68624f14
...
...
@@ -19,6 +19,20 @@ export enum GroupDirection {
RIGHT
}
export
enum
GroupsArrangement
{
/**
* Make the current active group consume the maximum
* amount of space possible.
*/
MINIMIZE_OTHERS
,
/**
* Size all groups evenly.
*/
EVEN
}
export
interface
IMoveEditorOptions
{
index
?:
number
;
inactive
?:
boolean
;
...
...
@@ -98,6 +112,11 @@ export interface INextEditorGroupsService {
*/
resizeGroup
(
group
:
INextEditorGroup
|
GroupIdentifier
,
sizeDelta
:
number
):
INextEditorGroup
;
/**
* Arrange all groups according to the provided arrangement.
*/
arrangeGroups
(
arrangement
:
GroupsArrangement
):
void
;
/**
* Add a new group to the editor area. A new group is added by splitting a provided one in
* one of the four directions.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录