Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8b6b3762
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,发现更多精彩内容 >>
提交
8b6b3762
编写于
5月 23, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#24396 Fix matching complete keybinding
上级
d29d5155
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
15 deletion
+17
-15
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
...nch/services/preferences/common/keybindingsEditorModel.ts
+17
-15
未找到文件。
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
浏览文件 @
8b6b3762
...
...
@@ -261,13 +261,15 @@ class KeybindingItemMatches {
public
readonly
whenMatches
:
IMatch
[]
=
null
;
public
readonly
keybindingMatches
:
KeybindingMatches
=
null
;
constructor
(
private
modifierLabels
:
ModifierLabels
,
keybindingItem
:
IKeybindingItem
,
searchValue
:
string
,
words
:
string
[],
keybindingWords
:
string
[],
private
completeMatch
:
boolean
)
{
constructor
(
private
modifierLabels
:
ModifierLabels
,
keybindingItem
:
IKeybindingItem
,
searchValue
:
string
,
words
:
string
[],
keybindingWords
:
string
[],
completeMatch
:
boolean
)
{
if
(
!
completeMatch
)
{
this
.
commandIdMatches
=
this
.
matches
(
searchValue
,
keybindingItem
.
command
,
or
(
matchesWords
,
matchesCamelCase
),
words
);
this
.
commandLabelMatches
=
keybindingItem
.
commandLabel
?
this
.
matches
(
searchValue
,
keybindingItem
.
commandLabel
,
(
word
,
wordToMatchAgainst
)
=>
matchesWords
(
word
,
keybindingItem
.
commandLabel
,
true
),
words
)
:
null
;
this
.
commandDefaultLabelMatches
=
keybindingItem
.
commandDefaultLabel
?
this
.
matches
(
searchValue
,
keybindingItem
.
commandDefaultLabel
,
(
word
,
wordToMatchAgainst
)
=>
matchesWords
(
word
,
keybindingItem
.
commandDefaultLabel
,
true
),
words
)
:
null
;
this
.
sourceMatches
=
this
.
matches
(
searchValue
,
keybindingItem
.
source
,
(
word
,
wordToMatchAgainst
)
=>
matchesWords
(
word
,
keybindingItem
.
source
,
true
),
words
);
this
.
whenMatches
=
keybindingItem
.
when
?
this
.
matches
(
searchValue
,
keybindingItem
.
when
,
or
(
matchesWords
,
matchesCamelCase
),
words
)
:
null
;
this
.
keybindingMatches
=
keybindingItem
.
keybinding
?
this
.
matchesKeybinding
(
keybindingItem
.
keybinding
,
searchValue
,
keybindingWords
)
:
null
;
}
this
.
keybindingMatches
=
keybindingItem
.
keybinding
?
this
.
matchesKeybinding
(
keybindingItem
.
keybinding
,
searchValue
,
keybindingWords
,
completeMatch
)
:
null
;
}
private
matches
(
searchValue
:
string
,
wordToMatchAgainst
:
string
,
wordMatchesFilter
:
IFilter
,
words
:
string
[]):
IMatch
[]
{
...
...
@@ -299,7 +301,7 @@ class KeybindingItemMatches {
return
distinct
(
matches
,
(
a
=>
a
.
start
+
'
.
'
+
a
.
end
)).
filter
(
match
=>
!
matches
.
some
(
m
=>
!
(
m
.
start
===
match
.
start
&&
m
.
end
===
match
.
end
)
&&
(
m
.
start
<=
match
.
start
&&
m
.
end
>=
match
.
end
))).
sort
((
a
,
b
)
=>
a
.
start
-
b
.
start
);
}
private
matchesKeybinding
(
keybinding
:
ResolvedKeybinding
,
searchValue
:
string
,
words
:
string
[]):
KeybindingMatches
{
private
matchesKeybinding
(
keybinding
:
ResolvedKeybinding
,
searchValue
:
string
,
words
:
string
[]
,
completeMatch
:
boolean
):
KeybindingMatches
{
const
[
firstPart
,
chordPart
]
=
keybinding
.
getParts
();
if
(
strings
.
compareIgnoreCase
(
searchValue
,
keybinding
.
getAriaLabel
())
===
0
||
strings
.
compareIgnoreCase
(
searchValue
,
keybinding
.
getLabel
())
===
0
)
{
...
...
@@ -325,7 +327,7 @@ class KeybindingItemMatches {
let
matchChordPart
=
!
chordPartMatch
.
keyCode
;
if
(
matchFirstPart
)
{
firstPartMatched
=
this
.
matchPart
(
firstPart
,
firstPartMatch
,
word
);
firstPartMatched
=
this
.
matchPart
(
firstPart
,
firstPartMatch
,
word
,
completeMatch
);
if
(
firstPartMatch
.
keyCode
)
{
for
(
const
cordPartMatchedWordIndex
of
chordPartMatchedWords
)
{
if
(
firstPartMatchedWords
.
indexOf
(
cordPartMatchedWordIndex
)
===
-
1
)
{
...
...
@@ -339,7 +341,7 @@ class KeybindingItemMatches {
}
if
(
matchChordPart
)
{
chordPartMatched
=
this
.
matchPart
(
chordPart
,
chordPartMatch
,
word
);
chordPartMatched
=
this
.
matchPart
(
chordPart
,
chordPartMatch
,
word
,
completeMatch
);
}
if
(
firstPartMatched
)
{
...
...
@@ -357,13 +359,13 @@ class KeybindingItemMatches {
if
(
matchedWords
.
length
!==
words
.
length
)
{
return
null
;
}
if
(
this
.
completeMatch
&&
(
!
this
.
isCompleteMatch
(
firstPart
,
firstPartMatch
)
||
!
this
.
isCompleteMatch
(
chordPart
,
chordPartMatch
)))
{
if
(
completeMatch
&&
(
!
this
.
isCompleteMatch
(
firstPart
,
firstPartMatch
)
||
!
this
.
isCompleteMatch
(
chordPart
,
chordPartMatch
)))
{
return
null
;
}
return
this
.
hasAnyMatch
(
firstPartMatch
)
||
this
.
hasAnyMatch
(
chordPartMatch
)
?
{
firstPart
:
firstPartMatch
,
chordPart
:
chordPartMatch
}
:
null
;
}
private
matchPart
(
part
:
ResolvedKeybindingPart
,
match
:
KeybindingMatch
,
word
:
string
):
boolean
{
private
matchPart
(
part
:
ResolvedKeybindingPart
,
match
:
KeybindingMatch
,
word
:
string
,
completeMatch
:
boolean
):
boolean
{
let
matched
=
false
;
if
(
this
.
matchesMetaModifier
(
part
,
word
))
{
matched
=
true
;
...
...
@@ -381,19 +383,19 @@ class KeybindingItemMatches {
matched
=
true
;
match
.
altKey
=
true
;
}
if
(
this
.
matchesKeyCode
(
part
,
word
))
{
if
(
this
.
matchesKeyCode
(
part
,
word
,
completeMatch
))
{
match
.
keyCode
=
true
;
matched
=
true
;
}
return
matched
;
}
private
matchesKeyCode
(
keybinding
:
ResolvedKeybindingPart
,
word
:
string
):
boolean
{
private
matchesKeyCode
(
keybinding
:
ResolvedKeybindingPart
,
word
:
string
,
completeMatch
:
boolean
):
boolean
{
if
(
!
keybinding
)
{
return
false
;
}
const
ariaLabel
=
keybinding
.
keyAriaLabel
;
if
(
this
.
completeMatch
||
ariaLabel
.
length
===
1
||
word
.
length
===
1
)
{
if
(
completeMatch
||
ariaLabel
.
length
===
1
||
word
.
length
===
1
)
{
if
(
strings
.
compareIgnoreCase
(
ariaLabel
,
word
)
===
0
)
{
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录