Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
619c7e86
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,发现更多精彩内容 >>
提交
619c7e86
编写于
4月 30, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - first cut empty editor groups
上级
c569505a
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
114 addition
and
98 deletion
+114
-98
src/vs/workbench/browser/parts/editor2/media/nextEditorGroupView.css
...bench/browser/parts/editor2/media/nextEditorGroupView.css
+11
-0
src/vs/workbench/browser/parts/editor2/media/nextTitleControl.css
...orkbench/browser/parts/editor2/media/nextTitleControl.css
+1
-1
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
...vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
+70
-50
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
+3
-9
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
+1
-4
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+28
-34
未找到文件。
src/vs/workbench/browser/parts/editor2/media/nextEditorGroupView.css
浏览文件 @
619c7e86
...
...
@@ -7,6 +7,12 @@
height
:
100%
;
}
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container.empty.active
{
outline-width
:
1px
;
outline-style
:
solid
;
outline-offset
:
-2px
;
}
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.title
{
height
:
35px
;
display
:
flex
;
...
...
@@ -17,3 +23,8 @@
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container
>
.editor-container
{
height
:
calc
(
100%
-
35px
);
/* below title control */
}
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container.empty
>
.title
,
.monaco-workbench
>
.part.editor
>
.content
.editor-group-container.empty
>
.editor-container
{
display
:
none
;
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/media/nextTitleControl.css
浏览文件 @
619c7e86
...
...
@@ -54,7 +54,7 @@
display
:
none
;
}
/* Drag Cursor */
/* Drag Cursor
(TODO@grid this depends on the feature to drag an entire group to another location)
*/
.monaco-workbench
>
.part.editor
>
.content.multiple-groups
.editor-group-container
>
.title
,
.monaco-workbench
>
.part.editor
>
.content.multiple-groups
.editor-group-container
>
.title.tabs
.scrollbar
.slider
,
.monaco-workbench
>
.part.editor
>
.content.multiple-groups
.editor-group-container
>
.title
.monaco-icon-label
::before
,
...
...
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
浏览文件 @
619c7e86
...
...
@@ -10,14 +10,14 @@ import { EditorGroup } from 'vs/workbench/common/editor/editorStacksModel';
import
{
EditorInput
,
EditorOptions
,
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
addClass
,
addClasses
,
Dimension
,
trackFocus
,
toggleClass
}
from
'
vs/base/browser/dom
'
;
import
{
addClass
,
addClasses
,
Dimension
,
trackFocus
,
toggleClass
,
removeClass
}
from
'
vs/base/browser/dom
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ProgressBar
}
from
'
vs/base/browser/ui/progressbar/progressbar
'
;
import
{
attachProgressBarStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorBackground
,
contrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Themable
,
EDITOR_GROUP_HEADER_TABS_BORDER
,
EDITOR_GROUP_HEADER_TABS_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
editorBackground
,
contrastBorder
,
focusBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Themable
,
EDITOR_GROUP_HEADER_TABS_BORDER
,
EDITOR_GROUP_HEADER_TABS_BACKGROUND
,
EDITOR_GROUP_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
IOpenEditorResult
,
INextEditorGroup
}
from
'
vs/workbench/services/editor/common/nextEditorGroupsService
'
;
import
{
INextTitleAreaControl
}
from
'
vs/workbench/browser/parts/editor2/nextTitleControl
'
;
import
{
NextTabsTitleControl
}
from
'
vs/workbench/browser/parts/editor2/nextTabsTitleControl
'
;
...
...
@@ -26,14 +26,20 @@ import { IView } from 'vs/base/browser/ui/grid/gridview';
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ProgressService
}
from
'
vs/workbench/services/progress/browser/progressService
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
localize
}
from
'
vs/nls
'
;
export
class
NextEditorGroupView
extends
Themable
implements
IView
,
INextEditorGroup
{
private
static
readonly
EDITOR_TITLE_HEIGHT
=
35
;
private
_onDidFocus
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
get
onDidFocus
():
Event
<
void
>
{
return
this
.
_onDidFocus
.
event
;
}
private
_onWillDispose
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
get
onWillDispose
():
Event
<
void
>
{
return
this
.
_onWillDispose
.
event
;
}
private
_onDidActiveEditorChange
:
Emitter
<
BaseEditor
>
=
this
.
_register
(
new
Emitter
<
BaseEditor
>
());
get
onDidActiveEditorChange
():
Event
<
BaseEditor
>
{
return
this
.
_onDidActiveEditorChange
.
event
;
}
private
group
:
EditorGroup
;
private
dimension
:
Dimension
;
...
...
@@ -57,17 +63,62 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
this
.
group
=
this
.
_register
(
instantiationService
.
createInstance
(
EditorGroup
,
''
));
this
.
group
.
label
=
`Group <
${
this
.
group
.
id
}
>`
;
this
.
element
=
document
.
createElement
(
'
div
'
);
addClass
(
this
.
element
,
'
editor-group-container
'
);
this
.
doRender
();
this
.
doCreate
();
this
.
registerListeners
();
}
private
registerListeners
():
void
{
this
.
_register
(
this
.
group
.
onEditorsStructureChanged
(()
=>
this
.
updateContainer
()));
}
private
doCreate
():
void
{
// Container
addClasses
(
this
.
element
,
'
editor-group-container
'
);
const
focusTracker
=
this
.
_register
(
trackFocus
(
this
.
element
));
this
.
_register
(
focusTracker
.
onDidFocus
(()
=>
{
this
.
_onDidFocus
.
fire
();
}));
// Title container
this
.
titleContainer
=
document
.
createElement
(
'
div
'
);
addClasses
(
this
.
titleContainer
,
'
title
'
,
'
tabs
'
,
'
show-file-icons
'
);
this
.
element
.
appendChild
(
this
.
titleContainer
);
// Progress bar
this
.
progressBar
=
this
.
_register
(
new
ProgressBar
(
this
.
element
));
this
.
_register
(
attachProgressBarStyler
(
this
.
progressBar
,
this
.
themeService
));
this
.
progressBar
.
hide
();
// Editor container
this
.
editorContainer
=
document
.
createElement
(
'
div
'
);
addClass
(
this
.
editorContainer
,
'
editor-container
'
);
this
.
element
.
appendChild
(
this
.
editorContainer
);
// Update styles
this
.
updateStyles
();
// Update containers
this
.
updateContainer
();
}
get
onDidFocus
():
Event
<
void
>
{
return
this
.
_onDidFocus
.
event
;
private
updateContainer
():
void
{
const
empty
=
this
.
group
.
count
===
0
;
// Empty Container: allow to focus
if
(
empty
)
{
addClass
(
this
.
element
,
'
empty
'
);
this
.
element
.
tabIndex
=
0
;
this
.
element
.
setAttribute
(
'
aria-label
'
,
localize
(
'
emptyEditorGroup
'
,
"
Empty Editor Group
"
));
}
get
onWillDispose
():
Event
<
void
>
{
return
this
.
_onWillDispose
.
event
;
// Non-Empty Container: revert empty container attributes
else
{
removeClass
(
this
.
element
,
'
empty
'
);
this
.
element
.
removeAttribute
(
'
tabIndex
'
);
this
.
element
.
removeAttribute
(
'
aria-label
'
);
}
}
setActive
(
isActive
:
boolean
):
void
{
...
...
@@ -84,10 +135,6 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
//#region INextEditorGroup Implementation
get
onDidActiveEditorChange
():
Event
<
BaseEditor
>
{
return
this
.
_onDidActiveEditorChange
.
event
;
}
get
id
():
GroupIdentifier
{
return
this
.
group
.
id
;
}
...
...
@@ -175,7 +222,10 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
//#region Themable Implementation
protected
updateStyles
():
void
{
super
.
updateStyles
();
// Container
this
.
element
.
style
.
backgroundColor
=
this
.
getColor
(
EDITOR_GROUP_BACKGROUND
);
this
.
element
.
style
.
outlineColor
=
this
.
getColor
(
focusBorder
);
// Title control
const
borderColor
=
this
.
getColor
(
EDITOR_GROUP_HEADER_TABS_BORDER
)
||
this
.
getColor
(
contrastBorder
);
...
...
@@ -184,17 +234,15 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
this
.
titleContainer
.
style
.
borderBottomStyle
=
borderColor
?
'
solid
'
:
null
;
this
.
titleContainer
.
style
.
borderBottomColor
=
borderColor
;
// Editor background
this
.
element
.
style
.
backgroundColor
=
this
.
getColor
(
editorBackground
);
// TODO@grid use editor group background for empty groups?
// Editor container
this
.
editorContainer
.
style
.
backgroundColor
=
this
.
getColor
(
editorBackground
);
}
//#endregion
//#region IView implementation
readonly
element
:
HTMLElement
;
readonly
element
:
HTMLElement
=
document
.
createElement
(
'
div
'
)
;
readonly
minimumWidth
=
170
;
readonly
minimumHeight
=
70
;
...
...
@@ -203,34 +251,6 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
get
onDidChange
()
{
return
Event
.
None
;
}
private
doRender
():
void
{
// Title container
this
.
titleContainer
=
document
.
createElement
(
'
div
'
);
addClasses
(
this
.
titleContainer
,
'
title
'
,
'
tabs
'
,
'
show-file-icons
'
,
'
active
'
);
this
.
element
.
appendChild
(
this
.
titleContainer
);
// Progress bar
this
.
progressBar
=
this
.
_register
(
new
ProgressBar
(
this
.
element
));
this
.
_register
(
attachProgressBarStyler
(
this
.
progressBar
,
this
.
themeService
));
this
.
progressBar
.
hide
();
// Editor container
this
.
editorContainer
=
document
.
createElement
(
'
div
'
);
addClass
(
this
.
editorContainer
,
'
editor-container
'
);
this
.
editorContainer
.
setAttribute
(
'
role
'
,
'
tabpanel
'
);
this
.
element
.
appendChild
(
this
.
editorContainer
);
// Track focus in editor container
const
focusTracker
=
this
.
_register
(
trackFocus
(
this
.
editorContainer
));
this
.
_register
(
focusTracker
.
onDidFocus
(()
=>
{
this
.
_onDidFocus
.
fire
();
}));
// Update styles
this
.
updateStyles
();
}
layout
(
width
:
number
,
height
:
number
):
void
{
this
.
dimension
=
new
Dimension
(
width
,
height
);
...
...
@@ -251,6 +271,8 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
}
}
//#endregion
shutdown
():
void
{
if
(
this
.
editorControl
)
{
this
.
editorControl
.
shutdown
();
...
...
@@ -262,6 +284,4 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
super
.
dispose
();
}
//#endregion
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
浏览文件 @
619c7e86
...
...
@@ -25,7 +25,10 @@ export class NextEditorPart extends Part implements INextEditorGroupsService {
_serviceBrand
:
any
;
private
_onDidLayout
:
Emitter
<
Dimension
>
=
this
.
_register
(
new
Emitter
<
Dimension
>
());
get
onDidLayout
():
Event
<
Dimension
>
{
return
this
.
_onDidLayout
.
event
;
}
private
_onDidActiveGroupChange
:
Emitter
<
NextEditorGroupView
>
=
this
.
_register
(
new
Emitter
<
NextEditorGroupView
>
());
get
onDidActiveGroupChange
():
Event
<
NextEditorGroupView
>
{
return
this
.
_onDidActiveGroupChange
.
event
;
}
private
dimension
:
Dimension
;
...
...
@@ -47,10 +50,6 @@ export class NextEditorPart extends Part implements INextEditorGroupsService {
//#region INextEditorGroupsService Implementation
get
onDidActiveGroupChange
():
Event
<
NextEditorGroupView
>
{
return
this
.
_onDidActiveGroupChange
.
event
;
}
get
activeGroup
():
NextEditorGroupView
{
return
this
.
_activeGroup
;
}
...
...
@@ -163,12 +162,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService {
//#region Part Implementation
get
onDidLayout
():
Event
<
Dimension
>
{
return
this
.
_onDidLayout
.
event
;
}
protected
updateStyles
():
void
{
super
.
updateStyles
();
// Part container
const
container
=
this
.
getContainer
();
...
...
src/vs/workbench/browser/parts/editor2/nextTitleControl.ts
浏览文件 @
619c7e86
...
...
@@ -365,10 +365,7 @@ export abstract class NextTitleControl extends Themable implements INextTitleAre
//#region IThemeable implementation
protected
updateStyles
():
void
{
super
.
updateStyles
();
// run a sync update when the theme changes to new styles
this
.
doScheduleUpdate
(
true
);
this
.
doScheduleUpdate
(
true
);
// run a sync update when the theme changes to new styles
}
//#endregion
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
619c7e86
...
...
@@ -12,7 +12,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
dispose
,
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Position
,
Direction
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
...
...
@@ -44,23 +44,10 @@ export interface ISerializedEditorGroup {
preview
:
number
;
}
export
class
EditorGroup
implements
IEditorGroup
{
export
class
EditorGroup
extends
Disposable
implements
IEditorGroup
{
private
static
IDS
=
0
;
private
_id
:
GroupIdentifier
;
private
_label
:
string
;
private
editors
:
EditorInput
[];
private
mru
:
EditorInput
[];
private
mapResourceToEditorCount
:
ResourceMap
<
number
>
;
private
preview
:
EditorInput
;
// editor in preview state
private
active
:
EditorInput
;
// editor in active state
private
toDispose
:
IDisposable
[];
private
editorOpenPositioning
:
'
left
'
|
'
right
'
|
'
first
'
|
'
last
'
;
private
readonly
_onEditorActivated
:
Emitter
<
EditorInput
>
;
private
readonly
_onEditorOpened
:
Emitter
<
EditorInput
>
;
private
readonly
_onEditorClosed
:
Emitter
<
EditorCloseEvent
>
;
...
...
@@ -73,32 +60,43 @@ export class EditorGroup implements IEditorGroup {
private
readonly
_onEditorStateChanged
:
Emitter
<
EditorInput
>
;
private
readonly
_onEditorsStructureChanged
:
Emitter
<
EditorInput
>
;
private
_id
:
GroupIdentifier
;
private
_label
:
string
;
private
editors
:
EditorInput
[];
private
mru
:
EditorInput
[];
private
mapResourceToEditorCount
:
ResourceMap
<
number
>
;
private
preview
:
EditorInput
;
// editor in preview state
private
active
:
EditorInput
;
// editor in active state
private
editorOpenPositioning
:
'
left
'
|
'
right
'
|
'
first
'
|
'
last
'
;
constructor
(
arg1
:
string
|
ISerializedEditorGroup
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
();
this
.
_id
=
EditorGroup
.
IDS
++
;
this
.
editors
=
[];
this
.
mru
=
[];
this
.
toDispose
=
[];
this
.
mapResourceToEditorCount
=
new
ResourceMap
<
number
>
();
this
.
onConfigurationUpdated
();
this
.
_onEditorActivated
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorOpened
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorClosed
=
new
Emitter
<
EditorCloseEvent
>
();
this
.
_onEditorDisposed
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorDirty
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorLabelChange
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorMoved
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorPinned
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorUnpinned
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorStateChanged
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorsStructureChanged
=
new
Emitter
<
EditorInput
>
();
this
.
toDispose
.
push
(
this
.
_onEditorActivated
,
this
.
_onEditorOpened
,
this
.
_onEditorClosed
,
this
.
_onEditorDisposed
,
this
.
_onEditorDirty
,
this
.
_onEditorLabelChange
,
this
.
_onEditorMoved
,
this
.
_onEditorPinned
,
this
.
_onEditorUnpinned
,
this
.
_onEditorStateChanged
,
this
.
_onEditorsStructureChanged
);
this
.
_onEditorActivated
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorOpened
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorClosed
=
this
.
_register
(
new
Emitter
<
EditorCloseEvent
>
());
this
.
_onEditorDisposed
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorDirty
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorLabelChange
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorMoved
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorPinned
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorUnpinned
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorStateChanged
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
this
.
_onEditorsStructureChanged
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
if
(
typeof
arg1
===
'
object
'
)
{
this
.
deserialize
(
arg1
);
...
...
@@ -110,7 +108,7 @@ export class EditorGroup implements IEditorGroup {
}
private
registerListeners
():
void
{
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
)));
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
)));
}
private
onConfigurationUpdated
(
event
?:
IConfigurationChangeEvent
):
void
{
...
...
@@ -687,10 +685,6 @@ export class EditorGroup implements IEditorGroup {
this
.
active
=
this
.
mru
[
0
];
this
.
preview
=
this
.
editors
[
data
.
preview
];
}
public
dispose
():
void
{
dispose
(
this
.
toDispose
);
}
}
interface
ISerializedEditorStacksModel
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录