Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
310833d1
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,发现更多精彩内容 >>
提交
310833d1
编写于
3月 17, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IKeybindingService cannot give out Keybindings anymore
上级
5e72eec2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
140 addition
and
28 deletion
+140
-28
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+25
-0
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+6
-20
src/vs/base/parts/quickopen/common/quickOpen.ts
src/vs/base/parts/quickopen/common/quickOpen.ts
+2
-2
src/vs/platform/keybinding/common/abstractKeybindingService.ts
...s/platform/keybinding/common/abstractKeybindingService.ts
+42
-2
src/vs/platform/keybinding/common/keybinding.ts
src/vs/platform/keybinding/common/keybinding.ts
+3
-2
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
.../platform/keybinding/test/common/mockKeybindingService.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+1
-1
src/vs/workbench/services/keybinding/common/keyboardMapper.ts
...vs/workbench/services/keybinding/common/keyboardMapper.ts
+20
-0
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
...services/keybinding/electron-browser/keybindingService.ts
+40
-0
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
310833d1
...
...
@@ -592,4 +592,29 @@ export abstract class ResolvedKeybinding {
* This prints the binding in a format suitable for user settings.
*/
public
abstract
getUserSettingsLabel
():
string
;
/**
* 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
;
}
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
浏览文件 @
310833d1
...
...
@@ -252,7 +252,7 @@ export class QuickOpenWidget implements IModelProvider {
return
false
;
}
if
(
k
.
hasShift
()
&&
keyCode
===
KeyCode
.
Shift
)
{
if
(
k
.
hasShift
Modifier
()
&&
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
}
...
...
@@ -260,30 +260,16 @@ export class QuickOpenWidget implements IModelProvider {
return
true
;
}
if
(
k
.
hasAlt
()
&&
keyCode
===
KeyCode
.
Alt
)
{
if
(
k
.
hasAlt
Modifier
()
&&
keyCode
===
KeyCode
.
Alt
)
{
return
true
;
}
// Mac is a bit special
if
(
platform
.
isMacintosh
)
{
if
(
k
.
hasCtrlCmd
()
&&
keyCode
===
KeyCode
.
Meta
)
{
return
true
;
}
if
(
k
.
hasWinCtrl
()
&&
keyCode
===
KeyCode
.
Ctrl
)
{
return
true
;
}
if
(
k
.
hasCtrlModifier
()
&&
keyCode
===
KeyCode
.
Ctrl
)
{
return
true
;
}
// Windows/Linux are not :)
else
{
if
(
k
.
hasCtrlCmd
()
&&
keyCode
===
KeyCode
.
Ctrl
)
{
return
true
;
}
if
(
k
.
hasWinCtrl
()
&&
keyCode
===
KeyCode
.
Meta
)
{
return
true
;
}
if
(
k
.
hasMetaModifier
()
&&
keyCode
===
KeyCode
.
Meta
)
{
return
true
;
}
return
false
;
...
...
src/vs/base/parts/quickopen/common/quickOpen.ts
浏览文件 @
310833d1
...
...
@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
Resolved
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
export
interface
IQuickNavigateConfiguration
{
keybindings
:
Keybinding
[];
keybindings
:
Resolved
Keybinding
[];
}
export
interface
IAutoFocus
{
...
...
src/vs/platform/keybinding/common/abstractKeybindingService.ts
浏览文件 @
310833d1
...
...
@@ -109,6 +109,46 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
let
result
=
UserSettingsLabelProvider
.
toLabel2
(
firstPart
,
chordPart
,
this
.
_os
);
return
result
.
toLowerCase
();
}
public
isChord
():
boolean
{
return
this
.
_actual
.
isChord
();
}
public
hasCtrlModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
if
(
this
.
_os
===
OperatingSystem
.
Macintosh
)
{
return
this
.
_actual
.
hasWinCtrl
();
}
else
{
return
this
.
_actual
.
hasCtrlCmd
();
}
}
public
hasShiftModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
return
this
.
_actual
.
hasShift
();
}
public
hasAltModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
return
this
.
_actual
.
hasAlt
();
}
public
hasMetaModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
if
(
this
.
_os
===
OperatingSystem
.
Macintosh
)
{
return
this
.
_actual
.
hasCtrlCmd
();
}
else
{
return
this
.
_actual
.
hasWinCtrl
();
}
}
}
interface
CurrentChord
{
...
...
@@ -179,8 +219,8 @@ export abstract class AbstractKeybindingService implements IKeybindingService {
return
0
;
}
public
lookupKeybindings
(
commandId
:
string
):
Keybinding
[]
{
return
this
.
_getResolver
().
lookupKeybindings
(
commandId
).
map
(
item
=>
item
.
keybinding
);
public
lookupKeybindings
(
commandId
:
string
):
Resolved
Keybinding
[]
{
return
this
.
_getResolver
().
lookupKeybindings
(
commandId
).
map
(
item
=>
this
.
_createResolvedKeybinding
(
item
.
keybinding
)
);
}
public
lookupKeybinding
(
commandId
:
string
):
ResolvedKeybinding
{
...
...
src/vs/platform/keybinding/common/keybinding.ts
浏览文件 @
310833d1
...
...
@@ -74,9 +74,10 @@ export interface IKeybindingService {
getKeybindings
():
IKeybindingItem2
[];
/**
* @deprecated
* Look up keybindings for a command.
* Use `lookupKeybinding` if you are interested in the preferred keybinding.
*/
lookupKeybindings
(
commandId
:
string
):
Keybinding
[];
lookupKeybindings
(
commandId
:
string
):
Resolved
Keybinding
[];
/**
* Look up the preferred (last defined) keybinding for a command.
...
...
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
浏览文件 @
310833d1
...
...
@@ -80,7 +80,7 @@ export class MockKeybindingService2 implements IKeybindingService {
return
new
USLayoutResolvedKeybinding
(
keybinding
,
OS
);
}
public
lookupKeybindings
(
commandId
:
string
):
Keybinding
[]
{
public
lookupKeybindings
(
commandId
:
string
):
Resolved
Keybinding
[]
{
return
[];
}
...
...
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
310833d1
...
...
@@ -198,7 +198,7 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
return
super
.
getAutoFocus
(
searchValue
);
}
const
isShiftNavigate
=
(
quickNavigateConfiguration
&&
quickNavigateConfiguration
.
keybindings
.
some
(
k
=>
!
k
.
isChord
()
&&
k
.
hasShift
()));
const
isShiftNavigate
=
(
quickNavigateConfiguration
&&
quickNavigateConfiguration
.
keybindings
.
some
(
k
=>
!
k
.
isChord
()
&&
k
.
hasShift
Modifier
()));
if
(
isShiftNavigate
)
{
return
{
autoFocusLastEntry
:
true
...
...
src/vs/workbench/services/keybinding/common/keyboardMapper.ts
浏览文件 @
310833d1
...
...
@@ -117,6 +117,26 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
throw
new
Error
(
'
TODO!
'
);
// return KeybindingIO.writeKeybinding(this._actual, OS);
}
public
isChord
():
boolean
{
throw
new
Error
(
'
TODO!
'
);
}
public
hasCtrlModifier
():
boolean
{
throw
new
Error
(
'
TODO!
'
);
}
public
hasShiftModifier
():
boolean
{
throw
new
Error
(
'
TODO!
'
);
}
public
hasAltModifier
():
boolean
{
throw
new
Error
(
'
TODO!
'
);
}
public
hasMetaModifier
():
boolean
{
throw
new
Error
(
'
TODO!
'
);
}
}
interface
IHardwareCodeMapping
{
...
...
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
浏览文件 @
310833d1
...
...
@@ -172,6 +172,46 @@ export class FancyResolvedKeybinding extends ResolvedKeybinding {
public
getUserSettingsLabel
():
string
{
return
KeybindingIO
.
writeKeybinding
(
this
.
_actual
,
OS
);
}
public
isChord
():
boolean
{
return
this
.
_actual
.
isChord
();
}
public
hasCtrlModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
if
(
OS
===
OperatingSystem
.
Macintosh
)
{
return
this
.
_actual
.
hasWinCtrl
();
}
else
{
return
this
.
_actual
.
hasCtrlCmd
();
}
}
public
hasShiftModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
return
this
.
_actual
.
hasShift
();
}
public
hasAltModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
return
this
.
_actual
.
hasAlt
();
}
public
hasMetaModifier
():
boolean
{
if
(
this
.
_actual
.
isChord
())
{
return
false
;
}
if
(
OS
===
OperatingSystem
.
Macintosh
)
{
return
this
.
_actual
.
hasCtrlCmd
();
}
else
{
return
this
.
_actual
.
hasWinCtrl
();
}
}
}
export
class
WorkbenchKeybindingService
extends
AbstractKeybindingService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录