Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
8f6c4465
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f6c4465
编写于
3月 06, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#45122 - Use ILocalExtension as an input in IExtensionEnablementService
上级
5f07044d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
52 addition
and
61 deletion
+52
-61
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
.../extensionManagement/common/extensionEnablementService.ts
+29
-34
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+2
-4
src/vs/platform/extensionManagement/test/common/extensionEnablementService.test.ts
...Management/test/common/extensionEnablementService.test.ts
+14
-14
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
...s/workbench/parts/extensions/browser/extensionsActions.ts
+1
-1
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+4
-4
src/vs/workbench/parts/preferences/electron-browser/preferencesSearch.ts
...h/parts/preferences/electron-browser/preferencesSearch.ts
+1
-1
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+0
-1
src/vs/workbench/services/issue/electron-browser/workbenchIssueService.ts
.../services/issue/electron-browser/workbenchIssueService.ts
+1
-2
未找到文件。
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
浏览文件 @
8f6c4465
...
...
@@ -5,11 +5,10 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
distinct
,
coalesce
}
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
,
IExtensionIdentifier
,
EnablementState
,
ILocalExtension
,
isIExtensionIdentifier
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
adoptToGalleryExtensionId
,
getIdFromLocalExtensionId
,
areSameExtensions
,
getGalleryExtensionIdFromLocal
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IExtensionManagementService
,
DidUninstallExtensionEvent
,
IExtensionEnablementService
,
IExtensionIdentifier
,
EnablementState
,
ILocalExtension
,
isIExtensionIdentifier
,
LocalExtensionType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getIdFromLocalExtensionId
,
areSameExtensions
,
getGalleryExtensionIdFromLocal
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -58,10 +57,11 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
TPromise
.
as
(
result
);
}
getEnablementState
(
identifier
:
IExtensionIdentifier
):
EnablementState
{
if
(
this
.
environmentService
.
disableExtensions
)
{
getEnablementState
(
extension
:
ILocalExtension
):
EnablementState
{
if
(
this
.
environmentService
.
disableExtensions
&&
extension
.
type
===
LocalExtensionType
.
User
)
{
return
EnablementState
.
Disabled
;
}
const
identifier
=
this
.
_getIdentifier
(
extension
);
if
(
this
.
hasWorkspace
)
{
if
(
this
.
_getEnabledExtensions
(
StorageScope
.
WORKSPACE
).
filter
(
e
=>
areSameExtensions
(
e
,
identifier
))[
0
])
{
return
EnablementState
.
WorkspaceEnabled
;
...
...
@@ -82,14 +82,14 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
}
setEnablement
(
arg
:
ILocalExtension
|
IExtensionIdentifier
,
newState
:
EnablementState
):
TPromise
<
boolean
>
{
let
identifier
;
let
identifier
:
IExtensionIdentifier
;
if
(
isIExtensionIdentifier
(
arg
))
{
identifier
=
arg
;
}
else
{
if
(
!
this
.
canChangeEnablement
(
arg
))
{
return
TPromise
.
wrap
(
false
);
}
identifier
=
{
id
:
getGalleryExtensionIdFromLocal
(
arg
),
uuid
:
arg
.
identifier
.
uuid
}
;
identifier
=
this
.
_getIdentifier
(
arg
)
;
}
const
workspace
=
newState
===
EnablementState
.
WorkspaceDisabled
||
newState
===
EnablementState
.
WorkspaceEnabled
;
...
...
@@ -97,7 +97,7 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
TPromise
.
wrapError
<
boolean
>
(
new
Error
(
localize
(
'
noWorkspace
'
,
"
No workspace.
"
)));
}
const
currentState
=
this
.
getEnablementState
(
identifier
);
const
currentState
=
this
.
_
getEnablementState
(
identifier
);
if
(
currentState
===
newState
)
{
return
TPromise
.
as
(
false
);
...
...
@@ -123,16 +123,29 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
TPromise
.
as
(
true
);
}
isEnabled
(
identifier
:
IExtensionIdentifier
):
boolean
{
const
enablementState
=
this
.
getEnablementState
(
identifier
);
isEnabled
(
extension
:
ILocalExtension
):
boolean
{
const
enablementState
=
this
.
getEnablementState
(
extension
);
return
enablementState
===
EnablementState
.
WorkspaceEnabled
||
enablementState
===
EnablementState
.
Enabled
;
}
migrateToIdentifiers
(
installed
:
IExtensionIdentifier
[]):
void
{
this
.
_migrateDisabledExtensions
(
installed
,
StorageScope
.
GLOBAL
);
private
_getEnablementState
(
identifier
:
IExtensionIdentifier
):
EnablementState
{
if
(
this
.
hasWorkspace
)
{
this
.
_migrateDisabledExtensions
(
installed
,
StorageScope
.
WORKSPACE
);
if
(
this
.
_getEnabledExtensions
(
StorageScope
.
WORKSPACE
).
filter
(
e
=>
areSameExtensions
(
e
,
identifier
))[
0
])
{
return
EnablementState
.
WorkspaceEnabled
;
}
if
(
this
.
_getDisabledExtensions
(
StorageScope
.
WORKSPACE
).
filter
(
e
=>
areSameExtensions
(
e
,
identifier
))[
0
])
{
return
EnablementState
.
WorkspaceDisabled
;
}
}
if
(
this
.
_getDisabledExtensions
(
StorageScope
.
GLOBAL
).
filter
(
e
=>
areSameExtensions
(
e
,
identifier
))[
0
])
{
return
EnablementState
.
Disabled
;
}
return
EnablementState
.
Enabled
;
}
private
_getIdentifier
(
extension
:
ILocalExtension
):
IExtensionIdentifier
{
return
{
id
:
getGalleryExtensionIdFromLocal
(
extension
),
uuid
:
extension
.
identifier
.
uuid
};
}
private
_enableExtension
(
identifier
:
IExtensionIdentifier
):
void
{
...
...
@@ -227,8 +240,8 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
this
.
_getExtensions
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
scope
);
}
private
_setDisabledExtensions
(
disabledExtensions
:
IExtensionIdentifier
[],
scope
:
StorageScope
,
extension
:
IExtensionIdentifier
,
fireEvent
=
true
):
void
{
this
.
_setExtensions
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
disabledExtensions
,
scope
,
extension
,
fireEvent
);
private
_setDisabledExtensions
(
disabledExtensions
:
IExtensionIdentifier
[],
scope
:
StorageScope
,
extension
:
IExtensionIdentifier
):
void
{
this
.
_setExtensions
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
disabledExtensions
,
scope
,
extension
);
}
private
_getExtensions
(
storageId
:
string
,
scope
:
StorageScope
):
IExtensionIdentifier
[]
{
...
...
@@ -239,30 +252,12 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
value
?
JSON
.
parse
(
value
)
:
[];
}
private
_setExtensions
(
storageId
:
string
,
extensions
:
IExtensionIdentifier
[],
scope
:
StorageScope
,
extension
:
IExtensionIdentifier
,
fireEvent
=
true
):
void
{
private
_setExtensions
(
storageId
:
string
,
extensions
:
IExtensionIdentifier
[],
scope
:
StorageScope
,
extension
:
IExtensionIdentifier
):
void
{
if
(
extensions
.
length
)
{
this
.
storageService
.
store
(
storageId
,
JSON
.
stringify
(
extensions
.
map
(({
id
,
uuid
})
=>
(
<
IExtensionIdentifier
>
{
id
,
uuid
}))),
scope
);
}
else
{
this
.
storageService
.
remove
(
storageId
,
scope
);
}
if
(
fireEvent
)
{
this
.
_onEnablementChanged
.
fire
(
extension
);
}
}
private
_migrateDisabledExtensions
(
installedExtensions
:
IExtensionIdentifier
[],
scope
:
StorageScope
):
void
{
const
oldValue
=
this
.
storageService
.
get
(
'
extensions/disabled
'
,
scope
,
''
);
if
(
oldValue
)
{
const
extensionIdentifiers
=
coalesce
(
distinct
(
oldValue
.
split
(
'
,
'
)).
map
(
id
=>
{
id
=
adoptToGalleryExtensionId
(
id
);
const
matched
=
installedExtensions
.
filter
(
installed
=>
areSameExtensions
({
id
},
{
id
:
installed
.
id
}))[
0
];
return
matched
?
{
id
:
matched
.
id
,
uuid
:
matched
.
uuid
}
:
null
;
}));
if
(
extensionIdentifiers
.
length
)
{
this
.
storageService
.
store
(
DISABLED_EXTENSIONS_STORAGE_PATH
,
JSON
.
stringify
(
extensionIdentifiers
),
scope
);
}
}
this
.
storageService
.
remove
(
'
extensions/disabled
'
,
scope
);
}
private
_onDidUninstallExtension
({
identifier
,
error
}:
DidUninstallExtensionEvent
):
void
{
...
...
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
8f6c4465
...
...
@@ -308,7 +308,7 @@ export interface IExtensionEnablementService {
/**
* Returns the enablement state for the given extension
*/
getEnablementState
(
identifier
:
IExtensionIdentifier
):
EnablementState
;
getEnablementState
(
extension
:
ILocalExtension
):
EnablementState
;
/**
* Returns `true` if the enablement can be changed.
...
...
@@ -318,7 +318,7 @@ export interface IExtensionEnablementService {
/**
* Returns `true` if the given extension identifier is enabled.
*/
isEnabled
(
identifier
:
IExtensionIdentifier
):
boolean
;
isEnabled
(
extension
:
ILocalExtension
):
boolean
;
/**
* Enable or disable the given extension.
...
...
@@ -334,8 +334,6 @@ export interface IExtensionEnablementService {
* TODO: @Sandy. Use setEnablement(extension: ILocalExtension, state: EnablementState): TPromise<boolean>. Use one model for extension management and runtime
*/
setEnablement
(
identifier
:
IExtensionIdentifier
,
state
:
EnablementState
):
TPromise
<
boolean
>
;
migrateToIdentifiers
(
installed
:
IExtensionIdentifier
[]):
void
;
}
export
const
IExtensionTipsService
=
createDecorator
<
IExtensionTipsService
>
(
'
extensionTipsService
'
);
...
...
src/vs/platform/extensionManagement/test/common/extensionEnablementService.test.ts
浏览文件 @
8f6c4465
...
...
@@ -98,13 +98,13 @@ suite('ExtensionEnablementService Test', () => {
test
(
'
test state of globally disabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
)
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Disabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Disabled
));
});
test
(
'
test state of globally enabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Enabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Enabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Enabled
));
});
test
(
'
test disable an extension for workspace
'
,
()
=>
{
...
...
@@ -126,59 +126,59 @@ suite('ExtensionEnablementService Test', () => {
test
(
'
test state of workspace disabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
WorkspaceDisabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
WorkspaceDisabled
));
});
test
(
'
test state of workspace and globally disabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
WorkspaceDisabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
WorkspaceDisabled
));
});
test
(
'
test state of workspace enabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceEnabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
WorkspaceEnabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
WorkspaceEnabled
));
});
test
(
'
test state of globally disabled and workspace enabled extension
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
))
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceEnabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
WorkspaceEnabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
WorkspaceEnabled
));
});
test
(
'
test state of an extension when disabled for workspace from workspace enabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceEnabled
))
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
WorkspaceDisabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
WorkspaceDisabled
));
});
test
(
'
test state of an extension when disabled globally from workspace enabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceEnabled
))
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Disabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Disabled
));
});
test
(
'
test state of an extension when disabled globally from workspace disabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Disabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Disabled
));
});
test
(
'
test state of an extension when enabled globally from workspace enabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceEnabled
))
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Enabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Enabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Enabled
));
});
test
(
'
test state of an extension when enabled globally from workspace disabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Enabled
))
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
{
id
:
'
pub.a
'
}
),
EnablementState
.
Enabled
));
.
then
(()
=>
assert
.
equal
(
testObject
.
getEnablementState
(
aLocalExtension
(
'
pub.a
'
)
),
EnablementState
.
Enabled
));
});
test
(
'
test disable an extension for workspace and then globally
'
,
()
=>
{
...
...
@@ -311,18 +311,18 @@ suite('ExtensionEnablementService Test', () => {
test
(
'
test isEnabled return false extension is disabled globally
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
Disabled
)
.
then
(()
=>
assert
.
ok
(
!
testObject
.
isEnabled
(
{
id
:
'
pub.a
'
}
)));
.
then
(()
=>
assert
.
ok
(
!
testObject
.
isEnabled
(
aLocalExtension
(
'
pub.a
'
)
)));
});
test
(
'
test isEnabled return false extension is disabled in workspace
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
assert
.
ok
(
!
testObject
.
isEnabled
(
{
id
:
'
pub.a
'
}
)));
.
then
(()
=>
assert
.
ok
(
!
testObject
.
isEnabled
(
aLocalExtension
(
'
pub.a
'
)
)));
});
test
(
'
test isEnabled return true extension is not disabled
'
,
()
=>
{
return
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.a
'
),
EnablementState
.
WorkspaceDisabled
)
.
then
(()
=>
testObject
.
setEnablement
(
aLocalExtension
(
'
pub.c
'
),
EnablementState
.
Disabled
))
.
then
(()
=>
assert
.
ok
(
testObject
.
isEnabled
(
{
id
:
'
pub.b
'
}
)));
.
then
(()
=>
assert
.
ok
(
testObject
.
isEnabled
(
aLocalExtension
(
'
pub.b
'
)
)));
});
test
(
'
test canChangeEnablement return false for language packs
'
,
()
=>
{
...
...
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
浏览文件 @
8f6c4465
...
...
@@ -926,7 +926,7 @@ export class ReloadAction extends Action {
private
computeReloadState
(
runningExtensions
:
IExtensionDescription
[]):
void
{
const
isInstalled
=
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
e
.
id
===
this
.
extension
.
id
);
const
isUninstalled
=
this
.
extension
.
state
===
ExtensionState
.
Uninstalled
;
const
isDisabled
=
!
this
.
extensionEnablementService
.
isEnabled
({
id
:
this
.
extension
.
id
,
uuid
:
this
.
extension
.
uuid
})
;
const
isDisabled
=
this
.
extension
.
local
?
!
this
.
extensionEnablementService
.
isEnabled
(
this
.
extension
.
local
)
:
false
;
const
filteredExtensions
=
runningExtensions
.
filter
(
e
=>
areSameExtensions
(
e
,
this
.
extension
));
const
isExtensionRunning
=
filteredExtensions
.
length
>
0
;
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
8f6c4465
...
...
@@ -419,7 +419,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
this
.
installed
=
result
.
map
(
local
=>
{
const
extension
=
installedById
[
local
.
identifier
.
id
]
||
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
local
,
null
,
this
.
telemetryService
);
extension
.
local
=
local
;
extension
.
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
{
id
:
extension
.
id
,
uuid
:
extension
.
uuid
}
);
extension
.
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
local
);
return
extension
;
});
...
...
@@ -890,10 +890,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
this
.
_onChange
.
fire
();
}
private
onEnablementChanged
(
extensionI
dentifier
:
IExtensionIdentifier
)
{
const
[
extension
]
=
this
.
local
.
filter
(
e
=>
areSameExtensions
(
e
,
extensionI
dentifier
));
private
onEnablementChanged
(
i
dentifier
:
IExtensionIdentifier
)
{
const
[
extension
]
=
this
.
local
.
filter
(
e
=>
areSameExtensions
(
e
,
i
dentifier
));
if
(
extension
)
{
const
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
{
id
:
extension
.
id
,
uuid
:
extension
.
uuid
}
);
const
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
extension
.
local
);
if
(
enablementState
!==
extension
.
enablementState
)
{
extension
.
enablementState
=
enablementState
;
this
.
_onChange
.
fire
();
...
...
src/vs/workbench/parts/preferences/electron-browser/preferencesSearch.ts
浏览文件 @
8f6c4465
...
...
@@ -44,7 +44,7 @@ export class PreferencesSearchService extends Disposable implements IPreferences
this
.
_installedExtensions
=
this
.
extensionManagementService
.
getInstalled
(
LocalExtensionType
.
User
).
then
(
exts
=>
{
// Filter to enabled extensions that have settings
return
exts
.
filter
(
ext
=>
this
.
extensionEnablementService
.
isEnabled
(
ext
.
identifier
))
.
filter
(
ext
=>
this
.
extensionEnablementService
.
isEnabled
(
ext
))
.
filter
(
ext
=>
ext
.
manifest
.
contributes
&&
ext
.
manifest
.
contributes
.
configuration
)
.
filter
(
ext
=>
!!
ext
.
identifier
.
uuid
);
});
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
8f6c4465
...
...
@@ -456,7 +456,6 @@ export class ExtensionService extends Disposable implements IExtensionService {
return
ExtensionService
.
_scanInstalledExtensions
(
this
.
_windowService
,
this
.
_choiceService
,
this
.
_environmentService
,
log
)
.
then
(({
system
,
user
,
development
})
=>
{
this
.
_extensionEnablementService
.
migrateToIdentifiers
(
user
);
// TODO: @sandy Remove it after couple of milestones
return
this
.
_extensionEnablementService
.
getDisabledExtensions
()
.
then
(
disabledExtensions
=>
{
let
result
:
{
[
extensionId
:
string
]:
IExtensionDescription
;
}
=
{};
...
...
src/vs/workbench/services/issue/electron-browser/workbenchIssueService.ts
浏览文件 @
8f6c4465
...
...
@@ -11,7 +11,6 @@ import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
import
{
textLinkForeground
,
inputBackground
,
inputBorder
,
inputForeground
,
buttonBackground
,
buttonHoverBackground
,
buttonForeground
,
inputValidationErrorBorder
,
foreground
,
inputActiveOptionBorder
,
scrollbarSliderActiveBackground
,
scrollbarSliderBackground
,
scrollbarSliderHoverBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
SIDE_BAR_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
IExtensionManagementService
,
IExtensionEnablementService
,
LocalExtensionType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getGalleryExtensionIdFromLocal
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
webFrame
}
from
'
electron
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IWorkbenchIssueService
}
from
'
vs/workbench/services/issue/common/issue
'
;
...
...
@@ -29,7 +28,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
openReporter
(
dataOverrides
:
Partial
<
IssueReporterData
>
=
{}):
TPromise
<
void
>
{
return
this
.
extensionManagementService
.
getInstalled
(
LocalExtensionType
.
User
).
then
(
extensions
=>
{
const
enabledExtensions
=
extensions
.
filter
(
extension
=>
this
.
extensionEnablementService
.
isEnabled
(
{
id
:
getGalleryExtensionIdFromLocal
(
extension
)
}
));
const
enabledExtensions
=
extensions
.
filter
(
extension
=>
this
.
extensionEnablementService
.
isEnabled
(
extension
));
const
theme
=
this
.
themeService
.
getTheme
();
const
issueReporterData
:
IssueReporterData
=
assign
(
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录