Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6660ecc5
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,发现更多精彩内容 >>
提交
6660ecc5
编写于
4月 27, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - scaffold next editor control
上级
b215b5e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
14 deletion
+66
-14
src/vs/workbench/browser/parts/editor2/nextEditorControl.ts
src/vs/workbench/browser/parts/editor2/nextEditorControl.ts
+32
-0
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
...vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
+33
-14
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
+1
-0
未找到文件。
src/vs/workbench/browser/parts/editor2/nextEditorControl.ts
0 → 100644
浏览文件 @
6660ecc5
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
EditorInput
,
EditorOptions
,
IEditorGroup
}
from
'
vs/workbench/common/editor
'
;
import
{
INextEditor
}
from
'
vs/workbench/services/editor/common/nextEditorGroupsService
'
;
import
{
Dimension
}
from
'
vs/base/browser/dom
'
;
export
class
NextEditorControl
extends
Disposable
{
private
dimension
:
Dimension
;
constructor
(
private
parent
:
HTMLElement
,
private
group
:
IEditorGroup
)
{
super
();
}
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
):
INextEditor
{
return
Object
.
create
(
null
);
}
layout
(
dimension
:
Dimension
):
void
{
this
.
dimension
=
dimension
;
}
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
浏览文件 @
6660ecc5
...
...
@@ -22,6 +22,7 @@ import { Themable, EDITOR_GROUP_HEADER_TABS_BORDER, EDITOR_GROUP_HEADER_TABS_BAC
import
{
INextEditor
,
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
'
;
import
{
NextEditorControl
}
from
'
vs/workbench/browser/parts/editor2/nextEditorControl
'
;
export
class
NextEditorGroupView
extends
Themable
implements
IView
,
INextEditorGroup
{
...
...
@@ -36,6 +37,9 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
private
titleContainer
:
HTMLElement
;
private
titleAreaControl
:
INextTitleAreaControl
;
private
editorContainer
:
HTMLElement
;
private
editorControl
:
NextEditorControl
;
private
progressBar
:
ProgressBar
;
constructor
(
...
...
@@ -64,19 +68,16 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
// TODO@grid also, wouldn't it be better if the title widget would register as listener to changes to the group and just
// refresh itself instead of having to do this from the outside?
// See editorGroupsControl#handleStacksChanged() as example for how this is done currently
this
.
doCreateOrGetTitleArea
().
refresh
(
true
);
// TODO@grid introduce in a similar fashion editorControl?
this
.
doCreateOrGetTitleControl
().
refresh
(
true
);
return
Object
.
create
(
null
);
// Forward to editor control
return
this
.
doCreateOrGetEditorControl
().
openEditor
(
input
,
options
);
}
private
doCreateOrGetTitle
Area
():
INextTitleAreaControl
{
private
doCreateOrGetTitle
Control
():
INextTitleAreaControl
{
if
(
!
this
.
titleAreaControl
)
{
// Scoped instantiation service for a scoped context key service
const
containerInstantiationService
=
this
.
instantiationService
.
createChild
(
new
ServiceCollection
(
[
IContextKeyService
,
this
.
_register
(
this
.
contextKeyService
.
createScoped
(
this
.
container
))]
[
IContextKeyService
,
this
.
_register
(
this
.
contextKeyService
.
createScoped
(
this
.
container
))]
// Scoped instantiation service for a scoped context key service
));
this
.
titleAreaControl
=
this
.
_register
(
containerInstantiationService
.
createInstance
(
NextTabsTitleControl
,
this
.
titleContainer
,
this
.
group
));
...
...
@@ -86,6 +87,15 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
return
this
.
titleAreaControl
;
}
private
doCreateOrGetEditorControl
():
NextEditorControl
{
if
(
!
this
.
editorControl
)
{
this
.
editorControl
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
NextEditorControl
,
this
.
editorContainer
,
this
.
group
));
this
.
doLayoutEditorControl
();
}
return
this
.
editorControl
;
}
//#endregion
//#region Themable Implementation
...
...
@@ -108,7 +118,7 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
//#region IView implementation
readonly
minimumSize
=
20
0
;
readonly
minimumSize
=
15
0
;
readonly
maximumSize
=
Number
.
POSITIVE_INFINITY
;
get
onDidChange
()
{
return
Event
.
None
;
}
...
...
@@ -131,10 +141,10 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
this
.
progressBar
.
hide
();
// Editor container
const
editorContainer
=
document
.
createElement
(
'
div
'
);
addClass
(
editorContainer
,
'
editor-container
'
);
editorContainer
.
setAttribute
(
'
role
'
,
'
tabpanel
'
);
this
.
container
.
appendChild
(
editorContainer
);
this
.
editorContainer
=
document
.
createElement
(
'
div
'
);
addClass
(
this
.
editorContainer
,
'
editor-container
'
);
this
.
editorContainer
.
setAttribute
(
'
role
'
,
'
tabpanel
'
);
this
.
container
.
appendChild
(
this
.
editorContainer
);
// Update styles
this
.
updateStyles
();
...
...
@@ -143,15 +153,24 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
layout
(
size
:
number
):
void
{
this
.
dimension
=
new
Dimension
(
size
,
-
1
);
// TODO@grid need full dimension here
// Layout title if present
// Layout title
control
if present
if
(
this
.
titleAreaControl
)
{
this
.
doLayoutTitleControl
();
}
// Layout editor control if present
if
(
this
.
editorControl
)
{
this
.
doLayoutEditorControl
();
}
}
private
doLayoutTitleControl
():
void
{
this
.
titleAreaControl
.
layout
(
new
Dimension
(
this
.
dimension
.
width
,
NextEditorGroupView
.
EDITOR_TITLE_HEIGHT
));
}
private
doLayoutEditorControl
():
void
{
this
.
editorControl
.
layout
(
new
Dimension
(
this
.
dimension
.
width
,
150
/* TODO@grid need full dimension here */
-
NextEditorGroupView
.
EDITOR_TITLE_HEIGHT
));
}
//#endregion
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
浏览文件 @
6660ecc5
...
...
@@ -102,6 +102,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService {
// Widget
this
.
grid
=
this
.
_register
(
new
GridView
<
NextEditorGroupView
>
(
this
.
gridContainer
));
this
.
grid
.
layout
(
1
,
1
);
// TODO@grid should work without calling layout
// Initial View
this
.
_activeGroup
=
this
.
doCreateGroup
([
0
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录