Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9cf35b4e
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,发现更多精彩内容 >>
提交
9cf35b4e
编写于
8月 26, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #79404
上级
5e13837b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
10 deletion
+20
-10
src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts
...orkbench/contrib/preferences/browser/keybindingsEditor.ts
+15
-5
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
...nch/services/preferences/common/keybindingsEditorModel.ts
+5
-5
未找到文件。
src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts
浏览文件 @
9cf35b4e
...
@@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co
...
@@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
InputBox
,
MessageType
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
InputBox
,
MessageType
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
MenuRegistry
,
MenuId
,
isIMenuItem
}
from
'
vs/platform/actions/common/actions
'
;
const
$
=
DOM
.
$
;
const
$
=
DOM
.
$
;
...
@@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
...
@@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if
(
this
.
input
)
{
if
(
this
.
input
)
{
const
input
:
KeybindingsEditorInput
=
this
.
input
as
KeybindingsEditorInput
;
const
input
:
KeybindingsEditorInput
=
this
.
input
as
KeybindingsEditorInput
;
this
.
keybindingsEditorModel
=
await
input
.
resolve
();
this
.
keybindingsEditorModel
=
await
input
.
resolve
();
const
editorActionsLabels
:
Map
<
string
,
string
>
=
EditorExtensionsRegistry
.
getEditorActions
().
reduce
((
editorActions
,
editorAction
)
=>
{
await
this
.
keybindingsEditorModel
.
resolve
(
this
.
getActionsLabels
());
editorActions
.
set
(
editorAction
.
id
,
editorAction
.
label
);
return
editorActions
;
},
new
Map
<
string
,
string
>
());
await
this
.
keybindingsEditorModel
.
resolve
(
editorActionsLabels
);
this
.
renderKeybindingsEntries
(
false
,
preserveFocus
);
this
.
renderKeybindingsEntries
(
false
,
preserveFocus
);
if
(
input
.
searchOptions
)
{
if
(
input
.
searchOptions
)
{
this
.
recordKeysAction
.
checked
=
input
.
searchOptions
.
recordKeybindings
;
this
.
recordKeysAction
.
checked
=
input
.
searchOptions
.
recordKeybindings
;
...
@@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
...
@@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}
}
}
private
getActionsLabels
():
Map
<
string
,
string
>
{
const
actionsLabels
:
Map
<
string
,
string
>
=
new
Map
<
string
,
string
>
();
EditorExtensionsRegistry
.
getEditorActions
().
forEach
(
editorAction
=>
actionsLabels
.
set
(
editorAction
.
id
,
editorAction
.
label
));
for
(
const
menuItem
of
MenuRegistry
.
getMenuItems
(
MenuId
.
CommandPalette
))
{
if
(
isIMenuItem
(
menuItem
))
{
const
title
=
typeof
menuItem
.
command
.
title
===
'
string
'
?
menuItem
.
command
.
title
:
menuItem
.
command
.
title
.
value
;
const
category
=
menuItem
.
command
.
category
?
typeof
menuItem
.
command
.
category
===
'
string
'
?
menuItem
.
command
.
category
:
menuItem
.
command
.
category
.
value
:
undefined
;
actionsLabels
.
set
(
menuItem
.
command
.
id
,
category
?
`
${
category
}
:
${
title
}
`
:
title
);
}
}
return
actionsLabels
;
}
private
filterKeybindings
():
void
{
private
filterKeybindings
():
void
{
this
.
renderKeybindingsEntries
(
this
.
searchWidget
.
hasFocus
());
this
.
renderKeybindingsEntries
(
this
.
searchWidget
.
hasFocus
());
this
.
delayedFilterLogging
.
trigger
(()
=>
this
.
reportFilteringUsed
(
this
.
searchWidget
.
getValue
()));
this
.
delayedFilterLogging
.
trigger
(()
=>
this
.
reportFilteringUsed
(
this
.
searchWidget
.
getValue
()));
...
...
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
浏览文件 @
9cf35b4e
...
@@ -160,14 +160,14 @@ export class KeybindingsEditorModel extends EditorModel {
...
@@ -160,14 +160,14 @@ export class KeybindingsEditorModel extends EditorModel {
return
result
;
return
result
;
}
}
resolve
(
editorActions
Labels
:
Map
<
string
,
string
>
):
Promise
<
EditorModel
>
{
resolve
(
action
Labels
:
Map
<
string
,
string
>
):
Promise
<
EditorModel
>
{
const
workbenchActionsRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
const
workbenchActionsRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
this
.
_keybindingItemsSortedByPrecedence
=
[];
this
.
_keybindingItemsSortedByPrecedence
=
[];
const
boundCommands
:
Map
<
string
,
boolean
>
=
new
Map
<
string
,
boolean
>
();
const
boundCommands
:
Map
<
string
,
boolean
>
=
new
Map
<
string
,
boolean
>
();
for
(
const
keybinding
of
this
.
keybindingsService
.
getKeybindings
())
{
for
(
const
keybinding
of
this
.
keybindingsService
.
getKeybindings
())
{
if
(
keybinding
.
command
)
{
// Skip keybindings without commands
if
(
keybinding
.
command
)
{
// Skip keybindings without commands
this
.
_keybindingItemsSortedByPrecedence
.
push
(
KeybindingsEditorModel
.
toKeybindingEntry
(
keybinding
.
command
,
keybinding
,
workbenchActionsRegistry
,
editorActions
Labels
));
this
.
_keybindingItemsSortedByPrecedence
.
push
(
KeybindingsEditorModel
.
toKeybindingEntry
(
keybinding
.
command
,
keybinding
,
workbenchActionsRegistry
,
action
Labels
));
boundCommands
.
set
(
keybinding
.
command
,
true
);
boundCommands
.
set
(
keybinding
.
command
,
true
);
}
}
}
}
...
@@ -175,7 +175,7 @@ export class KeybindingsEditorModel extends EditorModel {
...
@@ -175,7 +175,7 @@ export class KeybindingsEditorModel extends EditorModel {
const
commandsWithDefaultKeybindings
=
this
.
keybindingsService
.
getDefaultKeybindings
().
map
(
keybinding
=>
keybinding
.
command
);
const
commandsWithDefaultKeybindings
=
this
.
keybindingsService
.
getDefaultKeybindings
().
map
(
keybinding
=>
keybinding
.
command
);
for
(
const
command
of
KeybindingResolver
.
getAllUnboundCommands
(
boundCommands
))
{
for
(
const
command
of
KeybindingResolver
.
getAllUnboundCommands
(
boundCommands
))
{
const
keybindingItem
=
new
ResolvedKeybindingItem
(
undefined
,
command
,
null
,
undefined
,
commandsWithDefaultKeybindings
.
indexOf
(
command
)
===
-
1
);
const
keybindingItem
=
new
ResolvedKeybindingItem
(
undefined
,
command
,
null
,
undefined
,
commandsWithDefaultKeybindings
.
indexOf
(
command
)
===
-
1
);
this
.
_keybindingItemsSortedByPrecedence
.
push
(
KeybindingsEditorModel
.
toKeybindingEntry
(
command
,
keybindingItem
,
workbenchActionsRegistry
,
editorActions
Labels
));
this
.
_keybindingItemsSortedByPrecedence
.
push
(
KeybindingsEditorModel
.
toKeybindingEntry
(
command
,
keybindingItem
,
workbenchActionsRegistry
,
action
Labels
));
}
}
this
.
_keybindingItems
=
this
.
_keybindingItemsSortedByPrecedence
.
slice
(
0
).
sort
((
a
,
b
)
=>
KeybindingsEditorModel
.
compareKeybindingData
(
a
,
b
));
this
.
_keybindingItems
=
this
.
_keybindingItemsSortedByPrecedence
.
slice
(
0
).
sort
((
a
,
b
)
=>
KeybindingsEditorModel
.
compareKeybindingData
(
a
,
b
));
return
Promise
.
resolve
(
this
);
return
Promise
.
resolve
(
this
);
...
@@ -209,9 +209,9 @@ export class KeybindingsEditorModel extends EditorModel {
...
@@ -209,9 +209,9 @@ export class KeybindingsEditorModel extends EditorModel {
return
a
.
command
.
localeCompare
(
b
.
command
);
return
a
.
command
.
localeCompare
(
b
.
command
);
}
}
private
static
toKeybindingEntry
(
command
:
string
,
keybindingItem
:
ResolvedKeybindingItem
,
workbenchActionsRegistry
:
IWorkbenchActionRegistry
,
editorA
ctions
:
Map
<
string
,
string
>
):
IKeybindingItem
{
private
static
toKeybindingEntry
(
command
:
string
,
keybindingItem
:
ResolvedKeybindingItem
,
workbenchActionsRegistry
:
IWorkbenchActionRegistry
,
a
ctions
:
Map
<
string
,
string
>
):
IKeybindingItem
{
const
menuCommand
=
MenuRegistry
.
getCommand
(
command
)
!
;
const
menuCommand
=
MenuRegistry
.
getCommand
(
command
)
!
;
const
editorActionLabel
=
editorA
ctions
.
get
(
command
)
!
;
const
editorActionLabel
=
a
ctions
.
get
(
command
)
!
;
return
<
IKeybindingItem
>
{
return
<
IKeybindingItem
>
{
keybinding
:
keybindingItem
.
resolvedKeybinding
,
keybinding
:
keybindingItem
.
resolvedKeybinding
,
keybindingItem
,
keybindingItem
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录