Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c688f7c5
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,发现更多精彩内容 >>
提交
c688f7c5
编写于
5月 03, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused ResolvedKeybinding methods
上级
31d62841
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
18 addition
and
822 deletion
+18
-822
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+2
-29
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+6
-5
src/vs/platform/keybinding/common/keybindingLabels.ts
src/vs/platform/keybinding/common/keybindingLabels.ts
+0
-7
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
.../platform/keybinding/common/usLayoutResolvedKeybinding.ts
+1
-41
src/vs/platform/keybinding/test/common/keybindingLabels.test.ts
.../platform/keybinding/test/common/keybindingLabels.test.ts
+0
-63
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+7
-1
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
...ench/services/keybinding/common/macLinuxKeyboardMapper.ts
+1
-41
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
...bench/services/keybinding/common/windowsKeyboardMapper.ts
+1
-41
src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts
...bench/services/keybinding/test/keyboardMapperTestUtils.ts
+0
-12
src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
...es/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
+0
-66
src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts
...h/services/keybinding/test/macLinuxKeyboardMapper.test.ts
+0
-396
src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts
...ch/services/keybinding/test/windowsKeyboardMapper.test.ts
+0
-120
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
c688f7c5
...
...
@@ -573,18 +573,10 @@ export abstract class ResolvedKeybinding {
* This prints the binding in a format suitable for displaying in the UI.
*/
public
abstract
getLabel
():
string
;
/**
* Returns the UI label of the binding without modifiers
*/
public
abstract
getLabelWithoutModifiers
():
string
;
/**
* This prints the binding in a format suitable for ARIA.
*/
public
abstract
getAriaLabel
():
string
;
/**
* Returns the ARIA label of the bindings without modifiers
*/
public
abstract
getAriaLabelWithoutModifiers
():
string
;
/**
* This prints the binding in a format suitable for electron's accelerators.
* See https://github.com/electron/electron/blob/master/docs/api/accelerator.md
...
...
@@ -603,33 +595,14 @@ export abstract class ResolvedKeybinding {
* Is the binding a chord?
*/
public
abstract
isChord
():
boolean
;
/**
* Does this binding use the ctrl modifier key.
* If it is a chord, it always returns false.
*/
public
abstract
hasCtrlModifier
():
boolean
;
/**
* Does this binding use the shift modifier key.
* If it is a chord, it always returns false.
*/
public
abstract
hasShiftModifier
():
boolean
;
/**
* Does this binding use the alt modifier key.
* If it is a chord, it always returns false.
*/
public
abstract
hasAltModifier
():
boolean
;
/**
* Does this binding use the meta modifier key.
* If it is a chord, it always returns false.
*/
public
abstract
hasMetaModifier
():
boolean
;
/**
* Returns the firstPart, chordPart that should be used for dispatching.
*/
public
abstract
getDispatchParts
():
[
string
,
string
];
/**
* Returns the firstPart, chordPart of the keybinding
* Returns the firstPart, chordPart of the keybinding.
* For simple keybindings, the second element will be null.
*/
public
abstract
getParts
():
[
ResolvedKeybindingPart
,
ResolvedKeybindingPart
];
}
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
浏览文件 @
c688f7c5
...
...
@@ -279,11 +279,12 @@ export class QuickOpenWidget implements IModelProvider {
// Select element when keys are pressed that signal it
const
quickNavKeys
=
this
.
quickNavigateConfiguration
.
keybindings
;
const
wasTriggerKeyPressed
=
keyCode
===
KeyCode
.
Enter
||
quickNavKeys
.
some
((
k
)
=>
{
if
(
k
.
isChord
())
{
const
[
firstPart
,
chordPart
]
=
k
.
getParts
();
if
(
chordPart
)
{
return
false
;
}
if
(
k
.
hasShiftModifier
()
&&
keyCode
===
KeyCode
.
Shift
)
{
if
(
firstPart
.
shiftKey
&&
keyCode
===
KeyCode
.
Shift
)
{
if
(
keyboardEvent
.
ctrlKey
||
keyboardEvent
.
altKey
||
keyboardEvent
.
metaKey
)
{
return
false
;
// this is an optimistic check for the shift key being used to navigate back in quick open
}
...
...
@@ -291,15 +292,15 @@ export class QuickOpenWidget implements IModelProvider {
return
true
;
}
if
(
k
.
hasAltModifier
()
&&
keyCode
===
KeyCode
.
Alt
)
{
if
(
firstPart
.
altKey
&&
keyCode
===
KeyCode
.
Alt
)
{
return
true
;
}
if
(
k
.
hasCtrlModifier
()
&&
keyCode
===
KeyCode
.
Ctrl
)
{
if
(
firstPart
.
ctrlKey
&&
keyCode
===
KeyCode
.
Ctrl
)
{
return
true
;
}
if
(
k
.
hasMetaModifier
()
&&
keyCode
===
KeyCode
.
Meta
)
{
if
(
firstPart
.
metaKey
&&
keyCode
===
KeyCode
.
Meta
)
{
return
true
;
}
...
...
src/vs/platform/keybinding/common/keybindingLabels.ts
浏览文件 @
c688f7c5
...
...
@@ -23,13 +23,6 @@ export interface Modifiers {
readonly
metaKey
:
boolean
;
}
export
const
NO_MODIFIERS
:
Modifiers
=
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
};
export
class
ModifierLabelProvider
{
public
readonly
modifierLabels
:
ModifierLabels
[];
...
...
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
浏览文件 @
c688f7c5
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
ResolvedKeybinding
,
ResolvedKeybindingPart
,
KeyCode
,
KeyCodeUtils
,
USER_SETTINGS
,
Keybinding
,
KeybindingType
,
SimpleKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
,
NO_MODIFIERS
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
/**
...
...
@@ -64,12 +64,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
}
public
getLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getUILabelForKeybinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getUILabelForKeybinding
(
this
.
_chordPart
);
return
UILabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
this
.
_os
);
}
private
_getAriaLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
...
...
@@ -86,12 +80,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
}
public
getAriaLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getAriaLabelForKeybinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getAriaLabelForKeybinding
(
this
.
_chordPart
);
return
AriaLabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
this
.
_os
);
}
private
_keyCodeToElectronAccelerator
(
keyCode
:
KeyCode
):
string
{
if
(
keyCode
>=
KeyCode
.
NUMPAD_0
&&
keyCode
<=
KeyCode
.
NUMPAD_DIVIDE
)
{
// Electron cannot handle numpad keys
...
...
@@ -157,34 +145,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
return
(
this
.
_chordPart
?
true
:
false
);
}
public
hasCtrlModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
ctrlKey
;
}
public
hasShiftModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
shiftKey
;
}
public
hasAltModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
altKey
;
}
public
hasMetaModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
metaKey
;
}
public
getParts
():
[
ResolvedKeybindingPart
,
ResolvedKeybindingPart
]
{
return
[
this
.
_toResolvedKeybindingPart
(
this
.
_firstPart
),
...
...
src/vs/platform/keybinding/test/common/keybindingLabels.test.ts
浏览文件 @
c688f7c5
...
...
@@ -16,25 +16,15 @@ suite('KeybindingLabels', () => {
assert
.
equal
(
usResolvedKeybinding
.
getLabel
(),
expected
);
}
function
assertUSLabelWithoutModifiers
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getLabelWithoutModifiers
(),
expected
);
}
test
(
'
Windows US label
'
,
()
=>
{
// no modifier
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyCode
.
KEY_A
,
'
A
'
);
// one modifier
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
Ctrl+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
Shift+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// two modifiers
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+A
'
);
...
...
@@ -43,46 +33,29 @@ suite('KeybindingLabels', () => {
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Shift+Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Shift+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// three modifiers
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Alt+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Shift+Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// four modifiers
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// chord
assertUSLabel
(
OperatingSystem
.
Windows
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
Ctrl+A Ctrl+B
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
A B
'
);
});
test
(
'
Linux US label
'
,
()
=>
{
// no modifier
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyCode
.
KEY_A
,
'
A
'
);
// one modifier
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
Ctrl+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
Shift+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// two modifiers
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+A
'
);
...
...
@@ -91,46 +64,29 @@ suite('KeybindingLabels', () => {
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Shift+Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Shift+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// three modifiers
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Alt+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Alt+Windows+A
'
);
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Shift+Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// four modifiers
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Ctrl+Shift+Alt+Windows+A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// chord
assertUSLabel
(
OperatingSystem
.
Linux
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
Ctrl+A Ctrl+B
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
A B
'
);
});
test
(
'
Mac US label
'
,
()
=>
{
// no modifier
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyCode
.
KEY_A
,
'
A
'
);
// one modifier
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
⌘A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
⇧A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
⌥A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// two modifiers
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
⇧⌘A
'
);
...
...
@@ -139,30 +95,18 @@ suite('KeybindingLabels', () => {
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
⇧⌥A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⇧A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⌥A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// three modifiers
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
⇧⌥⌘A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⇧⌘A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⌥⌘A
'
);
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⇧⌥A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// four modifiers
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
⌃⇧⌥⌘A
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
// chord
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
⌘A ⌘B
'
);
assertUSLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_A
,
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_B
),
'
A B
'
);
// special keys
assertUSLabel
(
OperatingSystem
.
Macintosh
,
KeyCode
.
LeftArrow
,
'
←
'
);
...
...
@@ -176,17 +120,10 @@ suite('KeybindingLabels', () => {
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getAriaLabel
(),
expected
);
}
function
assertAriaLabelWithoutModifiers
(
OS
:
OperatingSystem
,
keybinding
:
number
,
expected
:
string
):
void
{
const
usResolvedKeybinding
=
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
),
OS
);
assert
.
equal
(
usResolvedKeybinding
.
getAriaLabelWithoutModifiers
(),
expected
);
}
assertAriaLabel
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Control+Shift+Alt+Windows+A
'
);
assertAriaLabel
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Control+Shift+Alt+Windows+A
'
);
assertAriaLabel
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
Control+Shift+Alt+Command+A
'
);
assertAriaLabelWithoutModifiers
(
OperatingSystem
.
Windows
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertAriaLabelWithoutModifiers
(
OperatingSystem
.
Linux
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
assertAriaLabelWithoutModifiers
(
OperatingSystem
.
Macintosh
,
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyMod
.
WinCtrl
|
KeyCode
.
KEY_A
,
'
A
'
);
});
test
(
'
Electron Accelerator label
'
,
()
=>
{
...
...
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
c688f7c5
...
...
@@ -198,7 +198,13 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
return
super
.
getAutoFocus
(
searchValue
);
}
const
isShiftNavigate
=
(
quickNavigateConfiguration
&&
quickNavigateConfiguration
.
keybindings
.
some
(
k
=>
!
k
.
isChord
()
&&
k
.
hasShiftModifier
()));
const
isShiftNavigate
=
(
quickNavigateConfiguration
&&
quickNavigateConfiguration
.
keybindings
.
some
(
k
=>
{
const
[
firstPart
,
chordPart
]
=
k
.
getParts
();
if
(
chordPart
)
{
return
false
;
}
return
firstPart
.
shiftKey
;
}));
if
(
isShiftNavigate
)
{
return
{
autoFocusLastEntry
:
true
...
...
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
浏览文件 @
c688f7c5
...
...
@@ -9,7 +9,7 @@ import { OperatingSystem } from 'vs/base/common/platform';
import
{
KeyCode
,
ResolvedKeybinding
,
KeyCodeUtils
,
SimpleKeybinding
,
Keybinding
,
KeybindingType
,
USER_SETTINGS
,
ResolvedKeybindingPart
}
from
'
vs/base/common/keyCodes
'
;
import
{
ScanCode
,
ScanCodeUtils
,
IMMUTABLE_CODE_TO_KEY_CODE
,
IMMUTABLE_KEY_CODE_TO_CODE
,
ScanCodeBinding
}
from
'
vs/workbench/services/keybinding/common/scanCode
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
UserSettingsLabelProvider
,
ElectronAcceleratorLabelProvider
,
NO_MODIFIERS
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
UserSettingsLabelProvider
,
ElectronAcceleratorLabelProvider
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
IKeyboardMapper
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
import
{
IKeyboardEvent
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -103,12 +103,6 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
public
getLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getUILabelForScanCodeBinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getUILabelForScanCodeBinding
(
this
.
_chordPart
);
return
UILabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
this
.
_OS
);
}
private
_getAriaLabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
...
...
@@ -125,12 +119,6 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
public
getAriaLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getAriaLabelForScanCodeBinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getAriaLabelForScanCodeBinding
(
this
.
_chordPart
);
return
AriaLabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
this
.
_OS
);
}
private
_getElectronAcceleratorLabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
...
...
@@ -194,34 +182,6 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
return
(
this
.
_chordPart
?
true
:
false
);
}
public
hasCtrlModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
ctrlKey
;
}
public
hasShiftModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
shiftKey
;
}
public
hasAltModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
altKey
;
}
public
hasMetaModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
metaKey
;
}
public
getParts
():
[
ResolvedKeybindingPart
,
ResolvedKeybindingPart
]
{
return
[
this
.
_toResolvedKeybindingPart
(
this
.
_firstPart
),
...
...
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
浏览文件 @
c688f7c5
...
...
@@ -8,7 +8,7 @@
import
{
KeyCode
,
KeyCodeUtils
,
ResolvedKeybinding
,
Keybinding
,
SimpleKeybinding
,
KeybindingType
,
USER_SETTINGS
,
ResolvedKeybindingPart
}
from
'
vs/base/common/keyCodes
'
;
import
{
ScanCode
,
ScanCodeUtils
,
IMMUTABLE_CODE_TO_KEY_CODE
,
ScanCodeBinding
}
from
'
vs/workbench/services/keybinding/common/scanCode
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
,
NO_MODIFIERS
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IKeyboardMapper
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
import
{
IKeyboardEvent
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -107,12 +107,6 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
}
public
getLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getUILabelForKeybinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getUILabelForKeybinding
(
this
.
_chordPart
);
return
UILabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
OperatingSystem
.
Windows
);
}
private
_getAriaLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
...
...
@@ -129,12 +123,6 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
}
public
getAriaLabelWithoutModifiers
():
string
{
let
firstPart
=
this
.
_getAriaLabelForKeybinding
(
this
.
_firstPart
);
let
chordPart
=
this
.
_getAriaLabelForKeybinding
(
this
.
_chordPart
);
return
AriaLabelProvider
.
toLabel
(
NO_MODIFIERS
,
firstPart
,
NO_MODIFIERS
,
chordPart
,
OperatingSystem
.
Windows
);
}
private
_keyCodeToElectronAccelerator
(
keyCode
:
KeyCode
):
string
{
if
(
keyCode
>=
KeyCode
.
NUMPAD_0
&&
keyCode
<=
KeyCode
.
NUMPAD_DIVIDE
)
{
// Electron cannot handle numpad keys
...
...
@@ -207,34 +195,6 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
return
(
this
.
_chordPart
?
true
:
false
);
}
public
hasCtrlModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
ctrlKey
;
}
public
hasShiftModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
shiftKey
;
}
public
hasAltModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
altKey
;
}
public
hasMetaModifier
():
boolean
{
if
(
this
.
_chordPart
)
{
return
false
;
}
return
this
.
_firstPart
.
metaKey
;
}
public
getParts
():
[
ResolvedKeybindingPart
,
ResolvedKeybindingPart
]
{
return
[
this
.
_toResolvedKeybindingPart
(
this
.
_firstPart
),
...
...
src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts
浏览文件 @
c688f7c5
...
...
@@ -17,34 +17,22 @@ import { ScanCodeBinding } from 'vs/workbench/services/keybinding/common/scanCod
export
interface
IResolvedKeybinding
{
label
:
string
;
labelWithoutModifiers
:
string
;
ariaLabel
:
string
;
ariaLabelWithoutModifiers
:
string
;
electronAccelerator
:
string
;
userSettingsLabel
:
string
;
isWYSIWYG
:
boolean
;
isChord
:
boolean
;
hasCtrlModifier
:
boolean
;
hasShiftModifier
:
boolean
;
hasAltModifier
:
boolean
;
hasMetaModifier
:
boolean
;
dispatchParts
:
[
string
,
string
];
}
function
toIResolvedKeybinding
(
kb
:
ResolvedKeybinding
):
IResolvedKeybinding
{
return
{
label
:
kb
.
getLabel
(),
labelWithoutModifiers
:
kb
.
getLabelWithoutModifiers
(),
ariaLabel
:
kb
.
getAriaLabel
(),
ariaLabelWithoutModifiers
:
kb
.
getAriaLabelWithoutModifiers
(),
electronAccelerator
:
kb
.
getElectronAccelerator
(),
userSettingsLabel
:
kb
.
getUserSettingsLabel
(),
isWYSIWYG
:
kb
.
isWYSIWYG
(),
isChord
:
kb
.
isChord
(),
hasCtrlModifier
:
kb
.
hasCtrlModifier
(),
hasShiftModifier
:
kb
.
hasShiftModifier
(),
hasAltModifier
:
kb
.
hasAltModifier
(),
hasMetaModifier
:
kb
.
hasMetaModifier
(),
dispatchParts
:
kb
.
getDispatchParts
(),
};
}
...
...
src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
浏览文件 @
c688f7c5
...
...
@@ -25,16 +25,10 @@ suite('keyboardMapper - MAC fallback', () => {
[{
label
:
'
⌘Z
'
,
ariaLabel
:
'
Command+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Cmd+Z
'
,
userSettingsLabel
:
'
cmd+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
'
meta+Z
'
,
null
],
}]
);
...
...
@@ -46,16 +40,10 @@ suite('keyboardMapper - MAC fallback', () => {
[{
label
:
'
⌘K ⌘=
'
,
ariaLabel
:
'
Command+K Command+=
'
,
labelWithoutModifiers
:
'
K =
'
,
ariaLabelWithoutModifiers
:
'
K =
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+k cmd+=
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
meta+K
'
,
'
meta+=
'
],
}]
);
...
...
@@ -75,16 +63,10 @@ suite('keyboardMapper - MAC fallback', () => {
{
label
:
'
⌘Z
'
,
ariaLabel
:
'
Command+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Cmd+Z
'
,
userSettingsLabel
:
'
cmd+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
'
meta+Z
'
,
null
],
}
);
...
...
@@ -98,16 +80,10 @@ suite('keyboardMapper - MAC fallback', () => {
[{
label
:
'
⌘, ⌘/
'
,
ariaLabel
:
'
Command+, Command+/
'
,
labelWithoutModifiers
:
'
, /
'
,
ariaLabelWithoutModifiers
:
'
, /
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+, cmd+/
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
meta+,
'
,
'
meta+/
'
],
}]
);
...
...
@@ -127,16 +103,10 @@ suite('keyboardMapper - MAC fallback', () => {
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
labelWithoutModifiers
:
''
,
ariaLabelWithoutModifiers
:
''
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
...
...
@@ -157,16 +127,10 @@ suite('keyboardMapper - LINUX fallback', () => {
[{
label
:
'
Ctrl+Z
'
,
ariaLabel
:
'
Control+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Ctrl+Z
'
,
userSettingsLabel
:
'
ctrl+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Z
'
,
null
],
}]
);
...
...
@@ -178,16 +142,10 @@ suite('keyboardMapper - LINUX fallback', () => {
[{
label
:
'
Ctrl+K Ctrl+=
'
,
ariaLabel
:
'
Control+K Control+=
'
,
labelWithoutModifiers
:
'
K =
'
,
ariaLabelWithoutModifiers
:
'
K =
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+k ctrl+=
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+K
'
,
'
ctrl+=
'
],
}]
);
...
...
@@ -207,16 +165,10 @@ suite('keyboardMapper - LINUX fallback', () => {
{
label
:
'
Ctrl+Z
'
,
ariaLabel
:
'
Control+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Ctrl+Z
'
,
userSettingsLabel
:
'
ctrl+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Z
'
,
null
],
}
);
...
...
@@ -230,16 +182,10 @@ suite('keyboardMapper - LINUX fallback', () => {
[{
label
:
'
Ctrl+, Ctrl+/
'
,
ariaLabel
:
'
Control+, Control+/
'
,
labelWithoutModifiers
:
'
, /
'
,
ariaLabelWithoutModifiers
:
'
, /
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+, ctrl+/
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+,
'
,
'
ctrl+/
'
],
}]
);
...
...
@@ -253,16 +199,10 @@ suite('keyboardMapper - LINUX fallback', () => {
[{
label
:
'
Ctrl+,
'
,
ariaLabel
:
'
Control+,
'
,
labelWithoutModifiers
:
'
,
'
,
ariaLabelWithoutModifiers
:
'
,
'
,
electronAccelerator
:
'
Ctrl+,
'
,
userSettingsLabel
:
'
ctrl+,
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+,
'
,
null
],
}]
);
...
...
@@ -282,16 +222,10 @@ suite('keyboardMapper - LINUX fallback', () => {
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
labelWithoutModifiers
:
''
,
ariaLabelWithoutModifiers
:
''
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
...
...
src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts
浏览文件 @
c688f7c5
此差异已折叠。
点击以展开。
src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts
浏览文件 @
c688f7c5
...
...
@@ -46,16 +46,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+A
'
,
ariaLabel
:
'
Control+A
'
,
labelWithoutModifiers
:
'
A
'
,
ariaLabelWithoutModifiers
:
'
A
'
,
electronAccelerator
:
'
Ctrl+A
'
,
userSettingsLabel
:
'
ctrl+a
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+A
'
,
null
],
}]
);
...
...
@@ -68,16 +62,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+Z
'
,
ariaLabel
:
'
Control+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Ctrl+Z
'
,
userSettingsLabel
:
'
ctrl+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Z
'
,
null
],
}]
);
...
...
@@ -97,16 +85,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
{
label
:
'
Ctrl+Z
'
,
ariaLabel
:
'
Control+Z
'
,
labelWithoutModifiers
:
'
Z
'
,
ariaLabelWithoutModifiers
:
'
Z
'
,
electronAccelerator
:
'
Ctrl+Z
'
,
userSettingsLabel
:
'
ctrl+z
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Z
'
,
null
],
}
);
...
...
@@ -119,16 +101,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+^
'
,
ariaLabel
:
'
Control+^
'
,
labelWithoutModifiers
:
'
^
'
,
ariaLabelWithoutModifiers
:
'
^
'
,
electronAccelerator
:
'
Ctrl+]
'
,
userSettingsLabel
:
'
ctrl+]
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+]
'
,
null
],
}]
);
...
...
@@ -148,16 +124,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
{
label
:
'
Ctrl+^
'
,
ariaLabel
:
'
Control+^
'
,
labelWithoutModifiers
:
'
^
'
,
ariaLabelWithoutModifiers
:
'
^
'
,
electronAccelerator
:
'
Ctrl+]
'
,
userSettingsLabel
:
'
ctrl+]
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+]
'
,
null
],
}
);
...
...
@@ -170,16 +140,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Shift+^
'
,
ariaLabel
:
'
Shift+^
'
,
labelWithoutModifiers
:
'
^
'
,
ariaLabelWithoutModifiers
:
'
^
'
,
electronAccelerator
:
'
Shift+]
'
,
userSettingsLabel
:
'
shift+]
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
true
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
shift+]
'
,
null
],
}]
);
...
...
@@ -192,16 +156,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+§
'
,
ariaLabel
:
'
Control+§
'
,
labelWithoutModifiers
:
'
§
'
,
ariaLabelWithoutModifiers
:
'
§
'
,
electronAccelerator
:
'
Ctrl+/
'
,
userSettingsLabel
:
'
ctrl+/
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+/
'
,
null
],
}]
);
...
...
@@ -214,16 +172,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+Shift+§
'
,
ariaLabel
:
'
Control+Shift+§
'
,
labelWithoutModifiers
:
'
§
'
,
ariaLabelWithoutModifiers
:
'
§
'
,
electronAccelerator
:
'
Ctrl+Shift+/
'
,
userSettingsLabel
:
'
ctrl+shift+/
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
true
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+shift+/
'
,
null
],
}]
);
...
...
@@ -236,16 +188,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+K Ctrl+ä
'
,
ariaLabel
:
'
Control+K Control+ä
'
,
labelWithoutModifiers
:
'
K ä
'
,
ariaLabelWithoutModifiers
:
'
K ä
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+k ctrl+
\\
'
,
isWYSIWYG
:
false
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+K
'
,
'
ctrl+
\\
'
],
}]
);
...
...
@@ -266,16 +212,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+DownArrow
'
,
ariaLabel
:
'
Control+DownArrow
'
,
labelWithoutModifiers
:
'
DownArrow
'
,
ariaLabelWithoutModifiers
:
'
DownArrow
'
,
electronAccelerator
:
'
Ctrl+Down
'
,
userSettingsLabel
:
'
ctrl+down
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+DownArrow
'
,
null
],
}]
);
...
...
@@ -288,16 +228,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+NumPad0
'
,
ariaLabel
:
'
Control+NumPad0
'
,
labelWithoutModifiers
:
'
NumPad0
'
,
ariaLabelWithoutModifiers
:
'
NumPad0
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+numpad0
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+NumPad0
'
,
null
],
}]
);
...
...
@@ -310,16 +244,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+Home
'
,
ariaLabel
:
'
Control+Home
'
,
labelWithoutModifiers
:
'
Home
'
,
ariaLabelWithoutModifiers
:
'
Home
'
,
electronAccelerator
:
'
Ctrl+Home
'
,
userSettingsLabel
:
'
ctrl+home
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Home
'
,
null
],
}]
);
...
...
@@ -339,16 +267,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
{
label
:
'
Ctrl+Home
'
,
ariaLabel
:
'
Control+Home
'
,
labelWithoutModifiers
:
'
Home
'
,
ariaLabelWithoutModifiers
:
'
Home
'
,
electronAccelerator
:
'
Ctrl+Home
'
,
userSettingsLabel
:
'
ctrl+home
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+Home
'
,
null
],
}
);
...
...
@@ -362,16 +284,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
[{
label
:
'
Ctrl+, Ctrl+§
'
,
ariaLabel
:
'
Control+, Control+§
'
,
labelWithoutModifiers
:
'
, §
'
,
ariaLabelWithoutModifiers
:
'
, §
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+, ctrl+/
'
,
isWYSIWYG
:
false
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+,
'
,
'
ctrl+/
'
],
}]
);
...
...
@@ -391,16 +307,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
labelWithoutModifiers
:
''
,
ariaLabelWithoutModifiers
:
''
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
...
...
@@ -429,16 +339,10 @@ suite('keyboardMapper - WINDOWS en_us', () => {
[{
label
:
'
Ctrl+K Ctrl+
\\
'
,
ariaLabel
:
'
Control+K Control+
\\
'
,
labelWithoutModifiers
:
'
K
\\
'
,
ariaLabelWithoutModifiers
:
'
K
\\
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+k ctrl+
\\
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+K
'
,
'
ctrl+
\\
'
],
}]
);
...
...
@@ -452,16 +356,10 @@ suite('keyboardMapper - WINDOWS en_us', () => {
[{
label
:
'
Ctrl+, Ctrl+/
'
,
ariaLabel
:
'
Control+, Control+/
'
,
labelWithoutModifiers
:
'
, /
'
,
ariaLabelWithoutModifiers
:
'
, /
'
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+, ctrl+/
'
,
isWYSIWYG
:
true
,
isChord
:
true
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+,
'
,
'
ctrl+/
'
],
}]
);
...
...
@@ -475,16 +373,10 @@ suite('keyboardMapper - WINDOWS en_us', () => {
[{
label
:
'
Ctrl+,
'
,
ariaLabel
:
'
Control+,
'
,
labelWithoutModifiers
:
'
,
'
,
ariaLabelWithoutModifiers
:
'
,
'
,
electronAccelerator
:
'
Ctrl+,
'
,
userSettingsLabel
:
'
ctrl+,
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+,
'
,
null
],
}]
);
...
...
@@ -504,16 +396,10 @@ suite('keyboardMapper - WINDOWS en_us', () => {
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
labelWithoutModifiers
:
''
,
ariaLabelWithoutModifiers
:
''
,
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
...
...
@@ -545,16 +431,10 @@ suite('misc', () => {
[{
label
:
'
Ctrl+لا
'
,
ariaLabel
:
'
Control+لا
'
,
labelWithoutModifiers
:
'
لا
'
,
ariaLabelWithoutModifiers
:
'
لا
'
,
electronAccelerator
:
'
Ctrl+B
'
,
userSettingsLabel
:
'
ctrl+b
'
,
isWYSIWYG
:
false
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
'
ctrl+B
'
,
null
],
}]
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录