Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
76c262bf
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,体验更适合开发者的 AI 搜索 >>
提交
76c262bf
编写于
3月 10, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract NormalizedKeybindingItem to its own file
上级
006fba95
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
68 addition
and
53 deletion
+68
-53
src/vs/editor/browser/standalone/simpleServices.ts
src/vs/editor/browser/standalone/simpleServices.ts
+2
-1
src/vs/platform/keybinding/common/keybindingResolver.ts
src/vs/platform/keybinding/common/keybindingResolver.ts
+2
-48
src/vs/platform/keybinding/common/normalizedKeybindingItem.ts
...vs/platform/keybinding/common/normalizedKeybindingItem.ts
+56
-0
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
.../keybinding/test/common/abstractKeybindingService.test.ts
+2
-1
src/vs/platform/keybinding/test/common/keybindingIO.test.ts
src/vs/platform/keybinding/test/common/keybindingIO.test.ts
+2
-1
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
...latform/keybinding/test/common/keybindingResolver.test.ts
+2
-1
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
...services/keybinding/electron-browser/keybindingService.ts
+2
-1
未找到文件。
src/vs/editor/browser/standalone/simpleServices.ts
浏览文件 @
76c262bf
...
...
@@ -12,7 +12,7 @@ import { IConfigurationService, IConfigurationServiceEvent, IConfigurationValue,
import
{
IEditor
,
IEditorInput
,
IEditorOptions
,
IEditorService
,
IResourceInput
,
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ICommandService
,
ICommand
,
ICommandEvent
,
ICommandHandler
,
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
SimpleResolvedKeybinding
,
AbstractKeybindingService
}
from
'
vs/platform/keybinding/common/abstractKeybindingService
'
;
import
{
KeybindingResolver
,
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
IKeybindingEvent
,
IKeybindingItem
,
KeybindingSource
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IConfirmation
,
IMessageService
}
from
'
vs/platform/message/common/message
'
;
...
...
@@ -32,6 +32,7 @@ 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
}
from
'
vs/base/common/keyCodes
'
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
export
class
SimpleEditor
implements
IEditor
{
...
...
src/vs/platform/keybinding/common/keybindingResolver.ts
浏览文件 @
76c262bf
...
...
@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
createKeybinding
,
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
ISimplifiedPlatform
,
KeybindingLabels
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
IKeybindingItem
,
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
CharCode
}
from
"
vs/base/common/charCode
"
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
export
interface
IResolveResult
{
enterChord
:
boolean
;
...
...
@@ -30,52 +30,6 @@ interface IChordsMap {
[
keypress
:
string
]:
ICommandMap
;
}
export
class
NormalizedKeybindingItem
{
_normalizedKeybindingItemBrand
:
void
;
public
readonly
keybinding
:
Keybinding
;
public
readonly
keypressFirstPart
:
string
;
public
readonly
keypressChordPart
:
string
;
public
readonly
bubble
:
boolean
;
public
readonly
command
:
string
;
public
readonly
commandArgs
:
any
;
public
readonly
when
:
ContextKeyExpr
;
public
readonly
isDefault
:
boolean
;
public
static
fromKeybindingItem
(
source
:
IKeybindingItem
,
isDefault
:
boolean
):
NormalizedKeybindingItem
{
let
when
:
ContextKeyExpr
=
null
;
if
(
source
.
when
)
{
when
=
source
.
when
.
normalize
();
}
let
keybinding
:
Keybinding
=
null
;
if
(
source
.
keybinding
!==
0
)
{
keybinding
=
createKeybinding
(
source
.
keybinding
);
}
return
new
NormalizedKeybindingItem
(
keybinding
,
source
.
command
,
source
.
commandArgs
,
when
,
isDefault
);
}
constructor
(
keybinding
:
Keybinding
,
command
:
string
,
commandArgs
:
any
,
when
:
ContextKeyExpr
,
isDefault
:
boolean
)
{
this
.
keybinding
=
keybinding
;
if
(
keybinding
===
null
)
{
this
.
keypressFirstPart
=
null
;
this
.
keypressChordPart
=
null
;
}
else
if
(
keybinding
.
isChord
())
{
this
.
keypressFirstPart
=
keybinding
.
extractFirstPart
().
value
.
toString
();
this
.
keypressChordPart
=
keybinding
.
extractChordPart
().
value
.
toString
();
}
else
{
this
.
keypressFirstPart
=
keybinding
.
value
.
toString
();
this
.
keypressChordPart
=
null
;
}
this
.
bubble
=
(
command
?
command
.
charCodeAt
(
0
)
===
CharCode
.
Caret
:
false
);
this
.
command
=
this
.
bubble
?
command
.
substr
(
1
)
:
command
;
this
.
commandArgs
=
commandArgs
;
this
.
when
=
when
;
this
.
isDefault
=
isDefault
;
}
}
export
class
KeybindingResolver
{
private
readonly
_defaultKeybindings
:
NormalizedKeybindingItem
[];
private
readonly
_shouldWarnOnConflict
:
boolean
;
...
...
src/vs/platform/keybinding/common/normalizedKeybindingItem.ts
0 → 100644
浏览文件 @
76c262bf
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
createKeybinding
,
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IKeybindingItem
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
CharCode
}
from
"
vs/base/common/charCode
"
;
export
class
NormalizedKeybindingItem
{
_normalizedKeybindingItemBrand
:
void
;
public
readonly
keybinding
:
Keybinding
;
public
readonly
keypressFirstPart
:
string
;
public
readonly
keypressChordPart
:
string
;
public
readonly
bubble
:
boolean
;
public
readonly
command
:
string
;
public
readonly
commandArgs
:
any
;
public
readonly
when
:
ContextKeyExpr
;
public
readonly
isDefault
:
boolean
;
public
static
fromKeybindingItem
(
source
:
IKeybindingItem
,
isDefault
:
boolean
):
NormalizedKeybindingItem
{
let
when
:
ContextKeyExpr
=
null
;
if
(
source
.
when
)
{
when
=
source
.
when
.
normalize
();
}
let
keybinding
:
Keybinding
=
null
;
if
(
source
.
keybinding
!==
0
)
{
keybinding
=
createKeybinding
(
source
.
keybinding
);
}
return
new
NormalizedKeybindingItem
(
keybinding
,
source
.
command
,
source
.
commandArgs
,
when
,
isDefault
);
}
constructor
(
keybinding
:
Keybinding
,
command
:
string
,
commandArgs
:
any
,
when
:
ContextKeyExpr
,
isDefault
:
boolean
)
{
this
.
keybinding
=
keybinding
;
if
(
keybinding
===
null
)
{
this
.
keypressFirstPart
=
null
;
this
.
keypressChordPart
=
null
;
}
else
if
(
keybinding
.
isChord
())
{
this
.
keypressFirstPart
=
keybinding
.
extractFirstPart
().
value
.
toString
();
this
.
keypressChordPart
=
keybinding
.
extractChordPart
().
value
.
toString
();
}
else
{
this
.
keypressFirstPart
=
keybinding
.
value
.
toString
();
this
.
keypressChordPart
=
null
;
}
this
.
bubble
=
(
command
?
command
.
charCodeAt
(
0
)
===
CharCode
.
Caret
:
false
);
this
.
command
=
this
.
bubble
?
command
.
substr
(
1
)
:
command
;
this
.
commandArgs
=
commandArgs
;
this
.
when
=
when
;
this
.
isDefault
=
isDefault
;
}
}
src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts
浏览文件 @
76c262bf
...
...
@@ -11,11 +11,12 @@ import { KeybindingLabels } from 'vs/platform/keybinding/common/keybindingLabels
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
KeybindingResolver
,
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
ContextKeyExpr
,
IContextKeyService
,
IContextKeyServiceTarget
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
suite
(
'
AbstractKeybindingService
'
,
()
=>
{
...
...
src/vs/platform/keybinding/test/common/keybindingIO.test.ts
浏览文件 @
76c262bf
...
...
@@ -6,9 +6,10 @@
import
*
as
assert
from
'
assert
'
;
import
{
createKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
}
from
'
vs/base/common/keyCodes
'
;
import
{
NormalizedKeybindingItem
,
IOSupport
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
IOSupport
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
IUserFriendlyKeybinding
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ISimplifiedPlatform
}
from
'
vs/platform/keybinding/common/keybindingLabels
'
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
suite
(
'
Keybinding IO
'
,
()
=>
{
...
...
src/vs/platform/keybinding/test/common/keybindingResolver.test.ts
浏览文件 @
76c262bf
...
...
@@ -6,8 +6,9 @@
import
*
as
assert
from
'
assert
'
;
import
{
createKeybinding
,
SimpleKeybinding
,
KeyCode
,
KeyMod
,
KeyChord
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeybindingResolver
,
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
KeybindingResolver
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
ContextKeyAndExpr
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
suite
(
'
KeybindingResolver
'
,
()
=>
{
...
...
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
浏览文件 @
76c262bf
...
...
@@ -15,7 +15,7 @@ import { ExtensionMessageCollector, ExtensionsRegistry } from 'vs/platform/exten
import
{
Extensions
,
IJSONContributionRegistry
}
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
import
{
AbstractKeybindingService
}
from
'
vs/platform/keybinding/common/abstractKeybindingService
'
;
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
KeybindingResolver
,
IOSupport
,
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
KeybindingResolver
,
IOSupport
}
from
'
vs/platform/keybinding/common/keybindingResolver
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IKeybindingEvent
,
IKeybindingItem
,
IUserFriendlyKeybinding
,
KeybindingSource
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ContextKeyExpr
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -29,6 +29,7 @@ import { ConfigWatcher } from 'vs/base/node/config';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
NormalizedKeybindingItem
}
from
'
vs/platform/keybinding/common/normalizedKeybindingItem
'
;
interface
ContributedKeyBinding
{
command
:
string
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录