Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a7ad8306
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,发现更多精彩内容 >>
提交
a7ad8306
编写于
1月 28, 2019
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding toggle editor
上级
a608c35e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
89 addition
and
21 deletion
+89
-21
src/vs/workbench/browser/actions/layoutActions.ts
src/vs/workbench/browser/actions/layoutActions.ts
+26
-0
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+55
-21
src/vs/workbench/services/part/common/partService.ts
src/vs/workbench/services/part/common/partService.ts
+6
-0
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+2
-0
未找到文件。
src/vs/workbench/browser/actions/layoutActions.ts
浏览文件 @
a7ad8306
...
...
@@ -210,6 +210,32 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
// --- Toggle Sidebar Visibility
export
class
ToggleEditorVisibilityAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.toggleEditorVisibility
'
;
static
readonly
LABEL
=
nls
.
localize
(
'
toggleEditor
'
,
"
Toggle Editor Area
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IPartService
private
readonly
partService
:
IPartService
)
{
super
(
id
,
label
);
this
.
enabled
=
!!
this
.
partService
;
}
run
():
Promise
<
any
>
{
const
hideEditor
=
this
.
partService
.
isVisible
(
Parts
.
EDITOR_PART
);
this
.
partService
.
setEditorHidden
(
hideEditor
);
return
Promise
.
resolve
(
null
);
}
}
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ToggleEditorVisibilityAction
,
ToggleEditorVisibilityAction
.
ID
,
ToggleEditorVisibilityAction
.
LABEL
),
'
View: Toggle Editor Area Visibility
'
,
viewCategory
);
export
class
ToggleSidebarVisibilityAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.toggleSidebarVisibility
'
;
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
a7ad8306
...
...
@@ -228,6 +228,7 @@ export class Workbench extends Disposable implements IPartService {
private
notificationsCenter
:
NotificationsCenter
;
private
notificationsToasts
:
NotificationsToasts
;
private
editorHidden
:
boolean
;
private
sideBarHidden
:
boolean
;
private
statusBarHidden
:
boolean
;
private
activityBarHidden
:
boolean
;
...
...
@@ -911,6 +912,9 @@ export class Workbench extends Disposable implements IPartService {
private
initSettings
():
void
{
// Editor visiblity
this
.
editorHidden
=
false
;
// Sidebar visibility
this
.
sideBarHidden
=
this
.
storageService
.
getBoolean
(
Workbench
.
sidebarHiddenStorageKey
,
StorageScope
.
WORKSPACE
,
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
);
...
...
@@ -1403,27 +1407,6 @@ export class Workbench extends Disposable implements IPartService {
let
statusBarInGrid
=
this
.
gridHasView
(
this
.
statusbarPartView
);
let
titlebarInGrid
=
this
.
gridHasView
(
this
.
titlebarPartView
);
// Hide parts
if
(
this
.
panelHidden
)
{
this
.
panelPartView
.
hide
();
}
if
(
this
.
statusBarHidden
)
{
this
.
statusbarPartView
.
hide
();
}
if
(
!
this
.
isVisible
(
Parts
.
TITLEBAR_PART
))
{
this
.
titlebarPartView
.
hide
();
}
if
(
this
.
activityBarHidden
)
{
this
.
activitybarPartView
.
hide
();
}
if
(
this
.
sideBarHidden
)
{
this
.
sidebarPartView
.
hide
();
}
// Add parts to grid
if
(
!
statusBarInGrid
)
{
this
.
workbenchGrid
.
addView
(
this
.
statusbarPartView
,
Sizing
.
Split
,
this
.
editorPartView
,
Direction
.
Down
);
...
...
@@ -1450,7 +1433,36 @@ export class Workbench extends Disposable implements IPartService {
panelInGrid
=
true
;
}
// Hide parts
if
(
this
.
panelHidden
)
{
this
.
panelPartView
.
hide
();
}
if
(
this
.
statusBarHidden
)
{
this
.
statusbarPartView
.
hide
();
}
if
(
!
this
.
isVisible
(
Parts
.
TITLEBAR_PART
))
{
this
.
titlebarPartView
.
hide
();
}
if
(
this
.
activityBarHidden
)
{
this
.
activitybarPartView
.
hide
();
}
if
(
this
.
sideBarHidden
)
{
this
.
sidebarPartView
.
hide
();
}
if
(
this
.
editorHidden
)
{
this
.
editorPartView
.
hide
();
}
// Show visible parts
if
(
!
this
.
editorHidden
)
{
this
.
editorPartView
.
show
();
}
if
(
!
this
.
statusBarHidden
)
{
this
.
statusbarPartView
.
show
();
}
...
...
@@ -1553,6 +1565,23 @@ export class Workbench extends Disposable implements IPartService {
}
}
setEditorHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
void
{
if
(
!
(
this
.
workbenchGrid
instanceof
Grid
))
{
return
;
}
this
.
editorHidden
=
hidden
;
// The editor and the panel cannot be hidden at the same time
if
(
this
.
editorHidden
&&
this
.
panelHidden
)
{
this
.
setPanelHidden
(
false
,
true
);
}
if
(
!
skipLayout
)
{
this
.
layout
();
}
}
setSideBarHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
void
{
this
.
sideBarHidden
=
hidden
;
this
.
sideBarVisibleContext
.
set
(
!
hidden
);
...
...
@@ -1639,6 +1668,11 @@ export class Workbench extends Disposable implements IPartService {
this
.
storageService
.
remove
(
Workbench
.
panelHiddenStorageKey
,
StorageScope
.
WORKSPACE
);
}
// The editor and panel cannot be hiddne at the same time
if
(
hidden
&&
this
.
editorHidden
)
{
this
.
setEditorHidden
(
false
,
true
);
}
// Layout
if
(
!
skipLayout
)
{
if
(
this
.
workbenchGrid
instanceof
Grid
)
{
...
...
src/vs/workbench/services/part/common/partService.ts
浏览文件 @
a7ad8306
...
...
@@ -86,6 +86,12 @@ export interface IPartService {
*/
getTitleBarOffset
():
number
;
/**
*
* Set editor area hidden or not
*/
setEditorHidden
(
hidden
:
boolean
):
void
;
/**
* Set sidebar hidden or not
*/
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
a7ad8306
...
...
@@ -492,6 +492,8 @@ export class TestPartService implements IPartService {
return
false
;
}
public
setEditorHidden
(
_hidden
:
boolean
):
Promise
<
void
>
{
return
Promise
.
resolve
(
null
);
}
public
setSideBarHidden
(
_hidden
:
boolean
):
Promise
<
void
>
{
return
Promise
.
resolve
(
null
);
}
public
isPanelHidden
():
boolean
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录