Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
09e7f4e5
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,发现更多精彩内容 >>
提交
09e7f4e5
编写于
5月 08, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Preserve focus in status bar
fixes #97241
上级
9b18eade
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
6 deletion
+36
-6
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+5
-2
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
+26
-4
src/vs/workbench/services/statusbar/common/statusbar.ts
src/vs/workbench/services/statusbar/common/statusbar.ts
+5
-0
未找到文件。
src/vs/workbench/browser/layout.ts
浏览文件 @
09e7f4e5
...
...
@@ -178,6 +178,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private
notificationService
!
:
INotificationService
;
private
themeService
!
:
IThemeService
;
private
activityBarService
!
:
IActivityBarService
;
private
statusBarService
!
:
IStatusbarService
;
protected
readonly
state
=
{
fullscreen
:
false
,
...
...
@@ -262,7 +263,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this
.
titleService
=
accessor
.
get
(
ITitleService
);
this
.
notificationService
=
accessor
.
get
(
INotificationService
);
this
.
activityBarService
=
accessor
.
get
(
IActivityBarService
);
accessor
.
get
(
IStatusbarService
);
// not used, but called to ensure instantiated
this
.
statusBarService
=
accessor
.
get
(
IStatusbarService
);
// Listeners
this
.
registerLayoutListeners
();
...
...
@@ -850,8 +851,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
case
Parts
.
ACTIVITYBAR_PART
:
this
.
activityBarService
.
focusActivityBar
();
break
;
case
Parts
.
STATUSBAR_PART
:
this
.
statusBarService
.
focus
();
default
:
//
Status Bar, Activity Bar and
Title Bar simply pass focus to container
// Title Bar simply pass focus to container
const
container
=
this
.
getContainer
(
part
);
if
(
container
)
{
container
.
focus
();
...
...
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
浏览文件 @
09e7f4e5
...
...
@@ -69,6 +69,10 @@ class StatusbarViewModel extends Disposable {
get
entries
():
IStatusbarViewModelEntry
[]
{
return
this
.
_entries
;
}
private
hidden
!
:
Set
<
string
>
;
get
lastFocusedEntry
():
IStatusbarViewModelEntry
|
undefined
{
return
this
.
_lastFocusedEntry
&&
!
this
.
isHidden
(
this
.
_lastFocusedEntry
.
id
)
?
this
.
_lastFocusedEntry
:
undefined
;
}
private
_lastFocusedEntry
:
IStatusbarViewModelEntry
|
undefined
;
private
readonly
_onDidChangeEntryVisibility
=
this
.
_register
(
new
Emitter
<
{
id
:
string
,
visible
:
boolean
}
>
());
readonly
onDidChangeEntryVisibility
=
this
.
_onDidChangeEntryVisibility
.
event
;
...
...
@@ -219,6 +223,7 @@ class StatusbarViewModel extends Disposable {
if
(
focused
)
{
const
entry
=
getVisibleEntry
(
this
.
_entries
.
indexOf
(
focused
)
+
delta
);
if
(
entry
)
{
this
.
_lastFocusedEntry
=
entry
;
entry
.
labelContainer
.
focus
();
return
;
}
...
...
@@ -226,6 +231,7 @@ class StatusbarViewModel extends Disposable {
const
entry
=
getVisibleEntry
(
restartPosition
);
if
(
entry
)
{
this
.
_lastFocusedEntry
=
entry
;
entry
.
labelContainer
.
focus
();
}
}
...
...
@@ -493,6 +499,15 @@ export class StatusbarPart extends Part implements IStatusbarService {
this
.
viewModel
.
focusPreviousEntry
();
}
focus
(
preserveEntryFocus
=
true
):
void
{
this
.
getContainer
()?.
focus
();
const
lastFocusedEntry
=
this
.
viewModel
.
lastFocusedEntry
;
if
(
preserveEntryFocus
&&
lastFocusedEntry
)
{
// Need a timeout, for some reason without it the inner label container will not get focused
setTimeout
(()
=>
lastFocusedEntry
.
labelContainer
.
focus
(),
0
);
}
}
createContentArea
(
parent
:
HTMLElement
):
HTMLElement
{
this
.
element
=
parent
;
...
...
@@ -680,10 +695,6 @@ export class StatusbarPart extends Part implements IStatusbarService {
return
itemContainer
;
}
focus
():
void
{
this
.
getContainer
();
}
layout
(
width
:
number
,
height
:
number
):
void
{
super
.
layout
(
width
,
height
);
super
.
layoutContents
(
width
,
height
);
...
...
@@ -935,3 +946,14 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
statusBarService
.
focusNextEntry
();
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
workbench.statusBar.clearFocus
'
,
weight
:
KeybindingWeight
.
WorkbenchContrib
,
primary
:
KeyCode
.
Escape
,
when
:
CONTEXT_STATUS_BAR_FOCUSED
,
handler
:
(
accessor
:
ServicesAccessor
)
=>
{
const
statusBarService
=
accessor
.
get
(
IStatusbarService
);
statusBarService
.
focus
(
false
);
}
});
src/vs/workbench/services/statusbar/common/statusbar.ts
浏览文件 @
09e7f4e5
...
...
@@ -90,6 +90,11 @@ export interface IStatusbarService {
*/
updateEntryVisibility
(
id
:
string
,
visible
:
boolean
):
void
;
/**
* Focused the status bar. If one of the status bar entries was focused, focuses it directly.
*/
focus
(
preserveEntryFocus
?:
boolean
):
void
;
/**
* Focuses the next status bar entry. If none focused, focuses the first.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录