Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
18d7a48d
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,发现更多精彩内容 >>
提交
18d7a48d
编写于
3月 24, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add short cut for define keybinding to the action title
上级
7d0805e0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
6 deletion
+12
-6
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+12
-6
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
18d7a48d
...
...
@@ -21,7 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IKeybindingService
,
KeybindingSource
,
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
SearchWidget
}
from
'
vs/workbench/parts/preferences/browser/preferencesWidgets
'
;
import
{
DefineKeybindingWidget
}
from
'
vs/workbench/parts/preferences/browser/keybindingWidgets
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_COPY
,
KEYBINDINGS_EDITOR_COMMAND_RESET
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_COPY
,
KEYBINDINGS_EDITOR_COMMAND_RESET
,
KEYBINDINGS_EDITOR_COMMAND_DEFINE
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
renderHtml
}
from
'
vs/base/browser/htmlContentRenderer
'
;
import
{
IKeybindingEditingService
}
from
'
vs/workbench/services/keybinding/common/keybindingEditing
'
;
...
...
@@ -273,7 +273,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private
createList
(
parent
:
HTMLElement
):
void
{
this
.
keybindingsListContainer
=
DOM
.
append
(
parent
,
$
(
'
.keybindings-list-container
'
));
this
.
keybindingsList
=
this
.
_register
(
new
List
<
IListEntry
>
(
this
.
keybindingsListContainer
,
new
Delegate
(),
[
new
KeybindingHeaderRenderer
(),
new
KeybindingItemRenderer
(
this
)],
{
identityProvider
:
e
=>
e
.
id
}));
this
.
keybindingsList
=
this
.
_register
(
new
List
<
IListEntry
>
(
this
.
keybindingsListContainer
,
new
Delegate
(),
[
new
KeybindingHeaderRenderer
(),
new
KeybindingItemRenderer
(
this
,
this
.
keybindingsService
)],
{
identityProvider
:
e
=>
e
.
id
}));
this
.
_register
(
this
.
keybindingsList
.
onContextMenu
(
e
=>
this
.
onContextMenu
(
e
)));
this
.
_register
(
this
.
keybindingsList
.
onFocusChange
(
e
=>
this
.
onFocusChange
(
e
)));
this
.
_register
(
this
.
keybindingsList
.
onDOMFocus
(()
=>
this
.
keybindingsList
.
focusNext
()));
...
...
@@ -446,13 +446,13 @@ class KeybindingItemRenderer implements IRenderer<IKeybindingItemEntry, Keybindi
get
templateId
():
string
{
return
KEYBINDING_ENTRY_TEMPLATE_ID
;
}
constructor
(
private
keybindingsEditor
:
IKeybindingsEditor
)
{
}
constructor
(
private
keybindingsEditor
:
IKeybindingsEditor
,
private
keybindingsService
:
IKeybindingService
)
{
}
renderTemplate
(
container
:
HTMLElement
):
KeybindingItemTemplate
{
DOM
.
addClass
(
container
,
'
keybinding-item
'
);
return
{
parent
:
container
,
actions
:
new
ActionsColumn
(
container
,
this
.
keybindingsEditor
),
actions
:
new
ActionsColumn
(
container
,
this
.
keybindingsEditor
,
this
.
keybindingsService
),
command
:
new
CommandColumn
(
container
,
this
.
keybindingsEditor
),
keybinding
:
new
KeybindingColumn
(
container
,
this
.
keybindingsEditor
),
source
:
new
SourceColumn
(
container
,
this
.
keybindingsEditor
),
...
...
@@ -484,6 +484,10 @@ class ActionsColumn extends Column {
private
actionBar
:
ActionBar
;
constructor
(
parent
:
HTMLElement
,
keybindingsEditor
:
IKeybindingsEditor
,
private
keybindingsService
:
IKeybindingService
)
{
super
(
parent
,
keybindingsEditor
);
}
create
(
parent
:
HTMLElement
)
{
const
actionsContainer
=
DOM
.
append
(
parent
,
$
(
'
.column.actions
'
));
this
.
actionBar
=
new
ActionBar
(
actionsContainer
,
{
animated
:
false
});
...
...
@@ -501,21 +505,23 @@ class ActionsColumn extends Column {
}
private
createEditAction
(
keybindingItemEntry
:
IKeybindingItemEntry
):
IAction
{
const
keybinding
=
this
.
keybindingsService
.
lookupKeybinding
(
KEYBINDINGS_EDITOR_COMMAND_DEFINE
);
return
<
IAction
>
{
class
:
'
edit
'
,
enabled
:
true
,
id
:
'
editKeybinding
'
,
tooltip
:
localize
(
'
change
'
,
"
Change Keybinding
"
),
tooltip
:
keybinding
?
localize
(
'
editKeybindingLabelWithKey
'
,
"
Change Keybinding {0}
"
,
`(
${
keybinding
.
getLabel
()}
)`
)
:
localize
(
'
editKeybindingLabel
'
,
"
Change Keybinding
"
),
run
:
()
=>
this
.
keybindingsEditor
.
defineKeybinding
(
keybindingItemEntry
)
};
}
private
createAddAction
(
keybindingItemEntry
:
IKeybindingItemEntry
):
IAction
{
const
keybinding
=
this
.
keybindingsService
.
lookupKeybinding
(
KEYBINDINGS_EDITOR_COMMAND_DEFINE
);
return
<
IAction
>
{
class
:
'
add
'
,
enabled
:
true
,
id
:
'
addKeybinding
'
,
tooltip
:
localize
(
'
add
'
,
"
Add Keybinding
"
),
tooltip
:
keybinding
?
localize
(
'
addKeybindingLabelWithKey
'
,
"
Add Keybinding {0}
"
,
`(
${
keybinding
.
getLabel
()}
)`
)
:
localize
(
'
addKeybindingLabel
'
,
"
Add Keybinding
"
),
run
:
()
=>
this
.
keybindingsEditor
.
defineKeybinding
(
keybindingItemEntry
)
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录