Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
27082f3d
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,发现更多精彩内容 >>
未验证
提交
27082f3d
编写于
8月 26, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use an enum instead of a boolean to signal eager activation
上级
8871a289
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
27 deletion
+35
-27
src/vs/workbench/api/browser/mainThreadAuthentication.ts
src/vs/workbench/api/browser/mainThreadAuthentication.ts
+2
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+2
-2
src/vs/workbench/api/common/extHostExtensionService.ts
src/vs/workbench/api/common/extHostExtensionService.ts
+3
-3
src/vs/workbench/services/extensions/common/abstractExtensionService.ts
...ch/services/extensions/common/abstractExtensionService.ts
+9
-8
src/vs/workbench/services/extensions/common/extensionHostManager.ts
...kbench/services/extensions/common/extensionHostManager.ts
+7
-7
src/vs/workbench/services/extensions/common/extensions.ts
src/vs/workbench/services/extensions/common/extensions.ts
+12
-5
未找到文件。
src/vs/workbench/api/browser/mainThreadAuthentication.ts
浏览文件 @
27082f3d
...
...
@@ -17,7 +17,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import
{
IStorageKeysSyncRegistryService
}
from
'
vs/platform/userDataSync/common/storageKeys
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
fromNow
}
from
'
vs/base/common/date
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ActivationKind
,
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
Platform
,
platform
}
from
'
vs/base/common/platform
'
;
const
VSO_ALLOWED_EXTENSIONS
=
[
'
github.vscode-pull-request-github
'
,
'
github.vscode-pull-request-github-insiders
'
,
'
vscode.git
'
,
'
ms-vsonline.vsonline
'
,
'
vscode.github-browser
'
];
...
...
@@ -249,7 +249,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
}
$ensureProvider
(
id
:
string
):
Promise
<
void
>
{
return
this
.
extensionService
.
activateByEvent
(
getAuthenticationProviderActivationEvent
(
id
),
true
);
return
this
.
extensionService
.
activateByEvent
(
getAuthenticationProviderActivationEvent
(
id
),
ActivationKind
.
Eager
);
}
$sendDidChangeSessions
(
id
:
string
,
event
:
modes
.
AuthenticationSessionsChangeEvent
):
void
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
27082f3d
...
...
@@ -42,7 +42,7 @@ import { IRevealOptions, ITreeItem } from 'vs/workbench/common/views';
import
{
IAdapterDescriptor
,
IConfig
,
IDebugSessionReplMode
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
ITextQueryBuilderOptions
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
ITerminalDimensions
,
IShellLaunchConfig
,
ITerminalLaunchError
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ExtensionActivationError
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ActivationKind
,
ExtensionActivationError
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
createExtHostContextProxyIdentifier
as
createExtId
,
createMainContextProxyIdentifier
as
createMainId
,
IRPCProtocol
}
from
'
vs/workbench/services/extensions/common/proxyIdentifier
'
;
import
*
as
search
from
'
vs/workbench/services/search/common/search
'
;
import
{
SaveReason
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -1074,7 +1074,7 @@ export type IResolveAuthorityResult = IResolveAuthorityErrorResult | IResolveAut
export
interface
ExtHostExtensionServiceShape
{
$resolveAuthority
(
remoteAuthority
:
string
,
resolveAttempt
:
number
):
Promise
<
IResolveAuthorityResult
>
;
$startExtensionHost
(
enabledExtensionIds
:
ExtensionIdentifier
[]):
Promise
<
void
>
;
$activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
;
$activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
):
Promise
<
void
>
;
$activate
(
extensionId
:
ExtensionIdentifier
,
reason
:
ExtensionActivationReason
):
Promise
<
boolean
>
;
$setRemoteEnvironment
(
env
:
{
[
key
:
string
]:
string
|
null
;
}):
Promise
<
void
>
;
$updateRemoteConnectionData
(
connectionData
:
IRemoteConnectionData
):
Promise
<
void
>
;
...
...
src/vs/workbench/api/common/extHostExtensionService.ts
浏览文件 @
27082f3d
...
...
@@ -17,7 +17,7 @@ import { ExtHostConfiguration, IExtHostConfiguration } from 'vs/workbench/api/co
import
{
ActivatedExtension
,
EmptyExtension
,
ExtensionActivationReason
,
ExtensionActivationTimes
,
ExtensionActivationTimesBuilder
,
ExtensionsActivator
,
IExtensionAPI
,
IExtensionModule
,
HostExtension
,
ExtensionActivationTimesFragment
}
from
'
vs/workbench/api/common/extHostExtensionActivator
'
;
import
{
ExtHostStorage
,
IExtHostStorage
}
from
'
vs/workbench/api/common/extHostStorage
'
;
import
{
ExtHostWorkspace
,
IExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
ExtensionActivationError
,
checkProposedApiEnabled
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionActivationError
,
checkProposedApiEnabled
,
ActivationKind
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/common/extensionDescriptionRegistry
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
type
*
as
vscode
from
'
vscode
'
;
...
...
@@ -686,8 +686,8 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return
this
.
_startExtensionHost
();
}
public
$activateByEvent
(
activationEvent
:
string
,
eager
:
boolean
=
true
):
Promise
<
void
>
{
if
(
e
ager
)
{
public
$activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
):
Promise
<
void
>
{
if
(
activationKind
===
ActivationKind
.
E
ager
)
{
return
this
.
_activateByEvent
(
activationEvent
,
false
);
}
...
...
src/vs/workbench/services/extensions/common/abstractExtensionService.ts
浏览文件 @
27082f3d
...
...
@@ -15,7 +15,7 @@ import { BetterMergeId } from 'vs/platform/extensionManagement/common/extensionM
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ActivationTimes
,
ExtensionPointContribution
,
IExtensionService
,
IExtensionsStatus
,
IMessage
,
IWillActivateEvent
,
IResponsiveStateChangeEvent
,
toExtension
,
IExtensionHost
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ActivationTimes
,
ExtensionPointContribution
,
IExtensionService
,
IExtensionsStatus
,
IMessage
,
IWillActivateEvent
,
IResponsiveStateChangeEvent
,
toExtension
,
IExtensionHost
,
ActivationKind
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionMessageCollector
,
ExtensionPoint
,
ExtensionsRegistry
,
IExtensionPoint
,
IExtensionPointUser
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/common/extensionDescriptionRegistry
'
;
import
{
ResponsiveState
}
from
'
vs/workbench/services/extensions/common/rpcProtocol
'
;
...
...
@@ -186,7 +186,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
this
.
_startExtensionHosts
(
false
,
Array
.
from
(
this
.
_allRequestedActivateEvents
.
keys
()));
}
public
activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
{
public
activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
=
ActivationKind
.
Normal
):
Promise
<
void
>
{
if
(
this
.
_installedExtensionsReady
.
isOpen
())
{
// Extensions have been scanned and interpreted
...
...
@@ -198,24 +198,25 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
return
NO_OP_VOID_PROMISE
;
}
return
this
.
_activateByEvent
(
activationEvent
);
return
this
.
_activateByEvent
(
activationEvent
,
activationKind
);
}
else
{
// Extensions have not been scanned yet.
// Record the fact that this activationEvent was requested (in case of a restart)
this
.
_allRequestedActivateEvents
.
add
(
activationEvent
);
if
(
eager
)
{
return
this
.
_activateByEvent
(
activationEvent
,
eager
);
if
(
activationKind
===
ActivationKind
.
Eager
)
{
// Do not wait for the normal start-up of the extension host(s)
return
this
.
_activateByEvent
(
activationEvent
,
activationKind
);
}
return
this
.
_installedExtensionsReady
.
wait
().
then
(()
=>
this
.
_activateByEvent
(
activationEvent
));
return
this
.
_installedExtensionsReady
.
wait
().
then
(()
=>
this
.
_activateByEvent
(
activationEvent
,
activationKind
));
}
}
private
_activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
{
private
_activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
):
Promise
<
void
>
{
const
result
=
Promise
.
all
(
this
.
_extensionHostManagers
.
map
(
extHostManager
=>
extHostManager
.
activateByEvent
(
activationEvent
,
eager
))
this
.
_extensionHostManagers
.
map
(
extHostManager
=>
extHostManager
.
activateByEvent
(
activationEvent
,
activationKind
))
).
then
(()
=>
{
});
this
.
_onWillActivateByEvent
.
fire
({
event
:
activationEvent
,
...
...
src/vs/workbench/services/extensions/common/extensionHostManager.ts
浏览文件 @
27082f3d
...
...
@@ -21,7 +21,7 @@ import { registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
IExtensionHost
,
ExtensionHostKind
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IExtensionHost
,
ExtensionHostKind
,
ActivationKind
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionActivationReason
}
from
'
vs/workbench/api/common/extHostExtensionActivator
'
;
// Enable to see detailed message communication between window and extension host
...
...
@@ -76,7 +76,7 @@ export class ExtensionHostManager extends Disposable {
}
);
this
.
_proxy
.
then
(()
=>
{
initialActivationEvents
.
forEach
((
activationEvent
)
=>
this
.
activateByEvent
(
activationEvent
));
initialActivationEvents
.
forEach
((
activationEvent
)
=>
this
.
activateByEvent
(
activationEvent
,
ActivationKind
.
Normal
));
this
.
_register
(
registerLatencyTestProvider
({
measure
:
()
=>
this
.
measure
()
}));
...
...
@@ -219,18 +219,18 @@ export class ExtensionHostManager extends Disposable {
return
proxy
.
$activate
(
extension
,
reason
);
}
public
activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
{
if
(
e
ager
&&
!
this
.
_hasStarted
)
{
public
activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
):
Promise
<
void
>
{
if
(
activationKind
===
ActivationKind
.
E
ager
&&
!
this
.
_hasStarted
)
{
return
Promise
.
resolve
();
}
if
(
!
this
.
_cachedActivationEvents
.
has
(
activationEvent
))
{
this
.
_cachedActivationEvents
.
set
(
activationEvent
,
this
.
_activateByEvent
(
activationEvent
,
eager
));
this
.
_cachedActivationEvents
.
set
(
activationEvent
,
this
.
_activateByEvent
(
activationEvent
,
activationKind
));
}
return
this
.
_cachedActivationEvents
.
get
(
activationEvent
)
!
;
}
private
async
_activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
{
private
async
_activateByEvent
(
activationEvent
:
string
,
activationKind
:
ActivationKind
):
Promise
<
void
>
{
if
(
!
this
.
_proxy
)
{
return
;
}
...
...
@@ -240,7 +240,7 @@ export class ExtensionHostManager extends Disposable {
// i.e. the extension host could not be started
return
;
}
return
proxy
.
value
.
$activateByEvent
(
activationEvent
,
eager
);
return
proxy
.
value
.
$activateByEvent
(
activationEvent
,
activationKind
);
}
public
async
getInspectPort
(
tryEnableInspector
:
boolean
):
Promise
<
number
>
{
...
...
src/vs/workbench/services/extensions/common/extensions.ts
浏览文件 @
27082f3d
...
...
@@ -140,6 +140,11 @@ export interface IResponsiveStateChangeEvent {
isResponsive
:
boolean
;
}
export
const
enum
ActivationKind
{
Normal
=
0
,
Eager
=
1
}
export
interface
IExtensionService
{
readonly
_serviceBrand
:
undefined
;
...
...
@@ -178,12 +183,14 @@ export interface IExtensionService {
/**
* Send an activation event and activate interested extensions.
*
* Normally, this will queue the activation event if the extension hosts are not ready
* and send it to all of them. If the extension needs to be activated before this,
* the eager flag can be used to ignore extension hosts that aren't yet started. Do not
* use this flag unless necessary.
* This will wait for the normal startup of the extension host(s).
*
* In extraordinary circumstances, if the activation event needs to activate
* one or more extensions before the normal startup is finished, then you can use
* `ActivationKind.Eager`. Please do not use this flag unless really necessary
* and you understand all consequences.
*/
activateByEvent
(
activationEvent
:
string
,
eager
?:
boolean
):
Promise
<
void
>
;
activateByEvent
(
activationEvent
:
string
,
activationKind
?:
ActivationKind
):
Promise
<
void
>
;
/**
* An promise that resolves when the installed extensions are registered after
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录