Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
28647334
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,发现更多精彩内容 >>
提交
28647334
编写于
3月 17, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Begin adoption of RuntimeKeybinding
上级
93c52c48
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
133 addition
and
74 deletion
+133
-74
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+33
-5
src/vs/editor/browser/standalone/simpleServices.ts
src/vs/editor/browser/standalone/simpleServices.ts
+6
-6
src/vs/platform/keybinding/common/abstractKeybindingService.ts
...s/platform/keybinding/common/abstractKeybindingService.ts
+7
-6
src/vs/platform/keybinding/common/keybinding.ts
src/vs/platform/keybinding/common/keybinding.ts
+2
-2
src/vs/platform/keybinding/common/keybindingsRegistry.ts
src/vs/platform/keybinding/common/keybindingsRegistry.ts
+43
-14
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
.../keybinding/test/common/abstractKeybindingService.test.ts
+5
-5
src/vs/platform/keybinding/test/common/keybindingLabels.test.ts
.../platform/keybinding/test/common/keybindingLabels.test.ts
+6
-6
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
...latform/keybinding/test/common/keybindingResolver.test.ts
+13
-12
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
.../platform/keybinding/test/common/mockKeybindingService.ts
+2
-2
src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts
...arts/preferences/browser/keybindingsEditorContribution.ts
+2
-2
src/vs/workbench/services/keybinding/common/keybindingIO.ts
src/vs/workbench/services/keybinding/common/keybindingIO.ts
+2
-2
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
...services/keybinding/electron-browser/keybindingService.ts
+5
-5
src/vs/workbench/services/keybinding/test/keybindingIO.test.ts
...s/workbench/services/keybinding/test/keybindingIO.test.ts
+4
-4
src/vs/workbench/services/keybinding/test/keyboardMapper.test.ts
...workbench/services/keybinding/test/keyboardMapper.test.ts
+3
-3
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
28647334
...
...
@@ -568,17 +568,17 @@ export class ChordKeybinding {
export
type
Keybinding
=
SimpleKeybinding
|
ChordKeybinding
;
export
function
createRuntimeKeybinding
(
keybinding
:
Keybinding
,
OS
:
OperatingSystem
):
RuntimeKeybinding
{
export
function
_
createRuntimeKeybinding
(
keybinding
:
Keybinding
,
OS
:
OperatingSystem
):
RuntimeKeybinding
{
if
(
keybinding
.
isChord
())
{
return
new
ChordRuntimeKeybinding
(
createSimpleRuntimeKeybinding
(
keybinding
.
extractFirstPart
(),
OS
),
createSimpleRuntimeKeybinding
(
keybinding
.
extractChordPart
(),
OS
),
_
createSimpleRuntimeKeybinding
(
keybinding
.
extractFirstPart
(),
OS
),
_
createSimpleRuntimeKeybinding
(
keybinding
.
extractChordPart
(),
OS
),
);
}
return
createSimpleRuntimeKeybinding
(
keybinding
,
OS
);
return
_
createSimpleRuntimeKeybinding
(
keybinding
,
OS
);
}
export
function
createSimpleRuntimeKeybinding
(
keybinding
:
SimpleKeybinding
,
OS
:
OperatingSystem
):
SimpleRuntimeKeybinding
{
function
_
createSimpleRuntimeKeybinding
(
keybinding
:
SimpleKeybinding
,
OS
:
OperatingSystem
):
SimpleRuntimeKeybinding
{
const
ctrlCmd
=
keybinding
.
hasCtrlCmd
();
const
winCtrl
=
keybinding
.
hasWinCtrl
();
const
ctrlKey
=
(
OS
===
OperatingSystem
.
Macintosh
?
winCtrl
:
ctrlCmd
);
...
...
@@ -592,6 +592,34 @@ export function createSimpleRuntimeKeybinding(keybinding: SimpleKeybinding, OS:
return
new
SimpleRuntimeKeybinding
(
ctrlKey
,
shiftKey
,
altKey
,
metaKey
,
keyCode
);
}
export
function
createRuntimeKeybinding
(
keybinding
:
number
,
OS
:
OperatingSystem
):
RuntimeKeybinding
{
if
(
keybinding
===
0
)
{
return
null
;
}
if
(
BinaryKeybindings
.
hasChord
(
keybinding
))
{
return
new
ChordRuntimeKeybinding
(
createSimpleRuntimeKeybinding
(
BinaryKeybindings
.
extractFirstPart
(
keybinding
),
OS
),
createSimpleRuntimeKeybinding
(
BinaryKeybindings
.
extractChordPart
(
keybinding
),
OS
),
);
}
return
createSimpleRuntimeKeybinding
(
keybinding
,
OS
);
}
function
createSimpleRuntimeKeybinding
(
keybinding
:
number
,
OS
:
OperatingSystem
):
SimpleRuntimeKeybinding
{
const
ctrlCmd
=
BinaryKeybindings
.
hasCtrlCmd
(
keybinding
);
const
winCtrl
=
BinaryKeybindings
.
hasWinCtrl
(
keybinding
);
const
ctrlKey
=
(
OS
===
OperatingSystem
.
Macintosh
?
winCtrl
:
ctrlCmd
);
const
metaKey
=
(
OS
===
OperatingSystem
.
Macintosh
?
ctrlCmd
:
winCtrl
);
const
shiftKey
=
BinaryKeybindings
.
hasShift
(
keybinding
);
const
altKey
=
BinaryKeybindings
.
hasAlt
(
keybinding
);
const
keyCode
=
BinaryKeybindings
.
extractKeyCode
(
keybinding
);
return
new
SimpleRuntimeKeybinding
(
ctrlKey
,
shiftKey
,
altKey
,
metaKey
,
keyCode
);
}
export
const
enum
RuntimeKeybindingType
{
Simple
=
1
,
Chord
=
2
...
...
src/vs/editor/browser/standalone/simpleServices.ts
浏览文件 @
28647334
...
...
@@ -32,7 +32,7 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe
import
{
MenuId
,
IMenu
,
IMenuService
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Menu
}
from
'
vs/platform/actions/common/menu
'
;
import
{
ITelemetryService
,
ITelemetryExperiments
,
ITelemetryInfo
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ResolvedKeybinding
,
Keybinding
,
creat
eKeybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
Runtim
eKeybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybindingItem
}
from
'
vs/platform/keybinding/common/resolvedKeybindingItem
'
;
import
{
OS
}
from
'
vs/base/common/platform
'
;
...
...
@@ -334,7 +334,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
let
toDispose
:
IDisposable
[]
=
[];
this
.
_dynamicKeybindings
.
push
({
keybinding
:
keybinding
,
keybinding
:
createRuntimeKeybinding
(
keybinding
,
OS
)
,
command
:
commandId
,
when
:
when
,
weight1
:
1000
,
...
...
@@ -386,8 +386,8 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
for
(
let
i
=
0
,
len
=
items
.
length
;
i
<
len
;
i
++
)
{
const
item
=
items
[
i
];
const
when
=
(
item
.
when
?
item
.
when
.
normalize
()
:
null
);
const
keybinding
=
(
item
.
keybinding
!==
0
?
createKeybinding
(
item
.
keybinding
)
:
null
)
;
const
resolvedKeybinding
=
(
keybinding
!==
null
?
this
.
_createResolvedKeybinding
(
keybinding
)
:
null
);
const
keybinding
=
item
.
keybinding
;
const
resolvedKeybinding
=
(
keybinding
?
this
.
_createResolvedKeybinding
(
keybinding
)
:
null
);
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
}
...
...
@@ -395,8 +395,8 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
return
result
;
}
protected
_createResolvedKeybinding
(
kb
:
Keybinding
):
ResolvedKeybinding
{
return
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
kb
,
OS
)
,
OS
);
protected
_createResolvedKeybinding
(
kb
:
Runtime
Keybinding
):
ResolvedKeybinding
{
return
new
USLayoutResolvedKeybinding
(
kb
,
OS
);
}
}
...
...
src/vs/platform/keybinding/common/abstractKeybindingService.ts
浏览文件 @
28647334
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
ResolvedKeybinding
,
SimpleKeybinding
,
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
SimpleKeybinding
,
Keybinding
,
RuntimeKeybinding
,
_createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -15,6 +15,7 @@ import { IContextKeyService, IContextKeyServiceTarget } from 'vs/platform/contex
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
OS
}
from
'
vs/base/common/platform
'
;
interface
CurrentChord
{
keypress
:
string
;
...
...
@@ -57,14 +58,14 @@ export abstract class AbstractKeybindingService implements IKeybindingService {
}
protected
abstract
_getResolver
():
KeybindingResolver
;
protected
abstract
_createResolvedKeybinding
(
kb
:
Keybinding
):
ResolvedKeybinding
;
protected
abstract
_createResolvedKeybinding
(
kb
:
Runtime
Keybinding
):
ResolvedKeybinding
;
get
onDidUpdateKeybindings
():
Event
<
IKeybindingEvent
>
{
return
this
.
_onDidUpdateKeybindings
?
this
.
_onDidUpdateKeybindings
.
event
:
Event
.
None
;
// Sinon stubbing walks properties on prototype
}
public
resolveKeybinding
(
keybinding
:
Keybinding
):
ResolvedKeybinding
{
return
this
.
_createResolvedKeybinding
(
keybinding
);
return
this
.
_createResolvedKeybinding
(
_createRuntimeKeybinding
(
keybinding
,
OS
)
);
}
public
getDefaultKeybindings
():
string
{
...
...
@@ -103,7 +104,7 @@ export abstract class AbstractKeybindingService implements IKeybindingService {
const
contextValue
=
this
.
_contextKeyService
.
getContextValue
(
target
);
const
currentChord
=
this
.
_currentChord
?
this
.
_currentChord
.
keypress
:
null
;
const
resolvedKeybinding
=
this
.
_createResolvedKeybinding
(
keybinding
);
const
resolvedKeybinding
=
this
.
_createResolvedKeybinding
(
_createRuntimeKeybinding
(
keybinding
,
OS
)
);
const
[
firstPart
,]
=
resolvedKeybinding
.
getDispatchParts
();
// We know for a fact the chordPart is null since we're using a single keypress
return
this
.
_getResolver
().
resolve
(
contextValue
,
currentChord
,
firstPart
);
...
...
@@ -119,9 +120,9 @@ export abstract class AbstractKeybindingService implements IKeybindingService {
const
contextValue
=
this
.
_contextKeyService
.
getContextValue
(
target
);
const
currentChord
=
this
.
_currentChord
?
this
.
_currentChord
.
keypress
:
null
;
const
resolvedKeybinding
=
this
.
_createResolvedKeybinding
(
keybinding
);
const
resolvedKeybinding
=
this
.
_createResolvedKeybinding
(
_createRuntimeKeybinding
(
keybinding
,
OS
)
);
const
[
firstPart
,]
=
resolvedKeybinding
.
getDispatchParts
();
const
keypressLabel
=
this
.
_createResolvedKeybinding
(
keybinding
)
.
getLabel
();
const
keypressLabel
=
resolvedKeybinding
.
getLabel
();
const
resolveResult
=
this
.
_getResolver
().
resolve
(
contextValue
,
currentChord
,
firstPart
);
if
(
resolveResult
&&
resolveResult
.
enterChord
)
{
...
...
src/vs/platform/keybinding/common/keybinding.ts
浏览文件 @
28647334
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
ResolvedKeybinding
,
SimpleKeybinding
,
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
SimpleKeybinding
,
Keybinding
,
RuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ContextKeyExpr
,
IContextKeyServiceTarget
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IResolveResult
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
...
...
@@ -35,7 +35,7 @@ export interface IKeybindings {
}
export
interface
IKeybindingItem
{
keybinding
:
number
;
keybinding
:
RuntimeKeybinding
;
command
:
string
;
commandArgs
?:
any
;
when
:
ContextKeyExpr
;
...
...
src/vs/platform/keybinding/common/keybindingsRegistry.ts
浏览文件 @
28647334
...
...
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
createKeybinding
,
KeyCodeUtils
}
from
'
vs/base/common/keyCodes
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
SimpleRuntimeKeybinding
,
KeyCode
,
RuntimeKeybindingType
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
OS
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IKeybindingItem
,
IKeybindings
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
CommandsRegistry
,
ICommandHandler
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -66,11 +66,11 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
* Take current platform into account and reduce to primary & secondary.
*/
private
static
bindToCurrentPlatform
(
kb
:
IKeybindings
):
{
primary
?:
number
;
secondary
?:
number
[];
}
{
if
(
platform
.
is
Windows
)
{
if
(
OS
===
OperatingSystem
.
Windows
)
{
if
(
kb
&&
kb
.
win
)
{
return
kb
.
win
;
}
}
else
if
(
platform
.
is
Macintosh
)
{
}
else
if
(
OS
===
OperatingSystem
.
Macintosh
)
{
if
(
kb
&&
kb
.
mac
)
{
return
kb
.
mac
;
}
...
...
@@ -86,12 +86,10 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
public
registerKeybindingRule
(
rule
:
IKeybindingRule
):
void
{
let
actualKb
=
KeybindingsRegistryImpl
.
bindToCurrentPlatform
(
rule
);
// here
if
(
actualKb
&&
actualKb
.
primary
)
{
this
.
registerDefaultKeybinding
(
actualKb
.
primary
,
rule
.
id
,
rule
.
weight
,
0
,
rule
.
when
);
}
// here
if
(
actualKb
&&
Array
.
isArray
(
actualKb
.
secondary
))
{
actualKb
.
secondary
.
forEach
((
k
,
i
)
=>
this
.
registerDefaultKeybinding
(
k
,
rule
.
id
,
rule
.
weight
,
-
i
-
1
,
rule
.
when
));
}
...
...
@@ -102,18 +100,49 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
CommandsRegistry
.
registerCommand
(
desc
.
id
,
desc
);
}
private
static
_mightProduceChar
(
keyCode
:
KeyCode
):
boolean
{
if
(
keyCode
>=
KeyCode
.
KEY_0
&&
keyCode
<=
KeyCode
.
KEY_9
)
{
return
true
;
}
if
(
keyCode
>=
KeyCode
.
KEY_A
&&
keyCode
<=
KeyCode
.
KEY_Z
)
{
return
true
;
}
return
(
keyCode
===
KeyCode
.
US_SEMICOLON
||
keyCode
===
KeyCode
.
US_EQUAL
||
keyCode
===
KeyCode
.
US_COMMA
||
keyCode
===
KeyCode
.
US_MINUS
||
keyCode
===
KeyCode
.
US_DOT
||
keyCode
===
KeyCode
.
US_SLASH
||
keyCode
===
KeyCode
.
US_BACKTICK
||
keyCode
===
KeyCode
.
US_OPEN_SQUARE_BRACKET
||
keyCode
===
KeyCode
.
US_BACKSLASH
||
keyCode
===
KeyCode
.
US_CLOSE_SQUARE_BRACKET
||
keyCode
===
KeyCode
.
US_QUOTE
||
keyCode
===
KeyCode
.
OEM_8
||
keyCode
===
KeyCode
.
OEM_102
);
}
private
_assertNoCtrlAlt
(
keybinding
:
SimpleRuntimeKeybinding
,
commandId
:
string
):
void
{
if
(
keybinding
.
ctrlKey
&&
keybinding
.
altKey
&&
!
keybinding
.
metaKey
)
{
if
(
KeybindingsRegistryImpl
.
_mightProduceChar
(
keybinding
.
keyCode
))
{
console
.
warn
(
'
Ctrl+Alt+ keybindings should not be used by default under Windows. Offender:
'
,
keybinding
,
'
for
'
,
commandId
);
}
}
}
private
registerDefaultKeybinding
(
keybinding
:
number
,
commandId
:
string
,
weight1
:
number
,
weight2
:
number
,
when
:
ContextKeyExpr
):
void
{
if
(
platform
.
isWindows
)
{
let
kb
=
createKeybinding
(
keybinding
);
let
simpleKb
=
kb
.
isChord
()
?
kb
.
extractFirstPart
()
:
kb
;
if
(
simpleKb
.
hasCtrlCmd
()
&&
!
simpleKb
.
hasShift
()
&&
simpleKb
.
hasAlt
()
&&
!
simpleKb
.
hasWinCtrl
())
{
if
(
/^
[
A-Z0-9
\[\]\|\;\'\,\.\/\`]
$/
.
test
(
KeyCodeUtils
.
toString
(
simpleKb
.
getKeyCode
())))
{
console
.
warn
(
'
Ctrl+Alt+ keybindings should not be used by default under Windows. Offender:
'
,
keybinding
,
'
for
'
,
commandId
);
}
const
runtimeKeybinding
=
createRuntimeKeybinding
(
keybinding
,
OS
);
if
(
OS
===
OperatingSystem
.
Windows
)
{
if
(
runtimeKeybinding
.
type
===
RuntimeKeybindingType
.
Chord
)
{
this
.
_assertNoCtrlAlt
(
runtimeKeybinding
.
firstPart
,
commandId
);
}
else
{
this
.
_assertNoCtrlAlt
(
runtimeKeybinding
,
commandId
);
}
}
this
.
_keybindings
.
push
({
keybinding
:
k
eybinding
,
keybinding
:
runtimeK
eybinding
,
command
:
commandId
,
commandArgs
:
null
,
when
:
when
,
...
...
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
浏览文件 @
28647334
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
ResolvedKeybinding
,
Keybinding
,
SimpleKeybinding
,
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
SimpleKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
RuntimeKeybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
AbstractKeybindingService
}
from
'
vs/platform/keybinding/common/abstractKeybindingService
'
;
import
{
USLayoutResolvedKeybinding
}
from
'
vs/platform/keybinding/common/usLayoutResolvedKeybinding
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -39,8 +39,8 @@ suite('AbstractKeybindingService', () => {
return
this
.
_resolver
;
}
protected
_createResolvedKeybinding
(
kb
:
Keybinding
):
ResolvedKeybinding
{
return
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
kb
,
OS
)
,
OS
);
protected
_createResolvedKeybinding
(
kb
:
Runtime
Keybinding
):
ResolvedKeybinding
{
return
new
USLayoutResolvedKeybinding
(
kb
,
OS
);
}
public
dispatch
(
keybinding
:
SimpleKeybinding
):
boolean
{
...
...
@@ -130,7 +130,7 @@ suite('AbstractKeybindingService', () => {
});
function
kbItem
(
keybinding
:
number
,
command
:
string
,
when
:
ContextKeyExpr
=
null
):
ResolvedKeybindingItem
{
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
)
:
null
);
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
)
:
null
);
return
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
command
,
...
...
@@ -141,7 +141,7 @@ suite('AbstractKeybindingService', () => {
}
function
toUsLabel
(
keybinding
:
number
):
string
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
return
usResolvedKeybinding
.
getLabel
();
}
...
...
src/vs/platform/keybinding/test/common/keybindingLabels.test.ts
浏览文件 @
28647334
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IHTMLContentElement
}
from
'
vs/base/common/htmlContent
'
;
import
{
USLayoutResolvedKeybinding
}
from
'
vs/platform/keybinding/common/usLayoutResolvedKeybinding
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
...
...
@@ -13,7 +13,7 @@ import { OperatingSystem } from 'vs/base/common/platform';
suite
(
'
KeybindingLabels
'
,
()
=>
{
function
assertUSLabel
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getLabel
(),
expected
);
}
...
...
@@ -118,7 +118,7 @@ suite('KeybindingLabels', () => {
test
(
'
Aria label
'
,
()
=>
{
function
assertAriaLabel
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getAriaLabel
(),
expected
);
}
...
...
@@ -129,7 +129,7 @@ suite('KeybindingLabels', () => {
test
(
'
Electron Accelerator label
'
,
()
=>
{
function
assertElectronAcceleratorLabel
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getElectronAccelerator
(),
expected
);
}
...
...
@@ -156,7 +156,7 @@ suite('KeybindingLabels', () => {
test
(
'
User Settings label
'
,
()
=>
{
function
assertElectronAcceleratorLabel
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getUserSettingsLabel
(),
expected
);
}
...
...
@@ -172,7 +172,7 @@ suite('KeybindingLabels', () => {
test
(
'
US HTML label
'
,
()
=>
{
function
assertHTMLLabel
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
IHTMLContentElement
[]):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
deepEqual
(
usResolvedKeybinding
.
getHTMLLabel
(),
expected
);
}
...
...
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
浏览文件 @
28647334
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
createKeybinding
,
SimpleKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
,
create
SimpleRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
,
RuntimeKeybindingType
,
SimpleRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
ContextKeyAndExpr
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ResolvedKeybindingItem
}
from
'
vs/platform/keybinding/common/resolvedKeybindingItem
'
;
...
...
@@ -15,7 +15,7 @@ import { OS } from 'vs/base/common/platform';
suite
(
'
KeybindingResolver
'
,
()
=>
{
function
kbItem
(
keybinding
:
number
,
command
:
string
,
commandArgs
:
any
,
when
:
ContextKeyExpr
,
isDefault
:
boolean
):
ResolvedKeybindingItem
{
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
)
:
null
);
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
)
:
null
);
return
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
command
,
...
...
@@ -25,13 +25,13 @@ suite('KeybindingResolver', () => {
);
}
function
getDispatchStr
(
kb
:
SimpleKeybinding
):
string
{
let
runtimeKb
=
createSimpleRuntimeKeybinding
(
kb
,
OS
);
function
getDispatchStr
(
runtimeKb
:
SimpleRuntimeKeybinding
):
string
{
return
USLayoutResolvedKeybinding
.
getDispatchStr
(
runtimeKb
);
}
test
(
'
resolve key
'
,
function
()
{
let
keybinding
=
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_Z
;
let
runtimeKeybinding
=
createRuntimeKeybinding
(
keybinding
,
OS
);
let
contextRules
=
ContextKeyExpr
.
equals
(
'
bar
'
,
'
baz
'
);
let
keybindingItem
=
kbItem
(
keybinding
,
'
yes
'
,
null
,
contextRules
,
true
);
...
...
@@ -39,18 +39,19 @@ suite('KeybindingResolver', () => {
assert
.
equal
(
KeybindingResolver
.
contextMatchesRules
({
bar
:
'
bz
'
},
contextRules
),
false
);
let
resolver
=
new
KeybindingResolver
([
keybindingItem
],
[]);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
baz
'
},
null
,
getDispatchStr
(
new
SimpleKeybinding
(
keybinding
)
)).
commandId
,
'
yes
'
);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
bz
'
},
null
,
getDispatchStr
(
new
SimpleKeybinding
(
keybinding
)
)),
null
);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
baz
'
},
null
,
getDispatchStr
(
<
SimpleRuntimeKeybinding
>
runtimeKeybinding
)).
commandId
,
'
yes
'
);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
bz
'
},
null
,
getDispatchStr
(
<
SimpleRuntimeKeybinding
>
runtimeKeybinding
)),
null
);
});
test
(
'
resolve key with arguments
'
,
function
()
{
let
commandArgs
=
{
text
:
'
no
'
};
let
keybinding
=
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_Z
;
let
runtimeKeybinding
=
createRuntimeKeybinding
(
keybinding
,
OS
);
let
contextRules
=
ContextKeyExpr
.
equals
(
'
bar
'
,
'
baz
'
);
let
keybindingItem
=
kbItem
(
keybinding
,
'
yes
'
,
commandArgs
,
contextRules
,
true
);
let
resolver
=
new
KeybindingResolver
([
keybindingItem
],
[]);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
baz
'
},
null
,
getDispatchStr
(
new
SimpleKeybinding
(
keybinding
)
)).
commandArgs
,
commandArgs
);
assert
.
equal
(
resolver
.
resolve
({
bar
:
'
baz
'
},
null
,
getDispatchStr
(
<
SimpleRuntimeKeybinding
>
runtimeKeybinding
)).
commandArgs
,
commandArgs
);
});
test
(
'
KeybindingResolver.combine simple 1
'
,
function
()
{
...
...
@@ -326,18 +327,18 @@ suite('KeybindingResolver', () => {
let
lookupResult
=
resolver
.
lookupKeybindings
(
commandId
);
assert
.
equal
(
lookupResult
.
length
,
expectedKeys
.
length
,
'
Length mismatch @ commandId
'
+
commandId
+
'
; GOT:
'
+
JSON
.
stringify
(
lookupResult
,
null
,
'
\t
'
));
for
(
let
i
=
0
,
len
=
lookupResult
.
length
;
i
<
len
;
i
++
)
{
const
expected
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
expectedKeys
[
i
])
,
OS
),
OS
);
const
expected
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
expectedKeys
[
i
]
,
OS
),
OS
);
assert
.
equal
(
lookupResult
[
i
].
resolvedKeybinding
.
getUserSettingsLabel
(),
expected
.
getUserSettingsLabel
(),
'
value mismatch @ commandId
'
+
commandId
);
}
};
let
testResolve
=
(
ctx
:
any
,
_expectedKey
:
number
,
commandId
:
string
)
=>
{
let
expectedKey
=
createKeybinding
(
_expectedKey
);
const
expectedKey
=
createRuntimeKeybinding
(
_expectedKey
,
OS
);
if
(
expectedKey
.
isChord
()
)
{
let
firstPart
=
getDispatchStr
(
expectedKey
.
extractFirstPart
()
);
let
chordPart
=
getDispatchStr
(
expectedKey
.
extractChordPart
()
);
if
(
expectedKey
.
type
===
RuntimeKeybindingType
.
Chord
)
{
let
firstPart
=
getDispatchStr
(
expectedKey
.
firstPart
);
let
chordPart
=
getDispatchStr
(
expectedKey
.
chordPart
);
let
result
=
resolver
.
resolve
(
ctx
,
null
,
firstPart
);
assert
.
ok
(
result
!==
null
,
'
Enters chord for
'
+
commandId
);
...
...
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
浏览文件 @
28647334
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
ResolvedKeybinding
,
Keybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
Keybinding
,
_
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
Event
from
'
vs/base/common/event
'
;
import
{
IKeybindingService
,
IKeybindingEvent
,
IKeybindingItem2
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextKey
,
IContextKeyService
,
IContextKeyServiceTarget
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -77,7 +77,7 @@ export class MockKeybindingService2 implements IKeybindingService {
}
public
resolveKeybinding
(
keybinding
:
Keybinding
):
ResolvedKeybinding
{
return
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
return
new
USLayoutResolvedKeybinding
(
_
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
}
public
lookupKeybindings
(
commandId
:
string
):
ResolvedKeybinding
[]
{
...
...
src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts
浏览文件 @
28647334
...
...
@@ -9,7 +9,7 @@ import * as nls from 'vs/nls';
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
MarkedString
}
from
'
vs/base/common/htmlContent
'
;
import
{
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
_
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
KeybindingIO
}
from
'
vs/workbench/services/keybinding/common/keybindingIO
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -170,7 +170,7 @@ export class DefineKeybindingController implements editorCommon.IEditorContribut
let
keybinding
=
createKeybinding
(
numKeybinding
);
let
resolvedKeybinding
=
this
.
_keybindingService
.
resolveKeybinding
(
keybinding
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
_
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
return
{
strKeybinding
:
strKeybinding
,
keybinding
:
keybinding
,
...
...
src/vs/workbench/services/keybinding/common/keybindingIO.ts
浏览文件 @
28647334
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
KeyMod
,
KeyChord
,
USER_SETTINGS
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyMod
,
KeyChord
,
USER_SETTINGS
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IKeybindingItem
,
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -51,7 +51,7 @@ export class KeybindingIO {
}
return
{
keybinding
:
key
,
keybinding
:
createRuntimeKeybinding
(
key
,
OS
)
,
command
:
command
,
commandArgs
:
commandArgs
,
when
:
when
,
...
...
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
浏览文件 @
28647334
...
...
@@ -7,7 +7,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
IHTMLContentElement
}
from
'
vs/base/common/htmlContent
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
ResolvedKeybinding
,
Key
binding
,
createKeybinding
,
KeyCode
,
USER_SETTINGS
,
RuntimeKeybinding
,
RuntimeKeybindingType
,
SimpleRuntimeKeybinding
,
KeyCodeUtils
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
Key
Code
,
USER_SETTINGS
,
RuntimeKeybinding
,
RuntimeKeybindingType
,
SimpleRuntimeKeybinding
,
KeyCodeUtils
}
from
'
vs/base/common/keyCodes
'
;
import
{
PrintableKeypress
,
UILabelProvider
,
AriaLabelProvider
,
UserSettingsLabelProvider
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
OS
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -338,8 +338,8 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
for
(
let
i
=
0
,
len
=
items
.
length
;
i
<
len
;
i
++
)
{
const
item
=
items
[
i
];
const
when
=
(
item
.
when
?
item
.
when
.
normalize
()
:
null
);
const
keybinding
=
(
item
.
keybinding
!==
0
?
createKeybinding
(
item
.
keybinding
)
:
null
)
;
const
resolvedKeybinding
=
(
keybinding
!==
null
?
this
.
_createResolvedKeybinding
(
keybinding
)
:
null
);
const
keybinding
=
item
.
keybinding
;
const
resolvedKeybinding
=
(
keybinding
?
this
.
_createResolvedKeybinding
(
keybinding
)
:
null
);
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
}
...
...
@@ -360,8 +360,8 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
return
extraUserKeybindings
.
map
((
k
,
i
)
=>
KeybindingIO
.
readKeybindingItem
(
k
,
i
,
OS
));
}
protected
_createResolvedKeybinding
(
kb
:
Keybinding
):
ResolvedKeybinding
{
return
new
FancyResolvedKeybinding
(
createRuntimeKeybinding
(
kb
,
OS
)
);
protected
_createResolvedKeybinding
(
kb
:
Runtime
Keybinding
):
ResolvedKeybinding
{
return
new
FancyResolvedKeybinding
(
kb
);
}
private
_handleKeybindingsExtensionPointUser
(
isBuiltin
:
boolean
,
keybindings
:
ContributedKeyBinding
|
ContributedKeyBinding
[],
collector
:
ExtensionMessageCollector
):
boolean
{
...
...
src/vs/workbench/services/keybinding/test/keybindingIO.test.ts
浏览文件 @
28647334
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
,
KeyCodeUtils
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyMod
,
KeyChord
,
KeyCodeUtils
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeybindingIO
}
from
'
vs/workbench/services/keybinding/common/keybindingIO
'
;
import
{
OS
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -31,7 +31,7 @@ suite('keybindingIO', () => {
if
(
ignore
[
keyCode
])
{
continue
;
}
let
usLayoutResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keyCode
)
,
OS
),
OS
);
let
usLayoutResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keyCode
,
OS
),
OS
);
let
userSettings
=
usLayoutResolvedKeybinding
.
getUserSettingsLabel
();
testIsGood
(
userSettings
,
keyCode
+
'
-
'
+
KeyCodeUtils
.
toString
(
keyCode
)
+
'
-
'
+
userSettings
);
}
...
...
@@ -57,7 +57,7 @@ suite('keybindingIO', () => {
test
(
'
serialize/deserialize
'
,
function
()
{
function
testOneSerialization
(
keybinding
:
number
,
expected
:
string
,
msg
:
string
,
OS
:
OperatingSystem
):
void
{
let
usLayoutResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
keybinding
)
,
OS
),
OS
);
let
usLayoutResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
keybinding
,
OS
),
OS
);
let
actualSerialized
=
usLayoutResolvedKeybinding
.
getUserSettingsLabel
();
assert
.
equal
(
actualSerialized
,
expected
,
expected
+
'
-
'
+
msg
);
}
...
...
@@ -170,7 +170,7 @@ suite('keybindingIO', () => {
let
strJSON
=
`[{ "key": [], "command": "firstcommand" }]`
;
let
userKeybinding
=
<
IUserFriendlyKeybinding
>
JSON
.
parse
(
strJSON
)[
0
];
let
keybindingItem
=
KeybindingIO
.
readKeybindingItem
(
userKeybinding
,
0
,
OS
);
assert
.
equal
(
keybindingItem
.
keybinding
,
0
);
assert
.
equal
(
keybindingItem
.
keybinding
,
null
);
});
test
(
'
test commands args
'
,
()
=>
{
...
...
src/vs/workbench/services/keybinding/test/keyboardMapper.test.ts
浏览文件 @
28647334
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
KeyMod
,
KeyCode
,
SimpleKeybinding
,
createKeybinding
,
Keybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyMod
,
KeyCode
,
SimpleKeybinding
,
createKeybinding
,
Keybinding
,
_createRuntimeKeybinding
,
createRuntimeKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyboardMapper
,
IKeyboardMapping
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
UserSettingsLabelProvider
,
PrintableKeypress
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
...
...
@@ -179,7 +179,7 @@ function _assertKeybindingTranslation(mapper: KeyboardMapper, OS: OperatingSyste
}
else
{
expected
=
[];
}
let
keybindingLabel
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
createKeybinding
(
kb
)
,
OS
),
OS
).
getUserSettingsLabel
();
let
keybindingLabel
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
kb
,
OS
),
OS
).
getUserSettingsLabel
();
let
actualHardwareKeypresses
=
mapper
.
simpleKeybindingToHardwareKeypress
(
new
SimpleKeybinding
(
kb
));
if
(
actualHardwareKeypresses
.
length
===
0
)
{
...
...
@@ -201,7 +201,7 @@ function _assertKeybindingTranslation(mapper: KeyboardMapper, OS: OperatingSyste
return
;
}
const
reversedLabel
=
new
USLayoutResolvedKeybinding
(
createRuntimeKeybinding
(
reversed
,
OS
),
OS
).
getUserSettingsLabel
();
const
reversedLabel
=
new
USLayoutResolvedKeybinding
(
_
createRuntimeKeybinding
(
reversed
,
OS
),
OS
).
getUserSettingsLabel
();
assert
.
equal
(
reversedLabel
,
keybindingLabel
,
`
${
keybindingLabel
}
->
${
hardwareKeypressLabel
}
->
${
reversedLabel
}
`
);
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录