Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
29509060
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,发现更多精彩内容 >>
提交
29509060
编写于
3月 27, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#18095 - Let match command's default locale label while searching in keybindings editor
上级
97373541
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
5 deletion
+31
-5
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+12
-2
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
...nch/parts/preferences/browser/media/keybindingsEditor.css
+7
-1
src/vs/workbench/parts/preferences/common/keybindingsEditorModel.ts
...kbench/parts/preferences/common/keybindingsEditorModel.ts
+12
-2
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
29509060
...
...
@@ -398,7 +398,12 @@ class Delegate implements IDelegate<IListEntry> {
getHeight
(
element
:
IListEntry
)
{
if
(
element
.
templateId
===
KEYBINDING_ENTRY_TEMPLATE_ID
)
{
if
((
<
IKeybindingItemEntry
>
element
).
keybindingItem
.
commandLabel
&&
(
<
IKeybindingItemEntry
>
element
).
commandIdMatches
)
{
const
commandIdMatched
=
(
<
IKeybindingItemEntry
>
element
).
keybindingItem
.
commandLabel
&&
(
<
IKeybindingItemEntry
>
element
).
commandIdMatches
;
const
commandDefaultLabelMatched
=
!!
(
<
IKeybindingItemEntry
>
element
).
commandDefaultLabelMatches
;
if
(
commandIdMatched
&&
commandDefaultLabelMatched
)
{
return
60
;
}
if
(
commandIdMatched
||
commandDefaultLabelMatched
)
{
return
40
;
}
}
...
...
@@ -542,12 +547,17 @@ class CommandColumn extends Column {
render
(
keybindingItemEntry
:
IKeybindingItemEntry
):
void
{
DOM
.
clearNode
(
this
.
commandColumn
);
const
keybindingItem
=
keybindingItemEntry
.
keybindingItem
;
DOM
.
toggleClass
(
this
.
commandColumn
,
'
command-id-label
'
,
!!
keybindingItem
.
commandLabel
&&
!!
keybindingItemEntry
.
commandIdMatches
);
const
commandIdMatched
=
!!
(
keybindingItem
.
commandLabel
&&
keybindingItemEntry
.
commandIdMatches
);
const
commandDefaultLabelMatched
=
!!
keybindingItemEntry
.
commandDefaultLabelMatches
;
DOM
.
toggleClass
(
this
.
commandColumn
,
'
vertical-align-column
'
,
commandIdMatched
||
commandDefaultLabelMatched
);
if
(
keybindingItem
.
commandLabel
)
{
const
commandLabel
=
new
HighlightedLabel
(
this
.
commandColumn
);
commandLabel
.
set
(
keybindingItem
.
commandLabel
,
keybindingItemEntry
.
commandLabelMatches
);
commandLabel
.
element
.
title
=
keybindingItem
.
command
;
}
if
(
keybindingItemEntry
.
commandDefaultLabelMatches
)
{
new
HighlightedLabel
(
DOM
.
append
(
this
.
commandColumn
,
$
(
'
.command-default-label
'
))).
set
(
keybindingItem
.
commandDefaultLabel
,
keybindingItemEntry
.
commandDefaultLabelMatches
);
}
if
(
keybindingItemEntry
.
commandIdMatches
||
!
keybindingItem
.
commandLabel
)
{
new
HighlightedLabel
(
DOM
.
append
(
this
.
commandColumn
,
$
(
'
.code
'
))).
set
(
keybindingItem
.
command
,
keybindingItemEntry
.
commandIdMatches
);
}
...
...
src/vs/workbench/parts/preferences/browser/media/keybindingsEditor.css
浏览文件 @
29509060
...
...
@@ -96,9 +96,15 @@
flex
:
1
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.command
-id-label
{
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.command
.vertical-align-column
{
flex-direction
:
column
;
align-items
:
flex-start
;
justify-content
:
center
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.command
.command-default-label
{
opacity
:
0.8
;
margin-top
:
2px
;
}
.keybindings-editor
>
.keybindings-body
>
.keybindings-list-container
.monaco-list-row
.keybinding
{
...
...
src/vs/workbench/parts/preferences/common/keybindingsEditorModel.ts
浏览文件 @
29509060
...
...
@@ -5,6 +5,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
language
,
LANGUAGE_DEFAULT
}
from
'
vs/base/common/platform
'
;
import
{
IMatch
,
IFilter
,
or
,
matchesContiguousSubString
,
matchesPrefix
,
matchesCamelCase
,
matchesWords
}
from
'
vs/base/common/filters
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
...
...
@@ -29,6 +30,7 @@ export interface IKeybindingItemEntry extends IListEntry {
keybindingItem
:
IKeybindingItem
;
commandIdMatches
?:
IMatch
[];
commandLabelMatches
?:
IMatch
[];
commandDefaultLabelMatches
?:
IMatch
[];
keybindingMatches
?:
IMatch
[];
}
...
...
@@ -36,6 +38,7 @@ export interface IKeybindingItem {
keybinding
:
ResolvedKeybinding
;
keybindingItem
:
ResolvedKeybindingItem
;
commandLabel
:
string
;
commandDefaultLabel
:
string
;
command
:
string
;
source
:
KeybindingSource
;
when
:
ContextKeyExpr
;
...
...
@@ -64,11 +67,12 @@ export class KeybindingsEditorModel extends EditorModel {
const
result
:
IKeybindingItemEntry
[]
=
[];
for
(
const
keybindingItem
of
this
.
_keybindingItems
)
{
let
keybindingMatches
=
new
KeybindingMatches
(
keybindingItem
,
searchValue
);
if
(
keybindingMatches
.
commandIdMatches
||
keybindingMatches
.
commandLabelMatches
||
keybindingMatches
.
keybindingMatches
)
{
if
(
keybindingMatches
.
commandIdMatches
||
keybindingMatches
.
commandLabelMatches
||
keybindingMatches
.
commandDefaultLabelMatches
||
keybindingMatches
.
keybindingMatches
)
{
result
.
push
({
id
:
KeybindingsEditorModel
.
getId
(
keybindingItem
),
templateId
:
KEYBINDING_ENTRY_TEMPLATE_ID
,
commandLabelMatches
:
keybindingMatches
.
commandLabelMatches
,
commandDefaultLabelMatches
:
keybindingMatches
.
commandDefaultLabelMatches
,
keybindingItem
,
keybindingMatches
:
keybindingMatches
.
keybindingMatches
,
commandIdMatches
:
keybindingMatches
.
commandIdMatches
...
...
@@ -134,12 +138,14 @@ export class KeybindingsEditorModel extends EditorModel {
private
static
toKeybindingEntry
(
keybinding
:
ResolvedKeybindingItem
,
workbenchActionsRegistry
:
IWorkbenchActionRegistry
,
editorActions
:
{}):
IKeybindingItem
{
const
workbenchAction
=
workbenchActionsRegistry
.
getWorkbenchAction
(
keybinding
.
command
);
const
commandDefaultLabel
=
workbenchAction
&&
language
!==
LANGUAGE_DEFAULT
?
workbenchActionsRegistry
.
getAlias
(
workbenchAction
.
id
)
:
null
;
const
editorAction
:
EditorAction
=
editorActions
[
keybinding
.
command
];
return
<
IKeybindingItem
>
{
keybinding
:
keybinding
.
resolvedKeybinding
,
keybindingItem
:
keybinding
,
command
:
keybinding
.
command
,
commandLabel
:
editorAction
?
editorAction
.
label
:
workbenchAction
?
workbenchAction
.
label
:
''
,
commandDefaultLabel
,
when
:
keybinding
.
when
,
source
:
keybinding
.
isDefault
?
KeybindingSource
.
Default
:
KeybindingSource
.
User
};
...
...
@@ -147,12 +153,14 @@ export class KeybindingsEditorModel extends EditorModel {
private
static
toUnassingedKeybindingEntry
(
command
:
string
,
workbenchActionsRegistry
:
IWorkbenchActionRegistry
,
editorActions
:
{}):
IKeybindingItem
{
const
workbenchAction
=
workbenchActionsRegistry
.
getWorkbenchAction
(
command
);
const
commandDefaultLabel
=
workbenchAction
&&
language
!==
LANGUAGE_DEFAULT
?
workbenchActionsRegistry
.
getAlias
(
workbenchAction
.
id
)
:
null
;
const
editorAction
:
EditorAction
=
editorActions
[
command
];
return
<
IKeybindingItem
>
{
keybinding
:
null
,
keybindingItem
:
new
ResolvedKeybindingItem
(
null
,
command
,
null
,
null
,
true
),
command
:
command
,
command
,
commandLabel
:
editorAction
?
editorAction
.
label
:
workbenchAction
?
workbenchAction
.
label
:
''
,
commandDefaultLabel
,
when
:
null
,
source
:
KeybindingSource
.
Default
};
...
...
@@ -162,11 +170,13 @@ export class KeybindingsEditorModel extends EditorModel {
class
KeybindingMatches
{
public
readonly
commandIdMatches
:
IMatch
[]
=
null
;
public
readonly
commandLabelMatches
:
IMatch
[]
=
null
;
public
readonly
commandDefaultLabelMatches
:
IMatch
[]
=
null
;
public
readonly
keybindingMatches
:
IMatch
[]
=
null
;
constructor
(
keybindingItem
:
IKeybindingItem
,
searchValue
:
string
)
{
this
.
commandIdMatches
=
this
.
matches
(
searchValue
,
keybindingItem
.
command
,
or
(
matchesWords
,
matchesCamelCase
));
this
.
commandLabelMatches
=
keybindingItem
.
commandLabel
?
this
.
matches
(
searchValue
,
keybindingItem
.
commandLabel
,
(
word
,
wordToMatchAgainst
)
=>
matchesWords
(
word
,
keybindingItem
.
commandLabel
,
true
))
:
null
;
this
.
commandDefaultLabelMatches
=
keybindingItem
.
commandDefaultLabel
?
this
.
matches
(
searchValue
,
keybindingItem
.
commandDefaultLabel
,
(
word
,
wordToMatchAgainst
)
=>
matchesWords
(
word
,
keybindingItem
.
commandDefaultLabel
,
true
))
:
null
;
this
.
keybindingMatches
=
keybindingItem
.
keybinding
?
this
.
keyMatches
(
searchValue
,
keybindingItem
.
keybinding
.
getAriaLabel
(),
or
(
matchesWords
,
matchesCamelCase
))
:
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录