Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4cb12d10
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,发现更多精彩内容 >>
提交
4cb12d10
编写于
1月 29, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test failures
上级
95be625a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
38 deletion
+22
-38
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
.../extensionManagement/common/extensionEnablementService.ts
+7
-7
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+3
-3
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
...form/extensionManagement/common/extensionManagementIpc.ts
+1
-1
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
.../test/electron-browser/extensionsWorkbenchService.test.ts
+0
-20
src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts
.../extensionManagement/common/extensionEnablementService.ts
+11
-7
未找到文件。
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
浏览文件 @
4cb12d10
...
...
@@ -14,8 +14,8 @@ export class GlobalExtensionEnablementService extends Disposable implements IGlo
_serviceBrand
:
undefined
;
private
_onDidChangeEnablement
=
new
Emitter
<
readonly
IExtensionIdentifier
[]
>
();
readonly
onDidChangeEnablement
:
Event
<
readonly
IExtensionIdentifier
[]
>
=
this
.
_onDidChangeEnablement
.
event
;
private
_onDidChangeEnablement
=
new
Emitter
<
{
readonly
extensions
:
IExtensionIdentifier
[],
readonly
source
?:
string
}
>
();
readonly
onDidChangeEnablement
:
Event
<
{
readonly
extensions
:
IExtensionIdentifier
[],
readonly
source
?:
string
}
>
=
this
.
_onDidChangeEnablement
.
event
;
private
readonly
storageManger
:
StorageManager
;
constructor
(
...
...
@@ -23,20 +23,20 @@ export class GlobalExtensionEnablementService extends Disposable implements IGlo
)
{
super
();
this
.
storageManger
=
this
.
_register
(
new
StorageManager
(
storageService
));
this
.
_register
(
this
.
storageManger
.
onDidChange
(
extensions
=>
this
.
_onDidChangeEnablement
.
fire
(
extensions
)));
this
.
_register
(
this
.
storageManger
.
onDidChange
(
extensions
=>
this
.
_onDidChangeEnablement
.
fire
(
{
extensions
,
source
:
'
storage
'
}
)));
}
async
enableExtension
(
extension
:
IExtensionIdentifier
):
Promise
<
boolean
>
{
async
enableExtension
(
extension
:
IExtensionIdentifier
,
source
?:
string
):
Promise
<
boolean
>
{
if
(
this
.
_removeFromDisabledExtensions
(
extension
))
{
this
.
_onDidChangeEnablement
.
fire
(
[
extension
]
);
this
.
_onDidChangeEnablement
.
fire
(
{
extensions
:
[
extension
],
source
}
);
return
true
;
}
return
false
;
}
async
disableExtension
(
extension
:
IExtensionIdentifier
):
Promise
<
boolean
>
{
async
disableExtension
(
extension
:
IExtensionIdentifier
,
source
?:
string
):
Promise
<
boolean
>
{
if
(
this
.
_addToDisabledExtensions
(
extension
))
{
this
.
_onDidChangeEnablement
.
fire
(
[
extension
]
);
this
.
_onDidChangeEnablement
.
fire
(
{
extensions
:
[
extension
],
source
}
);
return
true
;
}
return
false
;
...
...
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
4cb12d10
...
...
@@ -213,11 +213,11 @@ export const IGlobalExtensionEnablementService = createDecorator<IGlobalExtensio
export
interface
IGlobalExtensionEnablementService
{
_serviceBrand
:
undefined
;
readonly
onDidChangeEnablement
:
Event
<
readonly
IExtensionIdentifier
[]
>
;
readonly
onDidChangeEnablement
:
Event
<
{
readonly
extensions
:
IExtensionIdentifier
[],
readonly
source
?:
string
}
>
;
getDisabledExtensions
():
IExtensionIdentifier
[];
enableExtension
(
extension
:
IExtensionIdentifier
):
Promise
<
boolean
>
;
disableExtension
(
extension
:
IExtensionIdentifier
):
Promise
<
boolean
>
;
enableExtension
(
extension
:
IExtensionIdentifier
,
source
?:
string
):
Promise
<
boolean
>
;
disableExtension
(
extension
:
IExtensionIdentifier
,
source
?:
string
):
Promise
<
boolean
>
;
// Async method until storage service is available in shared process
getDisabledExtensionsAsync
():
Promise
<
IExtensionIdentifier
[]
>
;
...
...
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
浏览文件 @
4cb12d10
...
...
@@ -156,7 +156,7 @@ export class GlobalExtensionEnablementServiceClient implements IGlobalExtensionE
_serviceBrand
:
undefined
;
get
onDidChangeEnablement
():
Event
<
IExtensionIdentifier
[]
>
{
return
this
.
channel
.
listen
(
'
onDidChangeEnablement
'
);
}
get
onDidChangeEnablement
():
Event
<
{
readonly
extensions
:
IExtensionIdentifier
[],
readonly
source
?:
string
}
>
{
return
this
.
channel
.
listen
(
'
onDidChangeEnablement
'
);
}
constructor
(
private
readonly
channel
:
IChannel
)
{
}
...
...
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
浏览文件 @
4cb12d10
...
...
@@ -942,16 +942,6 @@ suite('ExtensionsWorkbenchServiceTest', () => {
});
});
test
(
'
test installing an extension re-eanbles it when disabled globally
'
,
async
()
=>
{
testObject
=
await
aWorkbenchService
();
const
local
=
aLocalExtension
(
'
pub.a
'
);
await
instantiationService
.
get
(
IWorkbenchExtensionEnablementService
).
setEnablement
([
local
],
EnablementState
.
DisabledGlobally
);
didInstallEvent
.
fire
({
local
,
identifier
:
local
.
identifier
,
operation
:
InstallOperation
.
Install
});
instantiationService
.
stubPromise
(
IExtensionManagementService
,
'
getInstalled
'
,
[
local
]);
const
actual
=
await
testObject
.
queryLocal
();
assert
.
equal
(
actual
[
0
].
enablementState
,
EnablementState
.
EnabledGlobally
);
});
test
(
'
test updating an extension does not re-eanbles it when disabled globally
'
,
async
()
=>
{
testObject
=
await
aWorkbenchService
();
const
local
=
aLocalExtension
(
'
pub.a
'
);
...
...
@@ -962,16 +952,6 @@ suite('ExtensionsWorkbenchServiceTest', () => {
assert
.
equal
(
actual
[
0
].
enablementState
,
EnablementState
.
DisabledGlobally
);
});
test
(
'
test installing an extension re-eanbles it when workspace disabled
'
,
async
()
=>
{
testObject
=
await
aWorkbenchService
();
const
local
=
aLocalExtension
(
'
pub.a
'
);
await
instantiationService
.
get
(
IWorkbenchExtensionEnablementService
).
setEnablement
([
local
],
EnablementState
.
DisabledWorkspace
);
didInstallEvent
.
fire
({
local
,
identifier
:
local
.
identifier
,
operation
:
InstallOperation
.
Install
});
instantiationService
.
stubPromise
(
IExtensionManagementService
,
'
getInstalled
'
,
[
local
]);
const
actual
=
await
testObject
.
queryLocal
();
assert
.
equal
(
actual
[
0
].
enablementState
,
EnablementState
.
EnabledGlobally
);
});
test
(
'
test updating an extension does not re-eanbles it when workspace disabled
'
,
async
()
=>
{
testObject
=
await
aWorkbenchService
();
const
local
=
aLocalExtension
(
'
pub.a
'
);
...
...
src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts
浏览文件 @
4cb12d10
...
...
@@ -19,6 +19,8 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
StorageManager
}
from
'
vs/platform/extensionManagement/common/extensionEnablementService
'
;
const
SOURCE
=
'
IWorkbenchExtensionEnablementService
'
;
export
class
ExtensionEnablementService
extends
Disposable
implements
IWorkbenchExtensionEnablementService
{
_serviceBrand
:
undefined
;
...
...
@@ -40,7 +42,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
)
{
super
();
this
.
storageManger
=
this
.
_register
(
new
StorageManager
(
storageService
));
this
.
_register
(
this
.
globalExtensionEnablementService
.
onDidChangeEnablement
(
extensions
=>
this
.
onDidChangeExtensions
(
extensions
)));
this
.
_register
(
this
.
globalExtensionEnablementService
.
onDidChangeEnablement
(
({
extensions
,
source
})
=>
this
.
onDidChangeExtensions
(
extensions
,
source
)));
this
.
_register
(
extensionManagementService
.
onDidUninstallExtension
(
this
.
_onDidUninstallExtension
,
this
));
}
...
...
@@ -169,13 +171,13 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
private
_enableExtension
(
identifier
:
IExtensionIdentifier
):
Promise
<
boolean
>
{
this
.
_removeFromWorkspaceDisabledExtensions
(
identifier
);
this
.
_removeFromWorkspaceEnabledExtensions
(
identifier
);
return
this
.
globalExtensionEnablementService
.
enableExtension
(
identifier
);
return
this
.
globalExtensionEnablementService
.
enableExtension
(
identifier
,
SOURCE
);
}
private
_disableExtension
(
identifier
:
IExtensionIdentifier
):
Promise
<
boolean
>
{
this
.
_removeFromWorkspaceDisabledExtensions
(
identifier
);
this
.
_removeFromWorkspaceEnabledExtensions
(
identifier
);
return
this
.
globalExtensionEnablementService
.
disableExtension
(
identifier
);
return
this
.
globalExtensionEnablementService
.
disableExtension
(
identifier
,
SOURCE
);
}
private
_enableExtensionInWorkspace
(
identifier
:
IExtensionIdentifier
):
void
{
...
...
@@ -273,10 +275,12 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
this
.
storageManger
.
set
(
storageId
,
extensions
,
StorageScope
.
WORKSPACE
);
}
private
async
onDidChangeExtensions
(
extensionIdentifiers
:
ReadonlyArray
<
IExtensionIdentifier
>
):
Promise
<
void
>
{
const
installedExtensions
=
await
this
.
extensionManagementService
.
getInstalled
();
const
extensions
=
installedExtensions
.
filter
(
installedExtension
=>
extensionIdentifiers
.
some
(
identifier
=>
areSameExtensions
(
identifier
,
installedExtension
.
identifier
)));
this
.
_onEnablementChanged
.
fire
(
extensions
);
private
async
onDidChangeExtensions
(
extensionIdentifiers
:
ReadonlyArray
<
IExtensionIdentifier
>
,
source
?:
string
):
Promise
<
void
>
{
if
(
source
!==
SOURCE
)
{
const
installedExtensions
=
await
this
.
extensionManagementService
.
getInstalled
();
const
extensions
=
installedExtensions
.
filter
(
installedExtension
=>
extensionIdentifiers
.
some
(
identifier
=>
areSameExtensions
(
identifier
,
installedExtension
.
identifier
)));
this
.
_onEnablementChanged
.
fire
(
extensions
);
}
}
private
_onDidUninstallExtension
({
identifier
,
error
}:
DidUninstallExtensionEvent
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录