Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e5e78f72
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,发现更多精彩内容 >>
提交
e5e78f72
编写于
5月 03, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - add proper split actions to title
上级
fd187e94
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
85 addition
and
34 deletion
+85
-34
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+60
-0
src/vs/workbench/browser/parts/editor2/media/nextTitleControl.css
...orkbench/browser/parts/editor2/media/nextTitleControl.css
+10
-10
src/vs/workbench/browser/parts/editor2/media/split-editor-horizontal-inverse.svg
...r/parts/editor2/media/split-editor-horizontal-inverse.svg
+1
-1
src/vs/workbench/browser/parts/editor2/media/split-editor-horizontal.svg
...h/browser/parts/editor2/media/split-editor-horizontal.svg
+1
-1
src/vs/workbench/browser/parts/editor2/media/split-editor-vertical-inverse.svg
...ser/parts/editor2/media/split-editor-vertical-inverse.svg
+1
-1
src/vs/workbench/browser/parts/editor2/media/split-editor-vertical.svg
...nch/browser/parts/editor2/media/split-editor-vertical.svg
+1
-1
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
+11
-20
未找到文件。
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
e5e78f72
...
...
@@ -23,7 +23,9 @@ 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
,
Direction
as
SplitDirection
,
INextEditorGroup
,
CopyKind
}
from
'
vs/workbench/services/editor/common/nextEditorGroupsService
'
;
// TODo@grid this action should be removed in favour of the split vertical/horizontal actions
export
class
SplitEditorAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.splitEditor
'
;
...
...
@@ -107,6 +109,64 @@ export class SplitEditorAction extends Action {
}
}
export
class
BaseSplitEditorGroupAction
extends
Action
{
constructor
(
id
:
string
,
label
:
string
,
clazz
:
string
,
private
direction
:
SplitDirection
,
private
nextEditorGroupsService
:
INextEditorGroupsService
)
{
super
(
id
,
label
,
clazz
);
}
public
run
(
context
?:
IEditorIdentifier
):
TPromise
<
any
>
{
let
group
:
INextEditorGroup
;
if
(
context
&&
context
.
group
)
{
group
=
this
.
nextEditorGroupsService
.
getGroup
(
context
.
group
.
id
);
}
if
(
!
group
)
{
group
=
this
.
nextEditorGroupsService
.
activeGroup
;
}
const
copyKind
=
group
.
activeEditor
instanceof
EditorInput
&&
group
.
activeEditor
.
supportsSplitEditor
()
?
CopyKind
.
EDITOR
:
void
0
;
this
.
nextEditorGroupsService
.
addGroup
(
group
,
this
.
direction
,
copyKind
);
return
TPromise
.
as
(
true
);
}
}
export
class
SplitEditorGroupVerticalAction
extends
BaseSplitEditorGroupAction
{
public
static
readonly
ID
=
'
workbench.action.splitEditorGroupVertical
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
splitEditorGroupVertical
'
,
"
Split Editor Group Vertically
"
);
constructor
(
id
:
string
,
label
:
string
,
@
INextEditorGroupsService
nextEditorGroupsService
:
INextEditorGroupsService
)
{
super
(
id
,
label
,
'
split-editor-vertical-action
'
,
SplitDirection
.
DOWN
,
nextEditorGroupsService
);
}
}
export
class
SplitEditorGroupHorizontalAction
extends
BaseSplitEditorGroupAction
{
public
static
readonly
ID
=
'
workbench.action.splitEditorGroupHorizontal
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
splitEditorGroupHorizontal
'
,
"
Split Editor Group Horizontally
"
);
constructor
(
id
:
string
,
label
:
string
,
@
INextEditorGroupsService
nextEditorGroupsService
:
INextEditorGroupsService
)
{
super
(
id
,
label
,
'
split-editor-horizontal-action
'
,
SplitDirection
.
RIGHT
,
nextEditorGroupsService
);
}
}
export
class
JoinTwoGroupsAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.joinTwoGroups
'
;
...
...
src/vs/workbench/browser/parts/editor2/media/nextTitleControl.css
浏览文件 @
e5e78f72
...
...
@@ -86,20 +86,20 @@
/** TODO@grid revisit the split editor action (vertical-layout/horizontal-layout does not exist anymore) */
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
right
-action
{
background
:
url('split-editor-
vertic
al.svg')
center
center
no-repeat
;
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
horizontal
-action
{
background
:
url('split-editor-
horizont
al.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
right
-action
,
.hc-black
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
right
-action
{
background
:
url('split-editor-
vertic
al-inverse.svg')
center
center
no-repeat
;
.vs-dark
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
horizontal
-action
,
.hc-black
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
horizontal
-action
{
background
:
url('split-editor-
horizont
al-inverse.svg')
center
center
no-repeat
;
}
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
down
-action
{
background
:
url('split-editor-
horizont
al.svg')
center
center
no-repeat
;
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
vertical
-action
{
background
:
url('split-editor-
vertic
al.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
down
-action
,
.hc-black
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
down
-action
{
background
:
url('split-editor-
horizont
al-inverse.svg')
center
center
no-repeat
;
.vs-dark
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
vertical
-action
,
.hc-black
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
.split-editor-
vertical
-action
{
background
:
url('split-editor-
vertic
al-inverse.svg')
center
center
no-repeat
;
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/media/split-editor-horizontal-inverse.svg
浏览文件 @
e5e78f72
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
><style>
.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}
</style><path
class=
"icon-canvas-transparent"
d=
"M16 16H0V0h16v16z"
id=
"canvas"
/><path
class=
"icon-vs-out"
d=
"M16 15H0V1h16v14z"
id=
"outline"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z"
id=
"iconBg"
/><g
id=
"iconFg"
style=
"display: none;"
><path
class=
"icon-vs-fg"
d=
"M14 8H2V5h12v3zm0 2H2v3h12v-3z"
/></g></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 -1 16 16"
enable-background=
"new 0 -1 16 16"
><path
fill=
"#C5C5C5"
d=
"M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/media/split-editor-horizontal.svg
浏览文件 @
e5e78f72
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
><style>
.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}
</style><path
class=
"icon-canvas-transparent"
d=
"M16 16H0V0h16v16z"
id=
"canvas"
/><path
class=
"icon-vs-out"
d=
"M16 15H0V1h16v14z"
id=
"outline"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z"
id=
"iconBg"
/><g
id=
"iconFg"
style=
"display: none;"
><path
class=
"icon-vs-fg"
d=
"M14 8H2V5h12v3zm0 2H2v3h12v-3z"
/></g></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 -1 16 16"
enable-background=
"new 0 -1 16 16"
><path
fill=
"#656565"
d=
"M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"
/></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/media/split-editor-vertical-inverse.svg
浏览文件 @
e5e78f72
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 -1 16 16"
enable-background=
"new 0 -1 16 16"
><path
fill=
"#C5C5C5"
d=
"M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"
/></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
><style>
.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}
</style><path
class=
"icon-canvas-transparent"
d=
"M16 16H0V0h16v16z"
id=
"canvas"
/><path
class=
"icon-vs-out"
d=
"M16 15H0V1h16v14z"
id=
"outline"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z"
id=
"iconBg"
/><g
id=
"iconFg"
style=
"display: none;"
><path
class=
"icon-vs-fg"
d=
"M14 8H2V5h12v3zm0 2H2v3h12v-3z"
/></g></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/media/split-editor-vertical.svg
浏览文件 @
e5e78f72
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 -1 16 16"
enable-background=
"new 0 -1 16 16"
><path
fill=
"#656565"
d=
"M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"
/></svg>
\ No newline at end of file
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
><style>
.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}
</style><path
class=
"icon-canvas-transparent"
d=
"M16 16H0V0h16v16z"
id=
"canvas"
/><path
class=
"icon-vs-out"
d=
"M16 15H0V1h16v14z"
id=
"outline"
style=
"display: none;"
/><path
class=
"icon-vs-bg"
d=
"M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z"
id=
"iconBg"
/><g
id=
"iconFg"
style=
"display: none;"
><path
class=
"icon-vs-fg"
d=
"M14 8H2V5h12v3zm0 2H2v3h12v-3z"
/></g></svg>
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
浏览文件 @
e5e78f72
...
...
@@ -24,7 +24,7 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
SplitEditorAction
,
CloseOneEditor
Action
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
CloseOneEditorAction
,
SplitEditorGroupVerticalAction
,
SplitEditorGroupHorizontal
Action
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
createActionItem
,
fillInActions
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
IMenuService
,
MenuId
,
IMenu
,
ExecuteCommandAction
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -35,7 +35,7 @@ import { isDiffEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Dimension
}
from
'
vs/base/browser/dom
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
INextEditorGroupsService
,
Direction
,
INextEditorGroup
}
from
'
vs/workbench/services/editor/common/nextEditorGroupsService
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
}
from
'
vs/workbench/services/editor/common/nextEditorGroupsService
'
;
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
export
interface
IToolbarActions
{
...
...
@@ -60,7 +60,6 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
protected
stacks
:
IEditorStacksModel
;
protected
closeOneEditorAction
:
CloseOneEditorAction
;
protected
splitEditorAction
:
SplitEditorAction
;
private
currentPrimaryEditorActionIds
:
string
[]
=
[];
private
currentSecondaryEditorActionIds
:
string
[]
=
[];
...
...
@@ -74,6 +73,9 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
private
resourceContext
:
ResourceContextKey
;
private
disposeOnEditorActions
:
IDisposable
[]
=
[];
private
splitEditorGroupVerticalAction
:
SplitEditorGroupVerticalAction
;
private
splitEditorGroupHorizontalAction
:
SplitEditorGroupHorizontalAction
;
private
contextMenu
:
IMenu
;
constructor
(
...
...
@@ -167,7 +169,8 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
protected
initActions
(
services
:
IInstantiationService
):
void
{
this
.
closeOneEditorAction
=
services
.
createInstance
(
CloseOneEditorAction
,
CloseOneEditorAction
.
ID
,
CloseOneEditorAction
.
LABEL
);
this
.
splitEditorAction
=
services
.
createInstance
(
SplitEditorAction
,
SplitEditorAction
.
ID
,
SplitEditorAction
.
LABEL
);
this
.
splitEditorGroupHorizontalAction
=
services
.
createInstance
(
SplitEditorGroupHorizontalAction
,
SplitEditorGroupHorizontalAction
.
ID
,
SplitEditorGroupHorizontalAction
.
LABEL
);
this
.
splitEditorGroupVerticalAction
=
services
.
createInstance
(
SplitEditorGroupVerticalAction
,
SplitEditorGroupVerticalAction
.
ID
,
SplitEditorGroupVerticalAction
.
LABEL
);
}
protected
createEditorActionsToolBar
(
container
:
HTMLElement
):
void
{
...
...
@@ -276,22 +279,9 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
// Primary actions only for the active group
if
(
isActive
)
{
primaryEditorActions
=
prepareActions
(
editorActions
.
primary
);
if
(
editor
instanceof
EditorInput
&&
editor
.
supportsSplitEditor
())
{
// TODO@grid temporary actions to play with
// primaryEditorActions.push(this.splitEditorAction);
primaryEditorActions
.
push
(
new
Action
(
'
split.right
'
,
'
Split Right
'
,
'
split-editor-right-action
'
,
true
,
()
=>
{
this
.
nextEditorGroupsService
.
addGroup
(
this
.
nextEditorGroupsService
.
activeGroup
,
Direction
.
RIGHT
,
{
copyEditor
:
true
});
return
TPromise
.
as
(
true
);
}));
primaryEditorActions
.
push
(
new
Action
(
'
split.down
'
,
'
Split Down
'
,
'
split-editor-down-action
'
,
true
,
()
=>
{
this
.
nextEditorGroupsService
.
addGroup
(
this
.
nextEditorGroupsService
.
activeGroup
,
Direction
.
DOWN
,
{
copyEditor
:
true
});
return
TPromise
.
as
(
true
);
}));
}
primaryEditorActions
.
push
(
this
.
splitEditorGroupHorizontalAction
);
primaryEditorActions
.
push
(
this
.
splitEditorGroupVerticalAction
);
}
secondaryEditorActions
=
prepareActions
(
editorActions
.
secondary
);
...
...
@@ -415,7 +405,8 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
// Actions
[
this
.
splitEditorAction
,
this
.
splitEditorGroupHorizontalAction
,
this
.
splitEditorGroupVerticalAction
,
this
.
closeOneEditorAction
].
forEach
((
action
)
=>
{
action
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录