Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
824a1b86
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,发现更多精彩内容 >>
提交
824a1b86
编写于
12月 07, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#37677: Add tracing in the extension host around activating extensions
上级
86421af3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
12 deletion
+24
-12
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+13
-6
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+11
-6
未找到文件。
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
824a1b86
...
...
@@ -118,6 +118,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
private
readonly
_storage
:
ExtHostStorage
;
private
readonly
_storagePath
:
ExtensionStoragePath
;
private
readonly
_proxy
:
MainThreadExtensionServiceShape
;
private
readonly
_logService
:
ILogService
;
private
_activator
:
ExtensionsActivator
;
private
_extensionPathIndex
:
TPromise
<
TernarySearchTree
<
IExtensionDescription
>>
;
/**
...
...
@@ -132,6 +133,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this
.
_barrier
=
new
Barrier
();
this
.
_registry
=
new
ExtensionDescriptionRegistry
(
initData
.
extensions
);
this
.
_threadService
=
threadService
;
this
.
_logService
=
logService
;
this
.
_mainThreadTelemetry
=
threadService
.
get
(
MainContext
.
MainThreadTelemetry
);
this
.
_storage
=
new
ExtHostStorage
(
threadService
);
this
.
_storagePath
=
new
ExtensionStoragePath
(
initData
.
workspace
,
initData
.
environment
);
...
...
@@ -308,12 +310,14 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
return
TPromise
.
as
(
new
EmptyExtension
(
ExtensionActivationTimes
.
NONE
));
}
this
.
_logService
.
info
(
`ExtensionService#_doActivateExtension
${
extensionDescription
.
id
}
${
JSON
.
stringify
(
reason
)}
`
);
const
activationTimesBuilder
=
new
ExtensionActivationTimesBuilder
(
reason
.
startup
);
return
TPromise
.
join
<
any
>
([
loadCommonJSModule
(
extensionDescription
.
main
,
activationTimesBuilder
),
loadCommonJSModule
(
this
.
_logService
,
extensionDescription
.
main
,
activationTimesBuilder
),
this
.
_loadExtensionContext
(
extensionDescription
)
]).
then
(
values
=>
{
return
ExtHostExtensionService
.
_callActivate
(
<
IExtensionModule
>
values
[
0
],
<
IExtensionContext
>
values
[
1
],
activationTimesBuilder
);
return
ExtHostExtensionService
.
_callActivate
(
this
.
_logService
,
extensionDescription
.
id
,
<
IExtensionModule
>
values
[
0
],
<
IExtensionContext
>
values
[
1
],
activationTimesBuilder
);
},
(
errors
:
any
[])
=>
{
// Avoid failing with an array of errors, fail with a single error
if
(
errors
[
0
])
{
...
...
@@ -331,6 +335,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
let
globalState
=
new
ExtensionMemento
(
extensionDescription
.
id
,
true
,
this
.
_storage
);
let
workspaceState
=
new
ExtensionMemento
(
extensionDescription
.
id
,
false
,
this
.
_storage
);
this
.
_logService
.
trace
(
`ExtensionService#loadExtensionContext
${
extensionDescription
.
id
}
`
);
return
TPromise
.
join
([
globalState
.
whenReady
,
workspaceState
.
whenReady
,
...
...
@@ -347,22 +352,23 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
});
}
private
static
_callActivate
(
extensionModule
:
IExtensionModule
,
context
:
IExtensionContext
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
Thenable
<
ActivatedExtension
>
{
private
static
_callActivate
(
logService
:
ILogService
,
extensionId
:
string
,
extensionModule
:
IExtensionModule
,
context
:
IExtensionContext
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
Thenable
<
ActivatedExtension
>
{
// Make sure the extension's surface is not undefined
extensionModule
=
extensionModule
||
{
activate
:
undefined
,
deactivate
:
undefined
};
return
this
.
_callActivateOptional
(
extensionModule
,
context
,
activationTimesBuilder
).
then
((
extensionExports
)
=>
{
return
this
.
_callActivateOptional
(
logService
,
extensionId
,
extensionModule
,
context
,
activationTimesBuilder
).
then
((
extensionExports
)
=>
{
return
new
ActivatedExtension
(
false
,
activationTimesBuilder
.
build
(),
extensionModule
,
extensionExports
,
context
.
subscriptions
);
});
}
private
static
_callActivateOptional
(
extensionModule
:
IExtensionModule
,
context
:
IExtensionContext
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
Thenable
<
IExtensionAPI
>
{
private
static
_callActivateOptional
(
logService
:
ILogService
,
extensionId
:
string
,
extensionModule
:
IExtensionModule
,
context
:
IExtensionContext
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
Thenable
<
IExtensionAPI
>
{
if
(
typeof
extensionModule
.
activate
===
'
function
'
)
{
try
{
activationTimesBuilder
.
activateCallStart
();
logService
.
trace
(
`ExtensionService#_callActivateOptional
${
extensionId
}
`
);
const
activateResult
:
TPromise
<
IExtensionAPI
>
=
extensionModule
.
activate
.
apply
(
global
,
[
context
]);
activationTimesBuilder
.
activateCallStop
();
...
...
@@ -387,9 +393,10 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
}
}
function
loadCommonJSModule
<
T
>
(
modulePath
:
string
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
TPromise
<
T
>
{
function
loadCommonJSModule
<
T
>
(
logService
:
ILogService
,
modulePath
:
string
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
TPromise
<
T
>
{
let
r
:
T
=
null
;
activationTimesBuilder
.
codeLoadingStart
();
logService
.
info
(
`ExtensionService#loadCommonJSModule
${
modulePath
}
`
);
try
{
r
=
require
.
__$__nodeRequire
<
T
>
(
modulePath
);
}
catch
(
e
)
{
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
824a1b86
...
...
@@ -25,6 +25,7 @@ import { ExtensionActivatedByEvent } from 'vs/workbench/api/node/extHostExtensio
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
createLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
// const nativeExit = process.exit.bind(process);
function
patchProcess
(
allowExit
:
boolean
)
{
...
...
@@ -76,6 +77,7 @@ export class ExtensionHostMain {
private
_environment
:
IEnvironment
;
private
_extensionService
:
ExtHostExtensionService
;
private
_extHostConfiguration
:
ExtHostConfiguration
;
private
_logService
:
ILogService
;
private
disposables
:
IDisposable
[]
=
[];
constructor
(
rpcProtocol
:
RPCProtocol
,
initData
:
IInitData
)
{
...
...
@@ -89,14 +91,14 @@ export class ExtensionHostMain {
const
threadService
=
new
ExtHostThreadService
(
rpcProtocol
);
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
initData
.
execPath
);
const
logService
=
createLogService
(
`exthost
${
initData
.
windowId
}
`
,
environmentService
);
this
.
disposables
.
push
(
logService
);
this
.
_
logService
=
createLogService
(
`exthost
${
initData
.
windowId
}
`
,
environmentService
);
this
.
disposables
.
push
(
this
.
_
logService
);
logService
.
info
(
'
extension host started
'
);
logService
.
trace
(
'
initData
'
,
initData
);
this
.
_
logService
.
info
(
'
extension host started
'
);
this
.
_
logService
.
trace
(
'
initData
'
,
initData
);
this
.
_extHostConfiguration
=
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
extHostWorkspace
,
initData
.
configuration
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
extHostWorkspace
,
this
.
_extHostConfiguration
,
logService
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
extHostWorkspace
,
this
.
_extHostConfiguration
,
this
.
_
logService
);
// error forwarding and stack trace scanning
const
extensionErrors
=
new
WeakMap
<
Error
,
IExtensionDescription
>
();
...
...
@@ -138,7 +140,10 @@ export class ExtensionHostMain {
public
start
():
TPromise
<
void
>
{
return
this
.
_extensionService
.
onExtensionAPIReady
()
.
then
(()
=>
this
.
handleEagerExtensions
())
.
then
(()
=>
this
.
handleExtensionTests
());
.
then
(()
=>
this
.
handleExtensionTests
())
.
then
(()
=>
{
this
.
_logService
.
info
(
`eager extensions activated`
);
});
}
public
terminate
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录