Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
eecfb293
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eecfb293
编写于
1月 10, 2017
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
workbench: setPanelHidden returns a promise
上级
de712b90
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
51 deletion
+47
-51
src/vs/workbench/api/node/mainThreadOutputService.ts
src/vs/workbench/api/node/mainThreadOutputService.ts
+1
-1
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+5
-5
src/vs/workbench/browser/panel.ts
src/vs/workbench/browser/panel.ts
+1
-2
src/vs/workbench/browser/parts/panel/panelPart.ts
src/vs/workbench/browser/parts/panel/panelPart.ts
+15
-21
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+21
-19
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+2
-1
src/vs/workbench/services/part/common/partService.ts
src/vs/workbench/services/part/common/partService.ts
+1
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/workbench/api/node/mainThreadOutputService.ts
浏览文件 @
eecfb293
...
...
@@ -53,7 +53,7 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape {
public
$close
(
channelId
:
string
):
TPromise
<
void
>
{
const
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
channelId
===
this
.
_outputService
.
getActiveChannel
().
id
)
{
this
.
_partService
.
setPanelHidden
(
true
);
return
this
.
_partService
.
setPanelHidden
(
true
);
}
return
undefined
;
...
...
src/vs/workbench/browser/layout.ts
浏览文件 @
eecfb293
...
...
@@ -185,6 +185,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
let
doLayout
=
false
;
let
isPanelVisible
=
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
);
let
newSashHeight
=
this
.
startPanelHeight
-
(
e
.
currentY
-
startY
);
let
promise
=
TPromise
.
as
(
null
);
// Panel visible
if
(
isPanelVisible
)
{
...
...
@@ -192,7 +193,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
// Automatically hide panel when a certain threshold is met
if
(
newSashHeight
+
HIDE_PANEL_HEIGHT_THRESHOLD
<
this
.
computedStyles
.
panel
.
minHeight
)
{
let
dragCompensation
=
DEFAULT_MIN_PANEL_PART_HEIGHT
-
HIDE_PANEL_HEIGHT_THRESHOLD
;
this
.
partService
.
setPanelHidden
(
true
);
promise
=
this
.
partService
.
setPanelHidden
(
true
);
startY
=
Math
.
min
(
this
.
sidebarHeight
-
this
.
statusbarHeight
-
this
.
titlebarHeight
,
e
.
currentY
+
dragCompensation
);
this
.
panelHeight
=
this
.
startPanelHeight
;
// when restoring panel, restore to the panel height we started from
}
...
...
@@ -209,12 +210,12 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
if
(
startY
-
e
.
currentY
>=
this
.
computedStyles
.
panel
.
minHeight
)
{
this
.
startPanelHeight
=
0
;
this
.
panelHeight
=
this
.
computedStyles
.
panel
.
minHeight
;
this
.
partService
.
setPanelHidden
(
false
);
promise
=
this
.
partService
.
setPanelHidden
(
false
);
}
}
if
(
doLayout
)
{
this
.
layout
(
);
promise
.
done
(()
=>
this
.
layout
(),
errors
.
onUnexpectedError
);
}
});
...
...
@@ -229,8 +230,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
this
.
sashY
.
addListener2
(
'
reset
'
,
()
=>
{
this
.
panelHeight
=
this
.
sidebarHeight
*
DEFAULT_PANEL_HEIGHT_COEFFICIENT
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashYHeightSettingsKey
,
this
.
panelHeight
,
StorageScope
.
GLOBAL
);
this
.
partService
.
setPanelHidden
(
false
);
this
.
layout
();
this
.
partService
.
setPanelHidden
(
false
).
done
(()
=>
this
.
layout
(),
errors
.
onUnexpectedError
);
});
this
.
sashX
.
addListener2
(
'
reset
'
,
()
=>
{
...
...
src/vs/workbench/browser/panel.ts
浏览文件 @
eecfb293
...
...
@@ -84,8 +84,7 @@ export abstract class TogglePanelAction extends Action {
public
run
():
TPromise
<
any
>
{
if
(
this
.
isPanelShowing
())
{
this
.
partService
.
setPanelHidden
(
true
);
return
TPromise
.
as
(
true
);
return
this
.
partService
.
setPanelHidden
(
true
);
}
return
this
.
panelService
.
openPanel
(
this
.
panelId
,
true
);
...
...
src/vs/workbench/browser/parts/panel/panelPart.ts
浏览文件 @
eecfb293
...
...
@@ -80,16 +80,17 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
// First check if panel is hidden and show if so
let
promise
=
TPromise
.
as
(
null
);
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
try
{
this
.
blockOpeningPanel
=
true
;
this
.
partService
.
setPanelHidden
(
false
);
promise
=
this
.
partService
.
setPanelHidden
(
false
);
}
finally
{
this
.
blockOpeningPanel
=
false
;
}
}
return
this
.
openComposite
(
id
,
focus
);
return
promise
.
then
(()
=>
this
.
openComposite
(
id
,
focus
)
);
}
protected
getActions
():
IAction
[]
{
...
...
@@ -122,9 +123,8 @@ class ClosePanelAction extends Action {
super
(
id
,
name
,
'
hide-panel-action
'
);
}
public
run
():
TPromise
<
boolean
>
{
this
.
partService
.
setPanelHidden
(
true
);
return
TPromise
.
as
(
true
);
public
run
():
TPromise
<
any
>
{
return
this
.
partService
.
setPanelHidden
(
true
);
}
}
...
...
@@ -140,9 +140,8 @@ export class TogglePanelAction extends ActivityAction {
super
(
id
,
name
,
partService
.
isVisible
(
Parts
.
PANEL_PART
)
?
'
panel expanded
'
:
'
panel
'
);
}
public
run
():
TPromise
<
boolean
>
{
this
.
partService
.
setPanelHidden
(
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
));
return
TPromise
.
as
(
true
);
public
run
():
TPromise
<
any
>
{
return
this
.
partService
.
setPanelHidden
(
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
));
}
}
...
...
@@ -160,21 +159,18 @@ class FocusPanelAction extends Action {
super
(
id
,
label
);
}
public
run
():
TPromise
<
boolean
>
{
public
run
():
TPromise
<
any
>
{
// Show panel
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
this
.
partService
.
setPanelHidden
(
false
);
return
this
.
partService
.
setPanelHidden
(
false
);
}
// Focus into active panel
else
{
let
panel
=
this
.
panelService
.
getActivePanel
();
if
(
panel
)
{
panel
.
focus
();
}
let
panel
=
this
.
panelService
.
getActivePanel
();
if
(
panel
)
{
panel
.
focus
();
}
return
TPromise
.
as
(
true
);
}
}
...
...
@@ -192,12 +188,10 @@ class ToggleMaximizedPanelAction extends Action {
super
(
id
,
label
);
}
public
run
():
TPromise
<
boolean
>
{
public
run
():
TPromise
<
any
>
{
// Show panel
this
.
partService
.
setPanelHidden
(
false
);
this
.
partService
.
toggleMaximizedPanel
();
return
TPromise
.
as
(
true
);
return
this
.
partService
.
setPanelHidden
(
false
)
.
then
(()
=>
this
.
partService
.
toggleMaximizedPanel
());
}
}
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
eecfb293
...
...
@@ -690,7 +690,6 @@ export class Workbench implements IPartService {
// If sidebar becomes hidden, also hide the current active Viewlet if any
if
(
hidden
&&
this
.
sidebarPart
.
getActiveViewlet
())
{
promise
=
this
.
sidebarPart
.
hideActiveViewlet
().
then
(()
=>
{
const
activeEditor
=
this
.
editorPart
.
getActiveEditor
();
const
activePanel
=
this
.
panelPart
.
getActivePanel
();
...
...
@@ -722,7 +721,7 @@ export class Workbench implements IPartService {
});
}
public
setPanelHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
void
{
public
setPanelHidden
(
hidden
:
boolean
,
skipLayout
?:
boolean
):
TPromise
<
void
>
{
this
.
panelHidden
=
hidden
;
// Adjust CSS
...
...
@@ -732,20 +731,16 @@ export class Workbench implements IPartService {
this
.
workbench
.
removeClass
(
'
nopanel
'
);
}
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
({
forceStyleRecompute
:
true
});
}
let
promise
=
TPromise
.
as
(
null
);
// If panel part becomes hidden, also hide the current active panel if any
if
(
hidden
&&
this
.
panelPart
.
getActivePanel
())
{
this
.
panelPart
.
hideActivePanel
();
// Pass Focus to Editor if Panel part is now hidden
const
editor
=
this
.
editorPart
.
getActiveEditor
();
if
(
editor
)
{
editor
.
focus
();
}
promise
=
this
.
panelPart
.
hideActivePanel
().
then
(()
=>
{
// Pass Focus to Editor if Panel part is now hidden
const
editor
=
this
.
editorPart
.
getActiveEditor
();
if
(
editor
)
{
editor
.
focus
();
}
}
);
}
// If panel part becomes visible, show last active panel or default panel
...
...
@@ -753,12 +748,19 @@ export class Workbench implements IPartService {
const
registry
=
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
);
const
panelToOpen
=
this
.
panelPart
.
getLastActivePanelId
()
||
registry
.
getDefaultPanelId
();
if
(
panelToOpen
)
{
this
.
panelPart
.
openPanel
(
panelToOpen
,
true
).
done
(
null
,
errors
.
onUnexpectedError
);
promise
=
this
.
panelPart
.
openPanel
(
panelToOpen
,
true
);
}
}
// Remember in settings
this
.
storageService
.
store
(
Workbench
.
panelHiddenSettingKey
,
hidden
?
'
true
'
:
'
false
'
,
StorageScope
.
WORKSPACE
);
return
promise
.
then
(()
=>
{
// Remember in settings
this
.
storageService
.
store
(
Workbench
.
panelHiddenSettingKey
,
hidden
?
'
true
'
:
'
false
'
,
StorageScope
.
WORKSPACE
);
// Layout
if
(
!
skipLayout
)
{
this
.
workbenchLayout
.
layout
({
forceStyleRecompute
:
true
});
}
});
}
public
toggleMaximizedPanel
():
void
{
...
...
@@ -1076,7 +1078,7 @@ export class Workbench implements IPartService {
this
.
zenMode
.
transitionedToFullScreen
=
toggleFullScreen
;
this
.
zenMode
.
wasSideBarVisible
=
this
.
isVisible
(
Parts
.
SIDEBAR_PART
);
this
.
zenMode
.
wasPanelVisible
=
this
.
isVisible
(
Parts
.
PANEL_PART
);
this
.
setPanelHidden
(
true
,
true
);
this
.
setPanelHidden
(
true
,
true
)
.
done
(
undefined
,
errors
.
onUnexpectedError
)
;
this
.
setSideBarHidden
(
true
,
true
).
done
(
undefined
,
errors
.
onUnexpectedError
);
this
.
setActivityBarHidden
(
true
,
true
);
...
...
@@ -1088,7 +1090,7 @@ export class Workbench implements IPartService {
}
}
else
{
if
(
this
.
zenMode
.
wasPanelVisible
)
{
this
.
setPanelHidden
(
false
,
true
);
this
.
setPanelHidden
(
false
,
true
)
.
done
(
undefined
,
errors
.
onUnexpectedError
)
;
}
if
(
this
.
zenMode
.
wasSideBarVisible
)
{
this
.
setSideBarHidden
(
false
,
true
).
done
(
undefined
,
errors
.
onUnexpectedError
);
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
eecfb293
...
...
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -189,7 +190,7 @@ export class TerminalService implements ITerminalService {
public
hidePanel
():
void
{
const
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
panel
&&
panel
.
getId
()
===
TERMINAL_PANEL_ID
)
{
this
.
_partService
.
setPanelHidden
(
true
);
this
.
_partService
.
setPanelHidden
(
true
)
.
done
(
undefined
,
errors
.
onUnexpectedError
)
;
}
}
...
...
src/vs/workbench/services/part/common/partService.ts
浏览文件 @
eecfb293
...
...
@@ -85,7 +85,7 @@ export interface IPartService {
/**
* Set panel part hidden or not
*/
setPanelHidden
(
hidden
:
boolean
):
void
;
setPanelHidden
(
hidden
:
boolean
):
TPromise
<
void
>
;
/**
* Maximizes the panel height if the panel is not already maximized.
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
eecfb293
...
...
@@ -278,7 +278,7 @@ export class TestPartService implements IPartService {
return
false
;
}
public
setPanelHidden
(
hidden
:
boolean
):
void
{
}
public
setPanelHidden
(
hidden
:
boolean
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
}
public
toggleMaximizedPanel
():
void
{
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录