Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bedec883
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,发现更多精彩内容 >>
提交
bedec883
编写于
11月 27, 2015
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make executeCommand return a promise
上级
8f0ec19a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
10 addition
and
10 deletion
+10
-10
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
+5
-7
src/vs/platform/keybinding/common/keybindingService.ts
src/vs/platform/keybinding/common/keybindingService.ts
+3
-1
src/vs/workbench/api/common/pluginHostCommands.ts
src/vs/workbench/api/common/pluginHostCommands.ts
+1
-1
src/vs/workbench/test/browser/servicesTestUtils.ts
src/vs/workbench/test/browser/servicesTestUtils.ts
+1
-1
未找到文件。
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
浏览文件 @
bedec883
...
...
@@ -142,7 +142,7 @@ export class AbstractKeybindingService {
throw
new
Error
(
'
Not implemented
'
);
}
public
executeCommand
(
commandId
:
string
,
args
:
any
):
void
{
public
executeCommand
(
commandId
:
string
,
args
:
any
):
TPromise
<
any
>
{
throw
new
Error
(
'
Not implemented
'
);
}
}
...
...
@@ -300,7 +300,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
delete
this
.
_contexts
[
String
(
contextId
)];
}
public
executeCommand
(
commandId
:
string
,
args
:
any
=
{}):
any
{
public
executeCommand
(
commandId
:
string
,
args
:
any
=
{}):
TPromise
<
any
>
{
if
(
!
args
.
context
)
{
var
contextId
=
this
.
_findContextAttr
(
<
HTMLElement
>
document
.
activeElement
);
var
context
=
this
.
getContext
(
contextId
);
...
...
@@ -309,9 +309,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
args
.
context
=
contextValue
;
}
return
this
.
_invokeHandler
(
commandId
,
args
).
done
(
undefined
,
err
=>
{
this
.
_messageService
.
show
(
Severity
.
Warning
,
err
);
});
return
this
.
_invokeHandler
(
commandId
,
args
);
}
}
...
...
@@ -356,8 +354,8 @@ class ScopedKeybindingService extends AbstractKeybindingService {
this
.
_parent
.
disposeContext
(
contextId
);
}
public
executeCommand
(
commandId
:
string
,
args
:
any
):
void
{
this
.
_parent
.
executeCommand
(
commandId
,
args
);
public
executeCommand
(
commandId
:
string
,
args
:
any
):
TPromise
<
any
>
{
return
this
.
_parent
.
executeCommand
(
commandId
,
args
);
}
}
...
...
src/vs/platform/keybinding/common/keybindingService.ts
浏览文件 @
bedec883
...
...
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
createDecorator
,
IInstantiationService
,
ServiceIdentifier
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
...
...
@@ -82,5 +83,6 @@ export interface IKeybindingService {
lookupKeybindings
(
commandId
:
string
):
Keybinding
[];
customKeybindingsCount
():
number
;
executeCommand
(
commandId
:
string
,
args
?:
any
):
any
;
executeCommand
<
T
>
(
commandId
:
string
,
args
?:
any
):
TPromise
<
T
>
;
executeCommand
(
commandId
:
string
,
args
?:
any
):
TPromise
<
any
>
;
}
src/vs/workbench/api/common/pluginHostCommands.ts
浏览文件 @
bedec883
...
...
@@ -148,7 +148,7 @@ export class MainThreadCommands {
}
_executeCommand
<
T
>
(
id
:
string
,
args
:
any
[]):
Thenable
<
T
>
{
return
TPromise
.
as
(
this
.
_keybindingService
.
executeCommand
(
id
,
args
)
);
return
this
.
_keybindingService
.
executeCommand
(
id
,
args
);
}
_getCommands
():
Thenable
<
string
[]
>
{
...
...
src/vs/workbench/test/browser/servicesTestUtils.ts
浏览文件 @
bedec883
...
...
@@ -153,7 +153,7 @@ export class TestKeybindingService implements IKeybindingService {
public
setInstantiationService
(
instantiationService
:
IInstantiationService
):
void
{
}
public
setContext
(
key
:
string
,
value
:
any
):
void
{
}
public
removeContext
(
key
:
string
):
void
{
}
public
executeCommand
(
commandId
:
string
,
args
:
any
):
void
{
}
public
executeCommand
(
commandId
:
string
,
args
:
any
):
TPromise
<
any
>
{
return
;
}
public
createKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IKeybindingContextKey
<
T
>
{
return
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录