Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4ce2cdd6
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,发现更多精彩内容 >>
提交
4ce2cdd6
编写于
5月 14, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ResolvedKeybindingItem as undefined instead of null
上级
aeb7669f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
12 addition
and
13 deletion
+12
-13
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+1
-1
src/vs/platform/keybinding/common/abstractKeybindingService.ts
...s/platform/keybinding/common/abstractKeybindingService.ts
+2
-3
src/vs/platform/keybinding/common/resolvedKeybindingItem.ts
src/vs/platform/keybinding/common/resolvedKeybindingItem.ts
+2
-2
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
.../keybinding/test/common/abstractKeybindingService.test.ts
+1
-1
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
...latform/keybinding/test/common/keybindingResolver.test.ts
+1
-1
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
...services/keybinding/electron-browser/keybindingService.ts
+2
-2
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
...eybinding/test/electron-browser/keybindingEditing.test.ts
+1
-1
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
...nch/services/preferences/common/keybindingsEditorModel.ts
+1
-1
src/vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts
...es/preferences/test/common/keybindingsEditorModel.test.ts
+1
-1
未找到文件。
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
4ce2cdd6
...
...
@@ -352,7 +352,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
if
(
!
keybinding
)
{
// This might be a removal keybinding item in user settings => accept it
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
null
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
undefined
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
}
else
{
const
resolvedKeybindings
=
this
.
resolveKeybinding
(
keybinding
);
for
(
const
resolvedKeybinding
of
resolvedKeybindings
)
{
...
...
src/vs/platform/keybinding/common/abstractKeybindingService.ts
浏览文件 @
4ce2cdd6
...
...
@@ -17,7 +17,6 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
interface
CurrentChord
{
keypress
:
string
;
...
...
@@ -96,11 +95,11 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
}
public
lookupKeybinding
(
commandId
:
string
):
ResolvedKeybinding
|
undefined
{
le
t
result
=
this
.
_getResolver
().
lookupPrimaryKeybinding
(
commandId
);
cons
t
result
=
this
.
_getResolver
().
lookupPrimaryKeybinding
(
commandId
);
if
(
!
result
)
{
return
undefined
;
}
return
withNullAsUndefined
(
result
.
resolvedKeybinding
)
;
return
result
.
resolvedKeybinding
;
}
public
dispatchEvent
(
e
:
IKeyboardEvent
,
target
:
IContextKeyServiceTarget
):
boolean
{
...
...
src/vs/platform/keybinding/common/resolvedKeybindingItem.ts
浏览文件 @
4ce2cdd6
...
...
@@ -10,7 +10,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
export
class
ResolvedKeybindingItem
{
_resolvedKeybindingItemBrand
:
void
;
public
readonly
resolvedKeybinding
:
ResolvedKeybinding
|
null
;
public
readonly
resolvedKeybinding
:
ResolvedKeybinding
|
undefined
;
public
readonly
keypressParts
:
string
[];
public
readonly
bubble
:
boolean
;
public
readonly
command
:
string
|
null
;
...
...
@@ -18,7 +18,7 @@ export class ResolvedKeybindingItem {
public
readonly
when
:
ContextKeyExpr
|
undefined
;
public
readonly
isDefault
:
boolean
;
constructor
(
resolvedKeybinding
:
ResolvedKeybinding
|
null
,
command
:
string
|
null
,
commandArgs
:
any
,
when
:
ContextKeyExpr
|
undefined
,
isDefault
:
boolean
)
{
constructor
(
resolvedKeybinding
:
ResolvedKeybinding
|
undefined
,
command
:
string
|
null
,
commandArgs
:
any
,
when
:
ContextKeyExpr
|
undefined
,
isDefault
:
boolean
)
{
this
.
resolvedKeybinding
=
resolvedKeybinding
;
this
.
keypressParts
=
resolvedKeybinding
?
removeElementsAfterNulls
(
resolvedKeybinding
.
getDispatchParts
())
:
[];
this
.
bubble
=
(
command
?
command
.
charCodeAt
(
0
)
===
CharCode
.
Caret
:
false
);
...
...
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
浏览文件 @
4ce2cdd6
...
...
@@ -180,7 +180,7 @@ suite('AbstractKeybindingService', () => {
});
function
kbItem
(
keybinding
:
number
,
command
:
string
,
when
?:
ContextKeyExpr
):
ResolvedKeybindingItem
{
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
)
!
,
OS
)
:
null
);
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
)
!
,
OS
)
:
undefined
);
return
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
command
,
...
...
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
浏览文件 @
4ce2cdd6
...
...
@@ -21,7 +21,7 @@ function createContext(ctx: any) {
suite
(
'
KeybindingResolver
'
,
()
=>
{
function
kbItem
(
keybinding
:
number
,
command
:
string
,
commandArgs
:
any
,
when
:
ContextKeyExpr
,
isDefault
:
boolean
):
ResolvedKeybindingItem
{
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
)
!
,
OS
)
:
null
);
const
resolvedKeybinding
=
(
keybinding
!==
0
?
new
USLayoutResolvedKeybinding
(
createKeybinding
(
keybinding
,
OS
)
!
,
OS
)
:
undefined
);
return
new
ResolvedKeybindingItem
(
resolvedKeybinding
,
command
,
...
...
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
浏览文件 @
4ce2cdd6
...
...
@@ -396,7 +396,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
const
keybinding
=
item
.
keybinding
;
if
(
!
keybinding
)
{
// This might be a removal keybinding item in user settings => accept it
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
null
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
undefined
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
}
else
{
const
resolvedKeybindings
=
this
.
resolveKeybinding
(
keybinding
);
for
(
const
resolvedKeybinding
of
resolvedKeybindings
)
{
...
...
@@ -415,7 +415,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
const
parts
=
item
.
parts
;
if
(
parts
.
length
===
0
)
{
// This might be a removal keybinding item in user settings => accept it
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
null
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
result
[
resultLen
++
]
=
new
ResolvedKeybindingItem
(
undefined
,
item
.
command
,
item
.
commandArgs
,
when
,
isDefault
);
}
else
{
const
resolvedKeybindings
=
this
.
_keyboardMapper
.
resolveUserBinding
(
parts
);
for
(
const
resolvedKeybinding
of
resolvedKeybindings
)
{
...
...
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
浏览文件 @
4ce2cdd6
...
...
@@ -274,7 +274,7 @@ suite('KeybindingsEditing', () => {
parts
.
push
(
aSimpleKeybinding
(
chordPart
));
}
}
let
keybinding
=
parts
.
length
>
0
?
new
USLayoutResolvedKeybinding
(
new
ChordKeybinding
(
parts
),
OS
)
:
null
;
const
keybinding
=
parts
.
length
>
0
?
new
USLayoutResolvedKeybinding
(
new
ChordKeybinding
(
parts
),
OS
)
:
undefined
;
return
new
ResolvedKeybindingItem
(
keybinding
,
command
||
'
some command
'
,
null
,
when
?
ContextKeyExpr
.
deserialize
(
when
)
:
undefined
,
isDefault
===
undefined
?
true
:
isDefault
);
}
...
...
src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts
浏览文件 @
4ce2cdd6
...
...
@@ -174,7 +174,7 @@ export class KeybindingsEditorModel extends EditorModel {
const
commandsWithDefaultKeybindings
=
this
.
keybindingsService
.
getDefaultKeybindings
().
map
(
keybinding
=>
keybinding
.
command
);
for
(
const
command
of
KeybindingResolver
.
getAllUnboundCommands
(
boundCommands
))
{
const
keybindingItem
=
new
ResolvedKeybindingItem
(
null
,
command
,
null
,
undefined
,
commandsWithDefaultKeybindings
.
indexOf
(
command
)
===
-
1
);
const
keybindingItem
=
new
ResolvedKeybindingItem
(
undefined
,
command
,
null
,
undefined
,
commandsWithDefaultKeybindings
.
indexOf
(
command
)
===
-
1
);
this
.
_keybindingItemsSortedByPrecedence
.
push
(
KeybindingsEditorModel
.
toKeybindingEntry
(
command
,
keybindingItem
,
workbenchActionsRegistry
,
editorActionsLabels
));
}
this
.
_keybindingItems
=
this
.
_keybindingItemsSortedByPrecedence
.
slice
(
0
).
sort
((
a
,
b
)
=>
KeybindingsEditorModel
.
compareKeybindingData
(
a
,
b
));
...
...
src/vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts
浏览文件 @
4ce2cdd6
...
...
@@ -617,7 +617,7 @@ suite('KeybindingsEditorModel test', () => {
parts
.
push
(
aSimpleKeybinding
(
chordPart
));
}
}
let
keybinding
=
parts
.
length
>
0
?
new
USLayoutResolvedKeybinding
(
new
ChordKeybinding
(
parts
),
OS
)
:
null
;
const
keybinding
=
parts
.
length
>
0
?
new
USLayoutResolvedKeybinding
(
new
ChordKeybinding
(
parts
),
OS
)
:
undefined
;
return
new
ResolvedKeybindingItem
(
keybinding
,
command
||
'
some command
'
,
null
,
when
?
ContextKeyExpr
.
deserialize
(
when
)
:
undefined
,
isDefault
===
undefined
?
true
:
isDefault
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录