Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bd5a257a
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,发现更多精彩内容 >>
提交
bd5a257a
编写于
3月 17, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#18095 Copy action to copy keybinding entry
上级
44bff9ac
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
10 deletion
+47
-10
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+27
-4
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
...nch/parts/preferences/browser/media/keybindingsEditor.css
+1
-4
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
...nch/parts/preferences/browser/preferences.contribution.ts
+16
-1
src/vs/workbench/parts/preferences/common/preferences.ts
src/vs/workbench/parts/preferences/common/preferences.ts
+3
-1
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
bd5a257a
...
...
@@ -11,16 +11,17 @@ import * as DOM from 'vs/base/browser/dom';
import
{
Builder
,
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
HighlightedLabel
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ActionBar
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorInput
}
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/parts/preferences/common/keybindingsEditorModel
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
,
KeybindingSource
}
from
'
vs/platform/keybinding/common/keybinding
'
;
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
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_COPY
}
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
'
;
...
...
@@ -89,6 +90,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
@
IListService
private
listService
:
IListService
,
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IChoiceService
private
choiceService
:
IChoiceService
,
@
IClipboardService
private
clipboardService
:
IClipboardService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
(
KeybindingsEditor
.
ID
,
telemetryService
,
themeService
);
...
...
@@ -190,6 +192,18 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
return
TPromise
.
as
(
null
);
}
copyKeybinding
(
keybinding
:
IKeybindingItemEntry
):
TPromise
<
any
>
{
const
userFriendlyKeybinding
:
IUserFriendlyKeybinding
=
{
command
:
keybinding
.
keybindingItem
.
command
,
key
:
keybinding
.
keybindingItem
.
keybinding
?
keybinding
.
keybindingItem
.
keybinding
.
getUserSettingsLabel
()
:
''
};
if
(
keybinding
.
keybindingItem
.
when
)
{
userFriendlyKeybinding
.
when
=
keybinding
.
keybindingItem
.
when
.
serialize
();
}
this
.
clipboardService
.
writeText
(
JSON
.
stringify
(
userFriendlyKeybinding
,
null
,
'
'
));
return
TPromise
.
as
(
null
);
}
search
(
filter
:
string
):
void
{
this
.
searchWidget
.
focus
();
}
...
...
@@ -290,7 +304,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if
(
e
.
element
.
templateId
===
KEYBINDING_ENTRY_TEMPLATE_ID
)
{
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
e
.
anchor
,
getActions
:
()
=>
TPromise
.
as
([
this
.
createRemoveAction
(
<
IKeybindingItemEntry
>
e
.
element
)]),
getActions
:
()
=>
TPromise
.
as
([
this
.
create
CopyAction
(
<
IKeybindingItemEntry
>
e
.
element
),
new
Separator
(),
this
.
create
RemoveAction
(
<
IKeybindingItemEntry
>
e
.
element
)]),
getKeyBinding
:
(
action
)
=>
this
.
keybindingsService
.
lookupKeybinding
(
action
.
id
)
});
}
...
...
@@ -319,6 +333,15 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
run
:
()
=>
this
.
removeKeybinding
(
keybindingItem
)
};
}
private
createCopyAction
(
keybindingItem
:
IKeybindingItemEntry
):
IAction
{
return
<
IAction
>
{
label
:
localize
(
'
copyLabel
'
,
"
Copy
"
),
enabled
:
true
,
id
:
KEYBINDINGS_EDITOR_COMMAND_COPY
,
run
:
()
=>
this
.
copyKeybinding
(
keybindingItem
)
};
}
}
class
Delegate
implements
IDelegate
<
IListEntry
>
{
...
...
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
浏览文件 @
bd5a257a
...
...
@@ -60,6 +60,7 @@
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
{
cursor
:
default
;
display
:
flex
;
}
...
...
@@ -68,10 +69,6 @@
background-color
:
rgba
(
130
,
130
,
130
,
0.04
);
}
.keybindings-editor
>
.keybindings-body
.keybindings-list-container
.monaco-list-row.keybindings-list-header
{
cursor
:
default
;
}
.keybindings-editor
>
.keybindings-body
.keybindings-list-container
.monaco-list-row.keybindings-list-header.focused
,
.keybindings-editor
>
.keybindings-body
.keybindings-list-container
.monaco-list-row.keybindings-list-header.selected
,
.keybindings-editor
>
.keybindings-body
.keybindings-list-container
.monaco-list-row.keybindings-list-header
:hover
{
...
...
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
浏览文件 @
bd5a257a
...
...
@@ -18,7 +18,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import
{
DefaultPreferencesEditorInput
,
PreferencesEditor
,
PreferencesEditorInput
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
KeybindingsEditor
,
KeybindingsEditorInput
}
from
'
vs/workbench/parts/preferences/browser/keybindingsEditor
'
;
import
{
OpenGlobalSettingsAction
,
OpenGlobalKeybindingsAction
,
OpenWorkspaceSettingsAction
,
ConfigureLanguageBasedSettingsAction
}
from
'
vs/workbench/parts/preferences/browser/preferencesActions
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
KEYBINDINGS_EDITOR_COMMAND_DEFINE
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_SEARCH
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
KEYBINDINGS_EDITOR_COMMAND_DEFINE
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_SEARCH
,
KEYBINDINGS_EDITOR_COMMAND_COPY
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
PreferencesService
}
from
'
vs/workbench/parts/preferences/browser/preferencesService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
...
...
@@ -212,4 +212,19 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
KEYBINDINGS_EDITOR_COMMAND_COPY
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ContextKeyExpr
.
and
(
CONTEXT_KEYBINDINGS_EDITOR
,
CONTEXT_KEYBINDING_FOCUS
),
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_C
,
handler
:
(
accessor
,
args
:
any
)
=>
{
const
editor
=
accessor
.
get
(
IWorkbenchEditorService
).
getActiveEditor
()
as
IKeybindingsEditor
;
editor
.
copyKeybinding
(
editor
.
activeKeybindingEntry
);
},
description
:
{
description
:
nls
.
localize
(
'
keybindings.editor.copy.description
'
,
"
Copy Keybindings
"
),
args
:
[]
}
});
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
PreferencesContentProvider
);
\ No newline at end of file
src/vs/workbench/parts/preferences/common/preferences.ts
浏览文件 @
bd5a257a
...
...
@@ -89,6 +89,7 @@ export interface IKeybindingsEditor extends IEditor {
search
(
filter
:
string
):
void
;
defineKeybinding
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
;
removeKeybinding
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
;
copyKeybinding
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
;
}
export
const
CONTEXT_SETTINGS_EDITOR
=
new
RawContextKey
<
boolean
>
(
'
inSettingsEditor
'
,
false
);
...
...
@@ -98,4 +99,5 @@ export const CONTEXT_KEYBINDING_FOCUS = new RawContextKey<boolean>('keybindingFo
export
const
SETTINGS_EDITOR_COMMAND_SEARCH
=
'
settings.action.search
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_SEARCH
=
'
keybindings.editor.searchKeybindings
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_DEFINE
=
'
keybindings.editor.defineKeybinding
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_REMOVE
=
'
keybindings.editor.removeKeybinding
'
;
\ No newline at end of file
export
const
KEYBINDINGS_EDITOR_COMMAND_REMOVE
=
'
keybindings.editor.removeKeybinding
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_COPY
=
'
keybindings.editor.copyKeybindingEntry
'
;
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录