Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b470a3d4
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,发现更多精彩内容 >>
提交
b470a3d4
编写于
12月 17, 2018
作者:
M
Matthias Reitinger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issues with keybindings list header behavior (#41558)
上级
f90f0a9e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
41 deletion
+30
-41
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+16
-38
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
...nch/parts/preferences/browser/media/keybindingsEditor.css
+14
-2
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
...nch/services/preferences/common/keybindingsEditorModel.ts
+0
-1
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
b470a3d4
...
...
@@ -18,7 +18,7 @@ import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import
{
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
KeybindingsEditorModel
,
IKeybindingItemEntry
,
IListEntry
,
KEYBINDING_ENTRY_TEMPLATE_ID
,
KEYBINDING_HEADER_TEMPLATE_ID
}
from
'
vs/workbench/services/preferences/common/keybindingsEditorModel
'
;
import
{
KeybindingsEditorModel
,
IKeybindingItemEntry
,
IListEntry
,
KEYBINDING_ENTRY_TEMPLATE_ID
}
from
'
vs/workbench/services/preferences/common/keybindingsEditorModel
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
,
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
DefineKeybindingWidget
,
KeybindingsSearchWidget
,
KeybindingsSearchOptions
}
from
'
vs/workbench/parts/preferences/browser/keybindingWidgets
'
;
...
...
@@ -61,6 +61,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private
overlayContainer
:
HTMLElement
;
private
defineKeybindingWidget
:
DefineKeybindingWidget
;
private
keybindingsListHeader
:
HTMLElement
;
private
keybindingsListContainer
:
HTMLElement
;
private
unAssignedKeybindingItemToRevealAndFocus
:
IKeybindingItemEntry
;
private
listEntries
:
IListEntry
[];
...
...
@@ -136,7 +137,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
overlayContainer
.
style
.
height
=
dimension
.
height
+
'
px
'
;
this
.
defineKeybindingWidget
.
layout
(
this
.
dimension
);
this
.
layoutKebindingsList
();
this
.
layoutKe
y
bindingsList
();
}
focus
():
void
{
...
...
@@ -397,7 +398,15 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private
createList
(
parent
:
HTMLElement
):
void
{
this
.
keybindingsListContainer
=
DOM
.
append
(
parent
,
$
(
'
.keybindings-list-container
'
));
this
.
keybindingsList
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
WorkbenchList
,
this
.
keybindingsListContainer
,
new
Delegate
(),
[
new
KeybindingHeaderRenderer
(),
new
KeybindingItemRenderer
(
this
,
this
.
keybindingsService
)],
this
.
keybindingsListHeader
=
DOM
.
append
(
this
.
keybindingsListContainer
,
$
(
'
.keybindings-list-header
'
));
DOM
.
append
(
this
.
keybindingsListHeader
,
$
(
'
.header.actions
'
),
$
(
'
.header.command
'
,
null
,
localize
(
'
command
'
,
"
Command
"
)),
$
(
'
.header.keybinding
'
,
null
,
localize
(
'
keybinding
'
,
"
Keybinding
"
)),
$
(
'
.header.source
'
,
null
,
localize
(
'
source
'
,
"
Source
"
)),
$
(
'
.header.when
'
,
null
,
localize
(
'
when
'
,
"
When
"
)));
this
.
keybindingsList
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
WorkbenchList
,
this
.
keybindingsListContainer
,
new
Delegate
(),
[
new
KeybindingItemRenderer
(
this
,
this
.
keybindingsService
)],
{
identityProvider
:
{
getId
:
e
=>
e
.
id
},
ariaLabel
:
localize
(
'
keybindingsLabel
'
,
"
Keybindings
"
),
setRowLineHeight
:
false
}))
as
WorkbenchList
<
IListEntry
>
;
this
.
_register
(
this
.
keybindingsList
.
onContextMenu
(
e
=>
this
.
onContextMenu
(
e
)));
this
.
_register
(
this
.
keybindingsList
.
onFocusChange
(
e
=>
this
.
onFocusChange
(
e
)));
...
...
@@ -465,9 +474,9 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
latestEmptyFilters
.
push
(
filter
);
}
const
currentSelectedIndex
=
this
.
keybindingsList
.
getSelection
()[
0
];
this
.
listEntries
=
[{
id
:
'
keybinding-header-entry
'
,
templateId
:
KEYBINDING_HEADER_TEMPLATE_ID
},
...
keybindingsEntries
]
;
this
.
listEntries
=
keybindingsEntries
;
this
.
keybindingsList
.
splice
(
0
,
this
.
keybindingsList
.
length
,
this
.
listEntries
);
this
.
layoutKebindingsList
();
this
.
layoutKe
y
bindingsList
();
if
(
reset
)
{
this
.
keybindingsList
.
setSelection
([]);
...
...
@@ -497,8 +506,8 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}
private
layoutKebindingsList
():
void
{
const
listHeight
=
this
.
dimension
.
height
-
(
DOM
.
getDomNodePagePosition
(
this
.
headerContainer
).
height
+
12
/*padding*/
);
private
layoutKe
y
bindingsList
():
void
{
const
listHeight
=
this
.
dimension
.
height
-
(
DOM
.
getDomNodePagePosition
(
this
.
headerContainer
).
height
+
12
/*padding*/
+
DOM
.
getDomNodePagePosition
(
this
.
keybindingsListHeader
).
height
);
this
.
keybindingsListContainer
.
style
.
height
=
`
${
listHeight
}
px`
;
this
.
keybindingsList
.
layout
(
listHeight
);
}
...
...
@@ -579,10 +588,6 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if
(
!
element
)
{
return
;
}
if
(
element
.
templateId
===
KEYBINDING_HEADER_TEMPLATE_ID
)
{
this
.
keybindingsList
.
focusNext
();
return
;
}
if
(
element
.
templateId
===
KEYBINDING_ENTRY_TEMPLATE_ID
)
{
this
.
keybindingFocusContextKey
.
set
(
true
);
}
...
...
@@ -691,9 +696,6 @@ class Delegate implements IListVirtualDelegate<IListEntry> {
return
40
;
}
}
if
(
element
.
templateId
===
KEYBINDING_HEADER_TEMPLATE_ID
)
{
return
30
;
}
return
24
;
}
...
...
@@ -711,30 +713,6 @@ interface KeybindingItemTemplate {
when
:
WhenColumn
;
}
class
KeybindingHeaderRenderer
implements
IListRenderer
<
IListEntry
,
any
>
{
get
templateId
():
string
{
return
KEYBINDING_HEADER_TEMPLATE_ID
;
}
constructor
()
{
}
renderTemplate
(
container
:
HTMLElement
):
any
{
DOM
.
addClass
(
container
,
'
keybindings-list-header
'
);
DOM
.
append
(
container
,
$
(
'
.header.actions
'
),
$
(
'
.header.command
'
,
null
,
localize
(
'
command
'
,
"
Command
"
)),
$
(
'
.header.keybinding
'
,
null
,
localize
(
'
keybinding
'
,
"
Keybinding
"
)),
$
(
'
.header.source
'
,
null
,
localize
(
'
source
'
,
"
Source
"
)),
$
(
'
.header.when
'
,
null
,
localize
(
'
when
'
,
"
When
"
)));
return
{};
}
renderElement
(
entry
:
IListEntry
,
index
:
number
,
template
:
any
):
void
{
}
disposeTemplate
(
template
:
any
):
void
{
}
}
class
KeybindingItemRenderer
implements
IListRenderer
<
IKeybindingItemEntry
,
KeybindingItemTemplate
>
{
get
templateId
():
string
{
return
KEYBINDING_ENTRY_TEMPLATE_ID
;
}
...
...
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
浏览文件 @
b470a3d4
...
...
@@ -99,23 +99,30 @@
border-collapse
:
separate
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
{
height
:
30px
;
line-height
:
30px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
{
cursor
:
default
;
display
:
flex
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row.odd
:not
(
.focused
)
:not
(
.selected
)
:not
(
:hover
),
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list
:not
(
:focus
)
.monaco-list-row.focused.odd
:not
(
.selected
)
:not
(
:hover
),
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list
:not
(
.focused
)
.monaco-list-row.focused.odd
:not
(
.selected
)
:not
(
:hover
)
{
background-color
:
rgba
(
130
,
130
,
130
,
0.04
);
}
.keybindings-editor
>
.keybindings-body
.keybindings-list-container
.monaco-list-row
>
.header
{
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.header
{
text-align
:
left
;
font-weight
:
bold
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.
monaco-list-row
.header
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.
keybindings-list-header
>
.header
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.column
{
align-items
:
center
;
display
:
flex
;
...
...
@@ -123,11 +130,13 @@
margin-right
:
6px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.actions
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.actions
{
width
:
24px
;
padding-right
:
2px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.command
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.command
{
flex
:
0.75
;
}
...
...
@@ -143,6 +152,7 @@
margin-top
:
2px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.keybinding
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.keybinding
{
flex
:
0.5
;
}
...
...
@@ -151,10 +161,12 @@
padding-left
:
10px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.source
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.source
{
flex
:
0
0
100px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.keybindings-list-header
>
.when
,
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.when
{
flex
:
1
;
}
...
...
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
浏览文件 @
b470a3d4
...
...
@@ -19,7 +19,6 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
export
const
KEYBINDING_ENTRY_TEMPLATE_ID
=
'
keybinding.entry.template
'
;
export
const
KEYBINDING_HEADER_TEMPLATE_ID
=
'
keybinding.header.template
'
;
const
SOURCE_DEFAULT
=
localize
(
'
default
'
,
"
Default
"
);
const
SOURCE_USER
=
localize
(
'
user
'
,
"
User
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录