Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a2a48e3b
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 搜索 >>
提交
a2a48e3b
编写于
3月 01, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify IExtensionService
上级
3d311aee
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
22 addition
and
49 deletion
+22
-49
src/vs/editor/browser/standalone/simpleServices.ts
src/vs/editor/browser/standalone/simpleServices.ts
+0
-4
src/vs/editor/common/worker/editorWorkerServer.ts
src/vs/editor/common/worker/editorWorkerServer.ts
+0
-4
src/vs/editor/test/common/servicesTestUtils.ts
src/vs/editor/test/common/servicesTestUtils.ts
+0
-5
src/vs/platform/extensions/common/abstractPluginService.ts
src/vs/platform/extensions/common/abstractPluginService.ts
+2
-7
src/vs/platform/extensions/common/nativePluginService.ts
src/vs/platform/extensions/common/nativePluginService.ts
+0
-4
src/vs/platform/extensions/common/plugins.ts
src/vs/platform/extensions/common/plugins.ts
+5
-13
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/node/pluginHostMain.ts
src/vs/workbench/node/pluginHostMain.ts
+14
-11
未找到文件。
src/vs/editor/browser/standalone/simpleServices.ts
浏览文件 @
a2a48e3b
...
...
@@ -274,10 +274,6 @@ export class SimplePluginService extends AbstractPluginService<ActivatedPlugin>
}
}
public
deactivate
(
pluginId
:
string
):
void
{
// nothing to do
}
protected
_createFailedPlugin
():
ActivatedPlugin
{
throw
new
Error
(
'
unexpected
'
);
}
...
...
src/vs/editor/common/worker/editorWorkerServer.ts
浏览文件 @
a2a48e3b
...
...
@@ -67,10 +67,6 @@ class WorkerPluginService extends AbstractPluginService<ActivatedPlugin> {
}
}
public
deactivate
(
pluginId
:
string
):
void
{
// nothing to do
}
protected
_createFailedPlugin
():
ActivatedPlugin
{
throw
new
Error
(
'
unexpected
'
);
}
...
...
src/vs/editor/test/common/servicesTestUtils.ts
浏览文件 @
a2a48e3b
...
...
@@ -120,11 +120,6 @@ class MockPluginService extends AbstractPluginService<ActivatedPlugin> {
}
}
public
deactivate
(
pluginId
:
string
):
void
{
// nothing to do
}
protected
_createFailedPlugin
():
any
{
throw
new
Error
(
'
not implemented
'
);
}
...
...
src/vs/platform/extensions/common/abstractPluginService.ts
浏览文件 @
a2a48e3b
...
...
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
I
ActivationEventListener
,
I
Message
,
IPluginDescription
,
IExtensionService
,
IPluginStatus
}
from
'
vs/platform/extensions/common/plugins
'
;
import
{
IMessage
,
IPluginDescription
,
IExtensionService
,
IPluginStatus
}
from
'
vs/platform/extensions/common/plugins
'
;
import
{
PluginsRegistry
}
from
'
vs/platform/extensions/common/pluginsRegistry
'
;
const
hasOwnProperty
=
Object
.
hasOwnProperty
;
...
...
@@ -65,7 +65,6 @@ export abstract class AbstractPluginService<T extends ActivatedPlugin> implement
this
.
activatedPlugins
=
{};
}
public
abstract
deactivate
(
pluginId
:
string
):
void
;
protected
abstract
_showMessage
(
severity
:
Severity
,
message
:
string
):
void
;
protected
showMessage
(
severity
:
Severity
,
source
:
string
,
message
:
string
):
void
{
...
...
@@ -79,10 +78,6 @@ export abstract class AbstractPluginService<T extends ActivatedPlugin> implement
this
.
_onReadyC
(
true
);
}
public
registerOneTimeActivationEventListener
(
activationEvent
:
string
,
listener
:
IActivationEventListener
):
void
{
PluginsRegistry
.
registerOneTimeActivationEventListener
(
activationEvent
,
listener
);
}
public
onReady
():
TPromise
<
boolean
>
{
return
this
.
_onReady
;
}
...
...
@@ -104,7 +99,7 @@ export abstract class AbstractPluginService<T extends ActivatedPlugin> implement
});
}
public
activate
AndGet
(
pluginId
:
string
):
TPromise
<
void
>
{
public
activate
ById
(
pluginId
:
string
):
TPromise
<
void
>
{
return
this
.
_onReady
.
then
(()
=>
{
let
desc
=
PluginsRegistry
.
getPluginDescription
(
pluginId
);
if
(
!
desc
)
{
...
...
src/vs/platform/extensions/common/nativePluginService.ts
浏览文件 @
a2a48e3b
...
...
@@ -200,10 +200,6 @@ export class MainProcessPluginService extends AbstractPluginService<ActivatedPlu
return
this
.
_pluginsStatus
;
}
public
deactivate
(
pluginId
:
string
):
void
{
this
.
_proxy
.
deactivate
(
pluginId
);
}
// -- overwriting AbstractPluginService
protected
_actualActivatePlugin
(
pluginDescription
:
IPluginDescription
):
TPromise
<
ActivatedPlugin
>
{
...
...
src/vs/platform/extensions/common/plugins.ts
浏览文件 @
a2a48e3b
...
...
@@ -47,27 +47,19 @@ export interface IPluginStatus {
export
interface
IExtensionService
{
serviceId
:
ServiceIdentifier
<
any
>
;
activateByEvent
(
activationEvent
:
string
):
TPromise
<
void
>
;
activateAndGet
(
pluginId
:
string
):
TPromise
<
void
>
;
isActivated
(
pluginId
:
string
):
boolean
;
/**
* This method should be called only on shutdown!
* More work is needed for this to be called any time!
* Send an activation event and activate interested extensions.
*/
deactivate
(
pluginId
:
string
):
void
;
activateByEvent
(
activationEvent
:
string
):
TPromise
<
void
>
;
/**
*
To be used only by the platform once on startup
.
*
Block on this signal any interactions with extensions
.
*/
registrationDone
(
errors
?:
IMessage
[]):
void
;
registerOneTimeActivationEventListener
(
activationEvent
:
string
,
listener
:
IActivationEventListener
):
void
;
onReady
():
TPromise
<
boolean
>
;
/**
*
Block on this signal any interactions with extension
s.
*
Get information about extensions statu
s.
*/
onReady
():
TPromise
<
boolean
>
;
getPluginsStatus
():
{
[
id
:
string
]:
IPluginStatus
};
}
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
a2a48e3b
...
...
@@ -435,7 +435,7 @@ class Extension<T> implements vscode.Extension<T> {
}
activate
():
Thenable
<
T
>
{
return
this
.
_extensionService
.
activate
AndGet
(
this
.
id
).
then
(()
=>
this
.
exports
);
return
this
.
_extensionService
.
activate
ById
(
this
.
id
).
then
(()
=>
this
.
exports
);
}
}
...
...
src/vs/workbench/node/pluginHostMain.ts
浏览文件 @
a2a48e3b
...
...
@@ -93,13 +93,16 @@ interface ITestRunner {
export
class
PluginHostMain
{
private
_isTerminating
:
boolean
;
private
_contextService
:
IWorkspaceContextService
;
private
_extensionService
:
PluginHostPluginService
;
constructor
(
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IExtensionService
extensionService
:
IExtensionService
)
{
this
.
_isTerminating
=
false
;
this
.
_contextService
=
contextService
;
this
.
_extensionService
=
<
PluginHostPluginService
>
extensionService
;
}
public
start
():
TPromise
<
void
>
{
...
...
@@ -116,10 +119,10 @@ export class PluginHostMain {
try
{
let
allExtensions
=
PluginsRegistry
.
getAllPluginDescriptions
();
let
allExtensionsIds
=
allExtensions
.
map
(
ext
=>
ext
.
id
);
let
activatedExtensions
=
allExtensionsIds
.
filter
(
id
=>
this
.
extensionService
.
isActivated
(
id
));
let
activatedExtensions
=
allExtensionsIds
.
filter
(
id
=>
this
.
_
extensionService
.
isActivated
(
id
));
activatedExtensions
.
forEach
((
extensionId
)
=>
{
this
.
extensionService
.
deactivate
(
extensionId
);
this
.
_
extensionService
.
deactivate
(
extensionId
);
});
}
catch
(
err
)
{
// TODO: write to log once we have one
...
...
@@ -133,7 +136,7 @@ export class PluginHostMain {
private
readPlugins
():
TPromise
<
void
>
{
let
collector
=
new
PluginsMessageCollector
();
let
env
=
this
.
contextService
.
getConfiguration
().
env
;
let
env
=
this
.
_
contextService
.
getConfiguration
().
env
;
return
PluginHostMain
.
scanPlugins
(
collector
,
BUILTIN_PLUGINS_PATH
,
!
env
.
disablePlugins
?
env
.
userPluginsHome
:
void
0
,
!
env
.
disablePlugins
?
env
.
pluginDevelopmentPath
:
void
0
,
env
.
version
)
.
then
(
null
,
err
=>
{
...
...
@@ -143,7 +146,7 @@ export class PluginHostMain {
.
then
(
extensions
=>
{
// Register & Signal done
PluginsRegistry
.
registerPlugins
(
extensions
);
this
.
extensionService
.
registrationDone
(
collector
.
getMessages
());
this
.
_
extensionService
.
registrationDone
(
collector
.
getMessages
());
})
.
then
(()
=>
this
.
handleEagerPlugins
())
.
then
(()
=>
this
.
handlePluginTests
());
...
...
@@ -183,14 +186,14 @@ export class PluginHostMain {
// Handle "eager" activation plugins
private
handleEagerPlugins
():
TPromise
<
void
>
{
this
.
extensionService
.
activateByEvent
(
'
*
'
).
then
(
null
,
(
err
)
=>
{
this
.
_
extensionService
.
activateByEvent
(
'
*
'
).
then
(
null
,
(
err
)
=>
{
console
.
error
(
err
);
});
return
this
.
handleWorkspaceContainsEagerPlugins
();
}
private
handleWorkspaceContainsEagerPlugins
():
TPromise
<
void
>
{
let
workspace
=
this
.
contextService
.
getWorkspace
();
let
workspace
=
this
.
_
contextService
.
getWorkspace
();
if
(
!
workspace
||
!
workspace
.
resource
)
{
return
TPromise
.
as
(
null
);
}
...
...
@@ -226,7 +229,7 @@ export class PluginHostMain {
}
let
activationEvent
=
'
workspaceContains:
'
+
existingFileName
;
this
.
extensionService
.
activateByEvent
(
activationEvent
).
then
(
null
,
(
err
)
=>
{
this
.
_
extensionService
.
activateByEvent
(
activationEvent
).
then
(
null
,
(
err
)
=>
{
console
.
error
(
err
);
});
});
...
...
@@ -234,7 +237,7 @@ export class PluginHostMain {
}
private
handlePluginTests
():
TPromise
<
void
>
{
let
env
=
this
.
contextService
.
getConfiguration
().
env
;
let
env
=
this
.
_
contextService
.
getConfiguration
().
env
;
if
(
!
env
.
pluginTestsPath
||
!
env
.
pluginDevelopmentPath
)
{
return
TPromise
.
as
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录