Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
50ac47da
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,发现更多精彩内容 >>
提交
50ac47da
编写于
1月 18, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #41755
上级
7d343c6b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1055 addition
and
907 deletion
+1055
-907
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
.../extensionManagement/common/extensionEnablementService.ts
+12
-6
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+12
-1
src/vs/platform/extensionManagement/test/common/extensionEnablementService.test.ts
...Management/test/common/extensionEnablementService.test.ts
+95
-82
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
...s/workbench/parts/extensions/browser/extensionsActions.ts
+4
-4
src/vs/workbench/parts/extensions/common/extensions.ts
src/vs/workbench/parts/extensions/common/extensions.ts
+2
-1
src/vs/workbench/parts/extensions/electron-browser/extensionsUtils.ts
...ench/parts/extensions/electron-browser/extensionsUtils.ts
+1
-1
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+1
-1
src/vs/workbench/parts/extensions/test/electron-browser/extensionsActions.test.ts
...xtensions/test/electron-browser/extensionsActions.test.ts
+636
-610
src/vs/workbench/parts/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
.../test/electron-browser/extensionsWorkbenchService.test.ts
+292
-201
未找到文件。
src/vs/platform/extensionManagement/common/extensionEnablementService.ts
浏览文件 @
50ac47da
...
...
@@ -8,7 +8,7 @@ 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
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IExtensionManagementService
,
DidUninstallExtensionEvent
,
IExtensionEnablementService
,
IExtensionIdentifier
,
EnablementState
,
ILocalExtension
,
isIExtensionIdentifier
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
adoptToGalleryExtensionId
,
getIdFromLocalExtensionId
,
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -77,13 +77,19 @@ export class ExtensionEnablementService implements IExtensionEnablementService {
return
EnablementState
.
Enabled
;
}
canChangeEnablement
():
boolean
{
return
!
this
.
environmentService
.
disableExtensions
;
canChangeEnablement
(
extension
:
ILocalExtension
):
boolean
{
return
!
this
.
environmentService
.
disableExtensions
&&
!
(
extension
.
manifest
&&
extension
.
manifest
.
contributes
&&
extension
.
manifest
.
contributes
.
locales
&&
extension
.
manifest
.
contributes
.
locales
.
length
)
;
}
setEnablement
(
identifier
:
IExtensionIdentifier
,
newState
:
EnablementState
):
TPromise
<
boolean
>
{
if
(
this
.
environmentService
.
disableExtensions
)
{
return
TPromise
.
wrap
(
false
);
setEnablement
(
arg
:
ILocalExtension
|
IExtensionIdentifier
,
newState
:
EnablementState
):
TPromise
<
boolean
>
{
let
identifier
;
if
(
isIExtensionIdentifier
(
arg
))
{
identifier
=
arg
;
}
else
{
if
(
!
this
.
canChangeEnablement
(
arg
))
{
return
TPromise
.
wrap
(
false
);
}
identifier
=
{
id
:
getIdFromLocalExtensionId
(
arg
.
identifier
.
id
),
uuid
:
arg
.
identifier
.
uuid
};
}
const
workspace
=
newState
===
EnablementState
.
WorkspaceDisabled
||
newState
===
EnablementState
.
WorkspaceEnabled
;
...
...
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
50ac47da
...
...
@@ -142,6 +142,13 @@ export interface IGalleryExtensionAssets {
repository
:
IGalleryExtensionAsset
;
}
export
function
isIExtensionIdentifier
(
thing
:
any
):
thing
is
IExtensionIdentifier
{
return
thing
&&
typeof
thing
===
'
object
'
&&
typeof
thing
.
id
===
'
string
'
&&
(
!
thing
.
uuid
||
typeof
thing
.
uuid
===
'
string
'
);
}
export
interface
IExtensionIdentifier
{
id
:
string
;
uuid
?:
string
;
...
...
@@ -301,7 +308,7 @@ export interface IExtensionEnablementService {
/**
* Returns `true` if the enablement can be changed.
*/
canChangeEnablement
():
boolean
;
canChangeEnablement
(
extension
:
ILocalExtension
):
boolean
;
/**
* Returns `true` if the given extension identifier is enabled.
...
...
@@ -317,6 +324,10 @@ export interface IExtensionEnablementService {
*
* Throws error if enablement is requested for workspace and there is no workspace
*/
setEnablement
(
extension
:
ILocalExtension
,
state
:
EnablementState
):
TPromise
<
boolean
>
;
/**
* 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
;
...
...
src/vs/platform/extensionManagement/test/common/extensionEnablementService.test.ts
浏览文件 @
50ac47da
此差异已折叠。
点击以展开。
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
浏览文件 @
50ac47da
...
...
@@ -437,7 +437,7 @@ export class EnableForWorkspaceAction extends Action implements IExtensionAction
private
update
():
void
{
this
.
enabled
=
false
;
if
(
this
.
extension
)
{
this
.
enabled
=
(
this
.
extension
.
enablementState
===
EnablementState
.
Disabled
||
this
.
extension
.
enablementState
===
EnablementState
.
WorkspaceDisabled
)
&&
this
.
extension
EnablementService
.
canChangeEnablement
(
);
this
.
enabled
=
(
this
.
extension
.
enablementState
===
EnablementState
.
Disabled
||
this
.
extension
.
enablementState
===
EnablementState
.
WorkspaceDisabled
)
&&
this
.
extension
.
local
&&
this
.
extensionEnablementService
.
canChangeEnablement
(
this
.
extension
.
local
);
}
}
...
...
@@ -475,7 +475,7 @@ export class EnableGloballyAction extends Action implements IExtensionAction {
private
update
():
void
{
this
.
enabled
=
false
;
if
(
this
.
extension
)
{
this
.
enabled
=
(
this
.
extension
.
enablementState
===
EnablementState
.
Disabled
||
this
.
extension
.
enablementState
===
EnablementState
.
WorkspaceDisabled
)
&&
this
.
extension
EnablementService
.
canChangeEnablement
(
);
this
.
enabled
=
(
this
.
extension
.
enablementState
===
EnablementState
.
Disabled
||
this
.
extension
.
enablementState
===
EnablementState
.
WorkspaceDisabled
)
&&
this
.
extension
.
local
&&
this
.
extensionEnablementService
.
canChangeEnablement
(
this
.
extension
.
local
);
}
}
...
...
@@ -1633,7 +1633,7 @@ export class EnableAllAction extends Action {
}
private
update
():
void
{
this
.
enabled
=
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
this
.
extensionEnablementService
.
canChangeEnablement
(
)
&&
(
e
.
enablementState
===
EnablementState
.
Disabled
||
e
.
enablementState
===
EnablementState
.
WorkspaceDisabled
));
this
.
enabled
=
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
e
.
local
&&
this
.
extensionEnablementService
.
canChangeEnablement
(
e
.
local
)
&&
(
e
.
enablementState
===
EnablementState
.
Disabled
||
e
.
enablementState
===
EnablementState
.
WorkspaceDisabled
));
}
run
():
TPromise
<
any
>
{
...
...
@@ -1666,7 +1666,7 @@ export class EnableAllWorkpsaceAction extends Action {
}
private
update
():
void
{
this
.
enabled
=
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
this
.
extensionEnablementService
.
canChangeEnablement
(
)
&&
(
e
.
enablementState
===
EnablementState
.
Disabled
||
e
.
enablementState
===
EnablementState
.
WorkspaceDisabled
));
this
.
enabled
=
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
e
.
local
&&
this
.
extensionEnablementService
.
canChangeEnablement
(
e
.
local
)
&&
(
e
.
enablementState
===
EnablementState
.
Disabled
||
e
.
enablementState
===
EnablementState
.
WorkspaceDisabled
));
}
run
():
TPromise
<
any
>
{
...
...
src/vs/workbench/parts/extensions/common/extensions.ts
浏览文件 @
50ac47da
...
...
@@ -8,7 +8,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import
Event
from
'
vs/base/common/event
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IPager
}
from
'
vs/base/common/paging
'
;
import
{
IQueryOptions
,
IExtensionManifest
,
LocalExtensionType
,
EnablementState
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IQueryOptions
,
IExtensionManifest
,
LocalExtensionType
,
EnablementState
,
ILocalExtension
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
export
const
VIEWLET_ID
=
'
workbench.view.extensions
'
;
...
...
@@ -51,6 +51,7 @@ export interface IExtension {
getManifest
():
TPromise
<
IExtensionManifest
>
;
getReadme
():
TPromise
<
string
>
;
getChangelog
():
TPromise
<
string
>
;
local
?:
ILocalExtension
;
}
export
interface
IExtensionDependencies
{
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsUtils.ts
浏览文件 @
50ac47da
...
...
@@ -90,7 +90,7 @@ export class KeymapExtensions implements IWorkbenchContribution {
this
.
telemetryService
.
publicLog
(
'
disableOtherKeymaps
'
,
telemetryData
);
if
(
confirmed
)
{
return
TPromise
.
join
(
oldKeymaps
.
map
(
keymap
=>
{
return
this
.
extensionEnablementService
.
setEnablement
(
keymap
.
local
.
identifier
,
EnablementState
.
Disabled
);
return
this
.
extensionEnablementService
.
setEnablement
(
keymap
.
local
,
EnablementState
.
Disabled
);
}));
}
return
undefined
;
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
50ac47da
...
...
@@ -715,7 +715,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
private
doSetEnablement
(
extension
:
IExtension
,
enablementState
:
EnablementState
):
TPromise
<
boolean
>
{
return
this
.
extensionEnablementService
.
setEnablement
(
extension
,
enablementState
);
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
local
,
enablementState
);
}
get
allowedBadgeProviders
():
string
[]
{
...
...
src/vs/workbench/parts/extensions/test/electron-browser/extensionsActions.test.ts
浏览文件 @
50ac47da
此差异已折叠。
点击以展开。
src/vs/workbench/parts/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
浏览文件 @
50ac47da
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录