Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
acd7df14
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,发现更多精彩内容 >>
未验证
提交
acd7df14
编写于
11月 21, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use ILogService instead of console (#84283)
上级
770877f0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
25 deletion
+34
-25
src/vs/workbench/api/common/extHostExtensionActivator.ts
src/vs/workbench/api/common/extHostExtensionActivator.ts
+10
-7
src/vs/workbench/api/common/extHostExtensionService.ts
src/vs/workbench/api/common/extHostExtensionService.ts
+24
-18
未找到文件。
src/vs/workbench/api/common/extHostExtensionActivator.ts
浏览文件 @
acd7df14
...
...
@@ -9,6 +9,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/common/extensionDescriptionRegistry
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtensionActivationError
,
MissingDependencyError
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
const
NO_OP_VOID_PROMISE
=
Promise
.
resolve
<
void
>
(
undefined
);
...
...
@@ -182,7 +183,13 @@ export class ExtensionsActivator {
*/
private
readonly
_alreadyActivatedEvents
:
{
[
activationEvent
:
string
]:
boolean
;
};
constructor
(
registry
:
ExtensionDescriptionRegistry
,
resolvedExtensions
:
ExtensionIdentifier
[],
hostExtensions
:
ExtensionIdentifier
[],
host
:
IExtensionsActivatorHost
)
{
constructor
(
registry
:
ExtensionDescriptionRegistry
,
resolvedExtensions
:
ExtensionIdentifier
[],
hostExtensions
:
ExtensionIdentifier
[],
host
:
IExtensionsActivatorHost
,
@
ILogService
private
readonly
_logService
:
ILogService
)
{
this
.
_registry
=
registry
;
this
.
_resolvedExtensionsSet
=
new
Set
<
string
>
();
resolvedExtensions
.
forEach
((
extensionId
)
=>
this
.
_resolvedExtensionsSet
.
add
(
ExtensionIdentifier
.
toKey
(
extensionId
)));
...
...
@@ -308,7 +315,6 @@ export class ExtensionsActivator {
}
private
_activateExtensions
(
extensions
:
ActivationIdAndReason
[]):
Promise
<
void
>
{
// console.log('_activateExtensions: ', extensions.map(p => p.id.value));
if
(
extensions
.
length
===
0
)
{
return
Promise
.
resolve
(
undefined
);
}
...
...
@@ -335,9 +341,6 @@ export class ExtensionsActivator {
const
green
=
Object
.
keys
(
greenMap
).
map
(
id
=>
greenMap
[
id
]);
// console.log('greenExtensions: ', green.map(p => p.id.value));
// console.log('redExtensions: ', red.map(p => p.id.value));
if
(
red
.
length
===
0
)
{
// Finally reached only leafs!
return
Promise
.
all
(
green
.
map
((
p
)
=>
this
.
_activateExtension
(
p
.
id
,
p
.
reason
))).
then
(
_
=>
undefined
);
...
...
@@ -362,8 +365,8 @@ export class ExtensionsActivator {
const
newlyActivatingExtension
=
this
.
_host
.
actualActivateExtension
(
extensionId
,
reason
).
then
(
undefined
,
(
err
)
=>
{
this
.
_host
.
onExtensionActivationError
(
extensionId
,
nls
.
localize
(
'
activationError
'
,
"
Activating extension '{0}' failed: {1}.
"
,
extensionId
.
value
,
err
.
message
));
console
.
error
(
'
Activating extension `
'
+
extensionId
.
value
+
'
` failed:
'
,
err
.
message
);
console
.
log
(
'
Here is the error stack:
'
,
err
.
stack
);
this
.
_logService
.
error
(
`Activating extension
${
extensionId
.
value
}
failed due to an error:`
);
this
.
_logService
.
error
(
err
);
// Treat the extension as being empty
return
new
FailedExtension
(
err
);
}).
then
((
x
:
ActivatedExtension
)
=>
{
...
...
src/vs/workbench/api/common/extHostExtensionService.ts
浏览文件 @
acd7df14
...
...
@@ -133,20 +133,26 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
const
hostExtensions
=
new
Set
<
string
>
();
this
.
_initData
.
hostExtensions
.
forEach
((
extensionId
)
=>
hostExtensions
.
add
(
ExtensionIdentifier
.
toKey
(
extensionId
)));
this
.
_activator
=
new
ExtensionsActivator
(
this
.
_registry
,
this
.
_initData
.
resolvedExtensions
,
this
.
_initData
.
hostExtensions
,
{
onExtensionActivationError
:
(
extensionId
:
ExtensionIdentifier
,
error
:
ExtensionActivationError
):
void
=>
{
this
.
_mainThreadExtensionsProxy
.
$onExtensionActivationError
(
extensionId
,
error
);
},
actualActivateExtension
:
async
(
extensionId
:
ExtensionIdentifier
,
reason
:
ExtensionActivationReason
):
Promise
<
ActivatedExtension
>
=>
{
if
(
hostExtensions
.
has
(
ExtensionIdentifier
.
toKey
(
extensionId
)))
{
await
this
.
_mainThreadExtensionsProxy
.
$activateExtension
(
extensionId
,
reason
);
return
new
HostExtension
();
this
.
_activator
=
new
ExtensionsActivator
(
this
.
_registry
,
this
.
_initData
.
resolvedExtensions
,
this
.
_initData
.
hostExtensions
,
{
onExtensionActivationError
:
(
extensionId
:
ExtensionIdentifier
,
error
:
ExtensionActivationError
):
void
=>
{
this
.
_mainThreadExtensionsProxy
.
$onExtensionActivationError
(
extensionId
,
error
);
},
actualActivateExtension
:
async
(
extensionId
:
ExtensionIdentifier
,
reason
:
ExtensionActivationReason
):
Promise
<
ActivatedExtension
>
=>
{
if
(
hostExtensions
.
has
(
ExtensionIdentifier
.
toKey
(
extensionId
)))
{
await
this
.
_mainThreadExtensionsProxy
.
$activateExtension
(
extensionId
,
reason
);
return
new
HostExtension
();
}
const
extensionDescription
=
this
.
_registry
.
getExtensionDescription
(
extensionId
)
!
;
return
this
.
_activateExtension
(
extensionDescription
,
reason
);
}
const
extensionDescription
=
this
.
_registry
.
getExtensionDescription
(
extensionId
)
!
;
return
this
.
_activateExtension
(
extensionDescription
,
reason
);
}
});
},
this
.
_logService
);
this
.
_extensionPathIndex
=
null
;
this
.
_resolvers
=
Object
.
create
(
null
);
this
.
_started
=
false
;
...
...
@@ -405,7 +411,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
// Handle "eager" activation extensions
private
_handleEagerExtensions
():
Promise
<
void
>
{
this
.
_activateByEvent
(
'
*
'
,
true
).
then
(
undefined
,
(
err
)
=>
{
consol
e
.
error
(
err
);
this
.
_logServic
e
.
error
(
err
);
});
this
.
_disposables
.
add
(
this
.
_extHostWorkspace
.
onDidChangeWorkspace
((
e
)
=>
this
.
_handleWorkspaceContainsEagerExtensions
(
e
.
added
)));
...
...
@@ -467,7 +473,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
// the file was found
return
(
this
.
_activateById
(
extensionId
,
{
startup
:
true
,
extensionId
,
activationEvent
:
`workspaceContains:
${
fileName
}
`
})
.
then
(
undefined
,
err
=>
consol
e
.
error
(
err
))
.
then
(
undefined
,
err
=>
this
.
_logServic
e
.
error
(
err
))
);
}
}
...
...
@@ -488,7 +494,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
const
timer
=
setTimeout
(
async
()
=>
{
tokenSource
.
cancel
();
this
.
_activateById
(
extensionId
,
{
startup
:
true
,
extensionId
,
activationEvent
:
`workspaceContainsTimeout:
${
globPatterns
.
join
(
'
,
'
)}
`
})
.
then
(
undefined
,
err
=>
consol
e
.
error
(
err
));
.
then
(
undefined
,
err
=>
this
.
_logServic
e
.
error
(
err
));
},
AbstractExtHostExtensionService
.
WORKSPACE_CONTAINS_TIMEOUT
);
let
exists
:
boolean
=
false
;
...
...
@@ -496,7 +502,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
exists
=
await
searchP
;
}
catch
(
err
)
{
if
(
!
errors
.
isPromiseCanceledError
(
err
))
{
consol
e
.
error
(
err
);
this
.
_logServic
e
.
error
(
err
);
}
}
...
...
@@ -507,7 +513,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
// a file was found matching one of the glob patterns
return
(
this
.
_activateById
(
extensionId
,
{
startup
:
true
,
extensionId
,
activationEvent
:
`workspaceContains:
${
globPatterns
.
join
(
'
,
'
)}
`
})
.
then
(
undefined
,
err
=>
consol
e
.
error
(
err
))
.
then
(
undefined
,
err
=>
this
.
_logServic
e
.
error
(
err
))
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录