Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
21de711c
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
21de711c
编写于
8月 15, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove proposed API `vscode.commands.onDidExecuteCommand`
上级
985c775b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
4 addition
and
59 deletion
+4
-59
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+0
-16
src/vs/workbench/api/browser/mainThreadCommands.ts
src/vs/workbench/api/browser/mainThreadCommands.ts
+0
-14
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+1
-5
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-4
src/vs/workbench/api/common/extHostCommands.ts
src/vs/workbench/api/common/extHostCommands.ts
+2
-20
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
21de711c
...
...
@@ -565,22 +565,6 @@ declare module 'vscode' {
//#endregion
//#region Joh: onDidExecuteCommand
export
interface
CommandExecutionEvent
{
command
:
string
;
arguments
:
any
[];
}
export
namespace
commands
{
/**
* An event that is emitted when a [command](#Command) is executed.
*/
export
const
onDidExecuteCommand
:
Event
<
CommandExecutionEvent
>
;
}
//#endregion
//#region Joh: decorations
//todo@joh -> make class
...
...
src/vs/workbench/api/browser/mainThreadCommands.ts
浏览文件 @
21de711c
...
...
@@ -15,7 +15,6 @@ export class MainThreadCommands implements MainThreadCommandsShape {
private
readonly
_commandRegistrations
=
new
Map
<
string
,
IDisposable
>
();
private
readonly
_generateCommandsDocumentationRegistration
:
IDisposable
;
private
readonly
_proxy
:
ExtHostCommandsShape
;
private
_onDidExecuteCommandListener
?:
IDisposable
;
constructor
(
extHostContext
:
IExtHostContext
,
...
...
@@ -78,19 +77,6 @@ export class MainThreadCommands implements MainThreadCommandsShape {
return
this
.
_commandService
.
executeCommand
<
T
>
(
id
,
...
args
);
}
$registerCommandListener
()
{
if
(
!
this
.
_onDidExecuteCommandListener
)
{
this
.
_onDidExecuteCommandListener
=
this
.
_commandService
.
onDidExecuteCommand
(
command
=>
this
.
_proxy
.
$handleDidExecuteCommand
(
command
));
}
}
$unregisterCommandListener
()
{
if
(
this
.
_onDidExecuteCommandListener
)
{
this
.
_onDidExecuteCommandListener
.
dispose
();
this
.
_onDidExecuteCommandListener
=
undefined
;
}
}
$getCommands
():
Promise
<
string
[]
>
{
return
Promise
.
resolve
([...
CommandsRegistry
.
getCommands
().
keys
()]);
}
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
21de711c
...
...
@@ -223,11 +223,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
getCommands
(
filterInternal
:
boolean
=
false
):
Thenable
<
string
[]
>
{
return
extHostCommands
.
getCommands
(
filterInternal
);
},
onDidExecuteCommand
:
proposedApiFunction
(
extension
,
(
listener
,
thisArgs
?,
disposables
?)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostCommands
.
onDidExecuteCommand
(
listener
,
thisArgs
,
disposables
);
}),
}
};
// namespace: env
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
21de711c
...
...
@@ -21,7 +21,7 @@ import { EndOfLineSequence, ISingleEditOperation } from 'vs/editor/common/model'
import
{
IModelChangedEvent
}
from
'
vs/editor/common/model/mirrorTextModel
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
CharacterPair
,
CommentRule
,
EnterAction
}
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
ICommandHandlerDescription
,
ICommandEvent
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ConfigurationTarget
,
IConfigurationData
,
IConfigurationModel
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ExtensionIdentifier
,
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
...
...
@@ -115,8 +115,6 @@ export interface MainThreadClipboardShape extends IDisposable {
export
interface
MainThreadCommandsShape
extends
IDisposable
{
$registerCommand
(
id
:
string
):
void
;
$registerCommandListener
():
void
;
$unregisterCommandListener
():
void
;
$unregisterCommand
(
id
:
string
):
void
;
$executeCommand
<
T
>
(
id
:
string
,
args
:
any
[]):
Promise
<
T
|
undefined
>
;
$getCommands
():
Promise
<
string
[]
>
;
...
...
@@ -735,7 +733,6 @@ export interface MainThreadWindowShape extends IDisposable {
export
interface
ExtHostCommandsShape
{
$executeContributedCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
Promise
<
T
>
;
$getContributedCommandHandlerDescriptions
():
Promise
<
{
[
id
:
string
]:
string
|
ICommandHandlerDescription
}
>
;
$handleDidExecuteCommand
(
command
:
ICommandEvent
):
void
;
}
export
interface
ExtHostConfigurationShape
{
...
...
src/vs/workbench/api/common/extHostCommands.ts
浏览文件 @
21de711c
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
validateConstraint
}
from
'
vs/base/common/types
'
;
import
{
ICommandHandlerDescription
,
ICommandEvent
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
*
as
extHostTypes
from
'
vs/workbench/api/common/extHostTypes
'
;
import
*
as
extHostTypeConverter
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
{
cloneAndChange
}
from
'
vs/base/common/objects
'
;
...
...
@@ -17,7 +17,6 @@ import { revive } from 'vs/base/common/marshalling';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
DisposableStore
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
...
...
@@ -36,9 +35,6 @@ export class ExtHostCommands implements ExtHostCommandsShape {
readonly
_serviceBrand
:
any
;
private
readonly
_onDidExecuteCommand
:
Emitter
<
vscode
.
CommandExecutionEvent
>
;
readonly
onDidExecuteCommand
:
Event
<
vscode
.
CommandExecutionEvent
>
;
private
readonly
_commands
=
new
Map
<
string
,
CommandHandler
>
();
private
readonly
_proxy
:
MainThreadCommandsShape
;
private
readonly
_converter
:
CommandsConverter
;
...
...
@@ -50,11 +46,6 @@ export class ExtHostCommands implements ExtHostCommandsShape {
@
ILogService
logService
:
ILogService
)
{
this
.
_proxy
=
extHostRpc
.
getProxy
(
MainContext
.
MainThreadCommands
);
this
.
_onDidExecuteCommand
=
new
Emitter
<
vscode
.
CommandExecutionEvent
>
({
onFirstListenerDidAdd
:
()
=>
this
.
_proxy
.
$registerCommandListener
(),
onLastListenerRemove
:
()
=>
this
.
_proxy
.
$unregisterCommandListener
(),
});
this
.
onDidExecuteCommand
=
Event
.
filter
(
this
.
_onDidExecuteCommand
.
event
,
e
=>
e
.
command
[
0
]
!==
'
_
'
);
// filter 'private' commands
this
.
_logService
=
logService
;
this
.
_converter
=
new
CommandsConverter
(
this
);
this
.
_argumentProcessors
=
[
...
...
@@ -119,22 +110,13 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
}
$handleDidExecuteCommand
(
command
:
ICommandEvent
):
void
{
this
.
_onDidExecuteCommand
.
fire
({
command
:
command
.
commandId
,
arguments
:
command
.
args
.
map
(
arg
=>
this
.
_argumentProcessors
.
reduce
((
r
,
p
)
=>
p
.
processArgument
(
r
),
arg
))
});
}
executeCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
Promise
<
T
>
{
this
.
_logService
.
trace
(
'
ExtHostCommands#executeCommand
'
,
id
);
if
(
this
.
_commands
.
has
(
id
))
{
// we stay inside the extension host and support
// to pass any kind of parameters around
const
res
=
this
.
_executeContributedCommand
<
T
>
(
id
,
args
);
this
.
_onDidExecuteCommand
.
fire
({
command
:
id
,
arguments
:
args
});
return
res
;
return
this
.
_executeContributedCommand
<
T
>
(
id
,
args
);
}
else
{
// automagically convert some argument types
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录