Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2c4b5b42
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,发现更多精彩内容 >>
提交
2c4b5b42
编写于
2月 18, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract BaseResolvedKeybinding to its own file
上级
79b4ea25
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
84 addition
and
73 deletion
+84
-73
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+0
-70
src/vs/platform/keybinding/common/baseResolvedKeybinding.ts
src/vs/platform/keybinding/common/baseResolvedKeybinding.ts
+78
-0
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
.../platform/keybinding/common/usLayoutResolvedKeybinding.ts
+2
-1
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
...ench/services/keybinding/common/macLinuxKeyboardMapper.ts
+2
-1
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
...bench/services/keybinding/common/windowsKeyboardMapper.ts
+2
-1
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
2c4b5b42
...
...
@@ -5,7 +5,6 @@
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
Modifiers
,
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
}
from
'
vs/base/common/keybindingLabels
'
;
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
...
...
@@ -601,72 +600,3 @@ export abstract class ResolvedKeybinding {
*/
public
abstract
getDispatchParts
():
(
string
|
null
)[];
}
export
abstract
class
BaseResolvedKeybinding
<
T
extends
Modifiers
>
extends
ResolvedKeybinding
{
protected
readonly
_os
:
OperatingSystem
;
protected
readonly
_parts
:
T
[];
constructor
(
os
:
OperatingSystem
,
parts
:
T
[])
{
super
();
if
(
parts
.
length
===
0
)
{
throw
illegalArgument
(
`parts`
);
}
this
.
_os
=
os
;
this
.
_parts
=
parts
;
}
public
getLabel
():
string
|
null
{
return
UILabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getLabel
(
keybinding
));
}
public
getAriaLabel
():
string
|
null
{
return
AriaLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getAriaLabel
(
keybinding
));
}
public
getElectronAccelerator
():
string
|
null
{
if
(
this
.
_parts
.
length
>
1
)
{
// Electron cannot handle chords
return
null
;
}
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getElectronAccelerator
(
keybinding
));
}
public
getUserSettingsLabel
():
string
|
null
{
return
UserSettingsLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getUserSettingsLabel
(
keybinding
));
}
public
isWYSIWYG
():
boolean
{
return
this
.
_parts
.
every
((
keybinding
)
=>
this
.
_isWYSIWYG
(
keybinding
));
}
public
isChord
():
boolean
{
return
(
this
.
_parts
.
length
>
1
);
}
public
getParts
():
ResolvedKeybindingPart
[]
{
return
this
.
_parts
.
map
((
keybinding
)
=>
this
.
_getPart
(
keybinding
));
}
private
_getPart
(
keybinding
:
T
):
ResolvedKeybindingPart
{
return
new
ResolvedKeybindingPart
(
keybinding
.
ctrlKey
,
keybinding
.
shiftKey
,
keybinding
.
altKey
,
keybinding
.
metaKey
,
this
.
_getLabel
(
keybinding
),
this
.
_getAriaLabel
(
keybinding
)
);
}
public
getDispatchParts
():
(
string
|
null
)[]
{
return
this
.
_parts
.
map
((
keybinding
)
=>
this
.
_getDispatchPart
(
keybinding
));
}
protected
abstract
_getLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getAriaLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getElectronAccelerator
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getUserSettingsLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_isWYSIWYG
(
keybinding
:
T
):
boolean
;
protected
abstract
_getDispatchPart
(
keybinding
:
T
):
string
|
null
;
}
src/vs/platform/keybinding/common/baseResolvedKeybinding.ts
0 → 100644
浏览文件 @
2c4b5b42
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
Modifiers
,
UILabelProvider
,
AriaLabelProvider
,
ElectronAcceleratorLabelProvider
,
UserSettingsLabelProvider
}
from
'
vs/base/common/keybindingLabels
'
;
import
{
ResolvedKeybinding
,
ResolvedKeybindingPart
}
from
'
vs/base/common/keyCodes
'
;
export
abstract
class
BaseResolvedKeybinding
<
T
extends
Modifiers
>
extends
ResolvedKeybinding
{
protected
readonly
_os
:
OperatingSystem
;
protected
readonly
_parts
:
T
[];
constructor
(
os
:
OperatingSystem
,
parts
:
T
[])
{
super
();
if
(
parts
.
length
===
0
)
{
throw
illegalArgument
(
`parts`
);
}
this
.
_os
=
os
;
this
.
_parts
=
parts
;
}
public
getLabel
():
string
|
null
{
return
UILabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getLabel
(
keybinding
));
}
public
getAriaLabel
():
string
|
null
{
return
AriaLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getAriaLabel
(
keybinding
));
}
public
getElectronAccelerator
():
string
|
null
{
if
(
this
.
_parts
.
length
>
1
)
{
// Electron cannot handle chords
return
null
;
}
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getElectronAccelerator
(
keybinding
));
}
public
getUserSettingsLabel
():
string
|
null
{
return
UserSettingsLabelProvider
.
toLabel
(
this
.
_os
,
this
.
_parts
,
(
keybinding
)
=>
this
.
_getUserSettingsLabel
(
keybinding
));
}
public
isWYSIWYG
():
boolean
{
return
this
.
_parts
.
every
((
keybinding
)
=>
this
.
_isWYSIWYG
(
keybinding
));
}
public
isChord
():
boolean
{
return
(
this
.
_parts
.
length
>
1
);
}
public
getParts
():
ResolvedKeybindingPart
[]
{
return
this
.
_parts
.
map
((
keybinding
)
=>
this
.
_getPart
(
keybinding
));
}
private
_getPart
(
keybinding
:
T
):
ResolvedKeybindingPart
{
return
new
ResolvedKeybindingPart
(
keybinding
.
ctrlKey
,
keybinding
.
shiftKey
,
keybinding
.
altKey
,
keybinding
.
metaKey
,
this
.
_getLabel
(
keybinding
),
this
.
_getAriaLabel
(
keybinding
)
);
}
public
getDispatchParts
():
(
string
|
null
)[]
{
return
this
.
_parts
.
map
((
keybinding
)
=>
this
.
_getDispatchPart
(
keybinding
));
}
protected
abstract
_getLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getAriaLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getElectronAccelerator
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_getUserSettingsLabel
(
keybinding
:
T
):
string
|
null
;
protected
abstract
_isWYSIWYG
(
keybinding
:
T
):
boolean
;
protected
abstract
_getDispatchPart
(
keybinding
:
T
):
string
|
null
;
}
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
浏览文件 @
2c4b5b42
...
...
@@ -3,8 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
SimpleKeybinding
,
BaseResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
SimpleKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
BaseResolvedKeybinding
}
from
'
vs/platform/keybinding/common/baseResolvedKeybinding
'
;
/**
* Do not instantiate. Use KeybindingService to get a ResolvedKeybinding seeded with information about the current kb layout.
...
...
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
浏览文件 @
2c4b5b42
...
...
@@ -4,11 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
ResolvedKeybinding
,
SimpleKeybinding
,
BaseResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
ResolvedKeybinding
,
SimpleKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IMMUTABLE_CODE_TO_KEY_CODE
,
IMMUTABLE_KEY_CODE_TO_CODE
,
ScanCode
,
ScanCodeBinding
,
ScanCodeUtils
}
from
'
vs/base/common/scanCode
'
;
import
{
IKeyboardEvent
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeyboardMapper
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
import
{
BaseResolvedKeybinding
}
from
'
vs/platform/keybinding/common/baseResolvedKeybinding
'
;
export
interface
IMacLinuxKeyMapping
{
value
:
string
;
...
...
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
浏览文件 @
2c4b5b42
...
...
@@ -4,12 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
ResolvedKeybinding
,
SimpleKeybinding
,
BaseResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyCodeUtils
,
Keybinding
,
ResolvedKeybinding
,
SimpleKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
UILabelProvider
}
from
'
vs/base/common/keybindingLabels
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IMMUTABLE_CODE_TO_KEY_CODE
,
ScanCode
,
ScanCodeBinding
,
ScanCodeUtils
}
from
'
vs/base/common/scanCode
'
;
import
{
IKeyboardEvent
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeyboardMapper
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
import
{
BaseResolvedKeybinding
}
from
'
vs/platform/keybinding/common/baseResolvedKeybinding
'
;
export
interface
IWindowsKeyMapping
{
vkey
:
string
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录