Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5a216728
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,发现更多精彩内容 >>
提交
5a216728
编写于
11月 02, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#14841 Listen to enablement changes
上级
322dff53
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
18 addition
and
11 deletion
+18
-11
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
.../extensionManagement/common/extensionEnablementService.ts
+8
-3
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+1
-1
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+9
-7
未找到文件。
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
浏览文件 @
5a216728
...
...
@@ -6,6 +6,7 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExtensionManagementService
,
DidUninstallExtensionEvent
,
IExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IWorkspaceContextService
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -22,6 +23,9 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
private
workspace
:
IWorkspace
;
private
disposables
:
IDisposable
[]
=
[];
private
_onEnablementChanged
=
new
Emitter
<
string
>
();
public
onEnablementChanged
:
Event
<
string
>
=
this
.
_onEnablementChanged
.
event
;
constructor
(
@
IStorageService
private
storageService
:
IStorageService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
...
...
@@ -98,7 +102,7 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
private
disableExtension
(
identifier
:
string
,
scope
:
StorageScope
):
TPromise
<
boolean
>
{
let
disabledExtensions
=
this
.
_getDisabledExtensions
(
scope
);
disabledExtensions
.
push
(
identifier
);
this
.
_setDisabledExtensions
(
disabledExtensions
,
scope
);
this
.
_setDisabledExtensions
(
disabledExtensions
,
scope
,
identifier
);
return
TPromise
.
wrap
(
true
);
}
...
...
@@ -107,7 +111,7 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
const
index
=
disabledExtensions
.
indexOf
(
identifier
);
if
(
index
!==
-
1
)
{
disabledExtensions
.
splice
(
index
,
1
);
this
.
_setDisabledExtensions
(
disabledExtensions
,
scope
);
this
.
_setDisabledExtensions
(
disabledExtensions
,
scope
,
identifier
);
}
return
TPromise
.
wrap
(
true
);
}
...
...
@@ -117,12 +121,13 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
value
?
distinct
(
value
.
split
(
'
,
'
))
:
[];
}
private
_setDisabledExtensions
(
disabledExtensions
:
string
[],
scope
:
StorageScope
):
void
{
private
_setDisabledExtensions
(
disabledExtensions
:
string
[],
scope
:
StorageScope
,
extension
:
string
):
void
{
if
(
disabledExtensions
.
length
)
{
this
.
storageService
.
store
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
disabledExtensions
.
join
(
'
,
'
),
scope
);
}
else
{
this
.
storageService
.
remove
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
scope
);
}
this
.
_onEnablementChanged
.
fire
(
extension
);
}
private
onDidUninstallExtension
({
id
,
error
}:
DidUninstallExtensionEvent
):
void
{
...
...
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
5a216728
...
...
@@ -242,7 +242,7 @@ export interface IExtensionEnablementService {
/**
* Event to listen on for extension enablement changes
*/
//
onEnablementChanged: Event<string>;
onEnablementChanged
:
Event
<
string
>
;
/**
* Returns all globally disabled extension identifiers.
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
5a216728
...
...
@@ -319,6 +319,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
extensionService
.
onDidInstallExtension
(
this
.
onDidInstallExtension
,
this
,
this
.
disposables
);
extensionService
.
onUninstallExtension
(
this
.
onUninstallExtension
,
this
,
this
.
disposables
);
extensionService
.
onDidUninstallExtension
(
this
.
onDidUninstallExtension
,
this
,
this
.
disposables
);
extensionEnablementService
.
onEnablementChanged
(
this
.
onEnablementChanged
,
this
,
this
.
disposables
);
this
.
syncDelayer
=
new
ThrottledDelayer
<
void
>
(
ExtensionsWorkbenchService
.
SyncPeriod
);
this
.
autoUpdateDelayer
=
new
ThrottledDelayer
<
void
>
(
1000
);
...
...
@@ -484,7 +485,6 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
return
this
.
doSetEnablement
(
extension
,
enable
,
workspace
).
then
(
reload
=>
{
this
.
updatedDisableFlags
(
extension
);
this
.
telemetryService
.
publicLog
(
enable
?
'
extension:enable
'
:
'
extension:disable
'
,
extension
.
telemetryData
);
this
.
_onChange
.
fire
();
});
...
...
@@ -599,19 +599,21 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
if
(
!
error
)
{
this
.
updatedDisableFlags
(
uninstalling
.
extension
);
this
.
reportTelemetry
(
uninstalling
,
true
);
}
this
.
_onChange
.
fire
();
}
private
updatedDisableFlags
(
extension
:
IExtension
)
{
private
onEnablementChanged
(
extensionIdentifier
:
string
)
{
const
[
extension
]
=
this
.
local
.
filter
(
e
=>
e
.
identifier
===
extensionIdentifier
);
if
(
extension
)
{
const
globallyDisabledExtensions
=
this
.
extensionEnablementService
.
getGloballyDisabledExtensions
();
const
workspaceDisabledExtensions
=
this
.
extensionEnablementService
.
getWorkspaceDisabledExtensions
();
extension
.
disabledGlobally
=
globallyDisabledExtensions
.
indexOf
(
extension
.
identifier
)
!==
-
1
;
extension
.
disabledForWorkspace
=
workspaceDisabledExtensions
.
indexOf
(
extension
.
identifier
)
!==
-
1
;
}
}
private
getExtensionState
(
extension
:
Extension
):
ExtensionState
{
if
(
extension
.
gallery
&&
this
.
installing
.
some
(
e
=>
e
.
extension
.
gallery
.
id
===
extension
.
gallery
.
id
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录