Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b5220f9b
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b5220f9b
编写于
12月 08, 2015
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add addApiCommand call which can be found by a doc tool
上级
ba2988de
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
18 deletion
+76
-18
src/vs/platform/keybinding/common/commands.ts
src/vs/platform/keybinding/common/commands.ts
+37
-0
src/vs/platform/keybinding/common/keybindingsRegistry.ts
src/vs/platform/keybinding/common/keybindingsRegistry.ts
+12
-0
src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts
...vs/workbench/api/common/extHostLanguageFeatureCommands.ts
+21
-18
src/vs/workbench/api/common/pluginHostCommands.ts
src/vs/workbench/api/common/pluginHostCommands.ts
+6
-0
未找到文件。
src/vs/platform/keybinding/common/commands.ts
0 → 100644
浏览文件 @
b5220f9b
/*---------------------------------------------------------------------------------------------
* 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
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
export
class
ApiCommands
{
static
Instance
=
new
ApiCommands
();
private
_commands
:
{
[
id
:
string
]:
[(...
args
:
any
[])
=>
any
,
any
]
}
=
Object
.
create
(
null
);
private
_onDidAddCommand
=
new
Emitter
<
{
id
:
string
;
handler
:
(...
args
:
any
[])
=>
any
;
thisArg
?:
any
}
>
();
add
(
id
:
string
,
handler
:
(...
args
:
any
[])
=>
any
,
thisArg
?:
any
)
{
if
(
this
.
_commands
[
id
])
{
throw
new
Error
();
}
this
.
_commands
[
id
]
=
[
handler
,
thisArg
];
this
.
_onDidAddCommand
.
fire
({
id
,
handler
,
thisArg
});
}
track
(
callback
:
(
event
:
{
id
:
string
;
handler
:
(...
args
:
any
[])
=>
any
;
thisArg
?:
any
})
=>
any
):
IDisposable
{
for
(
let
id
in
this
.
_commands
)
{
let
[
handler
,
thisArg
]
=
this
.
_commands
[
id
];
callback
({
id
,
handler
,
thisArg
});
}
return
this
.
_onDidAddCommand
.
event
(
callback
);
}
}
export
function
addApiCommand
(
id
:
string
,
handler
:
(...
args
:
any
[])
=>
any
,
thisArg
?:
any
)
{
ApiCommands
.
Instance
.
add
(
id
,
handler
,
thisArg
);
}
\ No newline at end of file
src/vs/platform/keybinding/common/keybindingsRegistry.ts
浏览文件 @
b5220f9b
...
...
@@ -8,6 +8,7 @@ import {Registry} from 'vs/platform/platform';
import
{
ICommandHandler
,
ICommandsMap
,
IKeybindingItem
,
IKeybindings
,
IKeybindingContextRule
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
KeybindingsUtils
}
from
'
vs/platform/keybinding/common/keybindingsUtils
'
;
import
{
KeyMod
,
KeyCode
,
BinaryKeybindings
}
from
'
vs/base/common/keyCodes
'
;
import
{
ApiCommands
}
from
'
vs/platform/keybinding/common/commands
'
;
import
Platform
=
require
(
'
vs/base/common/platform
'
);
export
interface
ICommandRule
extends
IKeybindings
{
...
...
@@ -67,6 +68,17 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
constructor
()
{
this
.
_keybindings
=
[];
this
.
_commands
=
Object
.
create
(
null
);
ApiCommands
.
Instance
.
track
(
event
=>
{
this
.
registerCommandDesc
({
id
:
event
.
id
,
handler
:
function
(
accessor
,
args
)
{
event
.
handler
.
apply
(
event
.
thisArg
,
args
);
},
weight
:
this
.
WEIGHT
.
externalExtension
(
0
),
context
:
undefined
,
primary
:
undefined
});
});
}
public
registerCommandRule
(
rule
:
ICommandRule
):
void
{
...
...
src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts
浏览文件 @
b5220f9b
...
...
@@ -35,6 +35,7 @@ import {NavigateTypesSupportRegistry, INavigateTypesSupport, ITypeBearing} from
import
{
RenameRegistry
}
from
'
vs/editor/contrib/rename/common/rename
'
;
import
{
FormatRegistry
,
FormatOnTypeRegistry
}
from
'
vs/editor/contrib/format/common/format
'
;
import
{
ICodeLensData
}
from
'
vs/editor/contrib/codelens/common/codelens
'
;
import
{
addApiCommand
}
from
'
vs/platform/keybinding/common/commands
'
;
export
class
ExtHostLanguageFeatureCommands
{
...
...
@@ -44,28 +45,30 @@ export class ExtHostLanguageFeatureCommands {
constructor
(
commands
:
PluginHostCommands
)
{
this
.
_commands
=
commands
;
this
.
_register
(
'
vscode.executeWorkspaceSymbolProvider
'
,
this
.
_executeWorkspaceSymbolProvider
);
this
.
_register
(
'
vscode.executeDefinitionProvider
'
,
this
.
_executeDefinitionProvider
);
this
.
_register
(
'
vscode.executeHoverProvider
'
,
this
.
_executeHoverProvider
);
this
.
_register
(
'
vscode.executeDocumentHighlights
'
,
this
.
_executeDocumentHighlights
);
this
.
_register
(
'
vscode.executeReferenceProvider
'
,
this
.
_executeReferenceProvider
);
this
.
_register
(
'
vscode.executeDocumentRenameProvider
'
,
this
.
_executeDocumentRenameProvider
);
this
.
_register
(
'
vscode.executeSignatureHelpProvider
'
,
this
.
_executeSignatureHelpProvider
);
this
.
_register
(
'
vscode.executeDocumentSymbolProvider
'
,
this
.
_executeDocumentSymbolProvider
);
this
.
_register
(
'
vscode.executeCompletionItemProvider
'
,
this
.
_executeCompletionItemProvider
);
this
.
_register
(
'
vscode.executeCodeActionProvider
'
,
this
.
_executeCodeActionProvider
);
this
.
_register
(
'
vscode.executeCodeLensProvider
'
,
this
.
_executeCodeLensProvider
);
this
.
_register
(
'
vscode.executeFormatDocumentProvider
'
,
this
.
_executeFormatDocumentProvider
);
this
.
_register
(
'
vscode.executeFormatRangeProvider
'
,
this
.
_executeFormatRangeProvider
);
this
.
_register
(
'
vscode.executeFormatOnTypeProvider
'
,
this
.
_executeFormatOnTypeProvider
);
}
private
_register
(
id
:
string
,
callback
:
(...
args
:
any
[])
=>
any
):
void
{
this
.
_disposables
.
push
(
this
.
_commands
.
registerCommand
(
id
,
callback
,
this
));
addApiCommand
(
'
vscode.executeWorkspaceSymbolProvider
'
,
this
.
_executeWorkspaceSymbolProvider
,
this
);
addApiCommand
(
'
vscode.executeDefinitionProvider
'
,
this
.
_executeDefinitionProvider
,
this
);
addApiCommand
(
'
vscode.executeHoverProvider
'
,
this
.
_executeHoverProvider
,
this
);
addApiCommand
(
'
vscode.executeDocumentHighlights
'
,
this
.
_executeDocumentHighlights
,
this
);
addApiCommand
(
'
vscode.executeReferenceProvider
'
,
this
.
_executeReferenceProvider
,
this
);
addApiCommand
(
'
vscode.executeDocumentRenameProvider
'
,
this
.
_executeDocumentRenameProvider
,
this
);
addApiCommand
(
'
vscode.executeSignatureHelpProvider
'
,
this
.
_executeSignatureHelpProvider
,
this
);
addApiCommand
(
'
vscode.executeDocumentSymbolProvider
'
,
this
.
_executeDocumentSymbolProvider
,
this
);
addApiCommand
(
'
vscode.executeCompletionItemProvider
'
,
this
.
_executeCompletionItemProvider
,
this
);
addApiCommand
(
'
vscode.executeCodeActionProvider
'
,
this
.
_executeCodeActionProvider
,
this
);
addApiCommand
(
'
vscode.executeCodeLensProvider
'
,
this
.
_executeCodeLensProvider
,
this
);
addApiCommand
(
'
vscode.executeFormatDocumentProvider
'
,
this
.
_executeFormatDocumentProvider
,
this
);
addApiCommand
(
'
vscode.executeFormatRangeProvider
'
,
this
.
_executeFormatRangeProvider
,
this
);
addApiCommand
(
'
vscode.executeFormatOnTypeProvider
'
,
this
.
_executeFormatOnTypeProvider
,
this
);
}
// --- command impl
/**
* Execute workspace symbol provider.
*
* @param query Search string to match query symbol names
* @return A promise that resolves to an array of symbol information.
*/
private
_executeWorkspaceSymbolProvider
(
query
:
string
):
Thenable
<
types
.
SymbolInformation
[]
>
{
return
this
.
_commands
.
executeCommand
<
ITypeBearing
[]
>
(
'
_executeWorkspaceSymbolProvider
'
,
{
query
}).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
...
...
src/vs/workbench/api/common/pluginHostCommands.ts
浏览文件 @
b5220f9b
...
...
@@ -15,6 +15,7 @@ import {PluginHostEditors} from 'vs/workbench/api/common/pluginHostEditors';
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
canSerialize
}
from
'
vs/base/common/marshalling
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errors
'
;
import
{
ApiCommands
}
from
'
vs/platform/keybinding/common/commands
'
;
import
*
as
vscode
from
'
vscode
'
;
@
Remotable
.
PluginHostContext
(
'
PluginHostCommands
'
)
...
...
@@ -27,6 +28,11 @@ export class PluginHostCommands {
constructor
(@
IThreadService
threadService
:
IThreadService
)
{
this
.
_pluginHostEditors
=
threadService
.
getRemotable
(
PluginHostEditors
);
this
.
_proxy
=
threadService
.
getRemotable
(
MainThreadCommands
);
ApiCommands
.
Instance
.
track
(
event
=>
{
let
{
id
,
handler
,
thisArg
}
=
event
;
this
.
registerCommand
(
id
,
handler
,
thisArg
);
});
}
registerCommand
(
id
:
string
,
command
:
<
T
>
(...
args
:
any
[])
=>
T
|
Thenable
<
T
>
,
thisArgs
?:
any
):
vscode
.
Disposable
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录