Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6e7aa1bf
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,发现更多精彩内容 >>
提交
6e7aa1bf
编写于
9月 23, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extension pack: installation status of all at same time before and after installation
上级
f685a190
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
76 addition
and
29 deletion
+76
-29
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+76
-29
未找到文件。
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
6e7aa1bf
...
@@ -138,7 +138,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -138,7 +138,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
});
});
}
}
installFromGallery
(
extension
:
IGalleryExtension
,
checkDependecies
:
boolean
=
true
):
TPromise
<
void
>
{
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
{
const
id
=
getExtensionId
(
extension
,
extension
.
version
);
const
id
=
getExtensionId
(
extension
,
extension
.
version
);
return
this
.
isObsolete
(
id
).
then
(
isObsolete
=>
{
return
this
.
isObsolete
(
id
).
then
(
isObsolete
=>
{
...
@@ -146,8 +146,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -146,8 +146,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
nls
.
localize
(
'
restartCode
'
,
"
Please restart Code before reinstalling {0}.
"
,
extension
.
displayName
||
extension
.
name
)));
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
nls
.
localize
(
'
restartCode
'
,
"
Please restart Code before reinstalling {0}.
"
,
extension
.
displayName
||
extension
.
name
)));
}
}
this
.
_onInstallExtension
.
fire
({
id
,
gallery
:
extension
});
this
.
_onInstallExtension
.
fire
({
id
,
gallery
:
extension
});
return
this
.
galleryService
.
loadCompatibleVersion
(
extension
)
return
this
.
installCompatibleVersion
(
extension
,
true
)
.
then
(
compatibleVersion
=>
this
.
installCompatibleVersion
(
compatibleVersion
,
checkDependecies
))
.
then
(
.
then
(
local
=>
this
.
_onDidInstallExtension
.
fire
({
id
,
local
,
gallery
:
extension
}),
local
=>
this
.
_onDidInstallExtension
.
fire
({
id
,
local
,
gallery
:
extension
}),
error
=>
{
error
=>
{
...
@@ -159,28 +158,31 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -159,28 +158,31 @@ export class ExtensionManagementService implements IExtensionManagementService {
}
}
private
installCompatibleVersion
(
extension
:
IGalleryExtension
,
checkDependecies
:
boolean
):
TPromise
<
ILocalExtension
>
{
private
installCompatibleVersion
(
extension
:
IGalleryExtension
,
checkDependecies
:
boolean
):
TPromise
<
ILocalExtension
>
{
const
dependencies
=
checkDependecies
?
this
.
getDependenciesToInstall
(
extension
)
:
[];
return
this
.
galleryService
.
loadCompatibleVersion
(
extension
)
if
(
!
dependencies
.
length
)
{
.
then
(
compatibleVersion
=>
{
return
this
.
downloadAndInstall
(
extension
);
const
dependencies
=
checkDependecies
?
this
.
getDependenciesToInstall
(
compatibleVersion
)
:
[];
}
if
(
!
dependencies
.
length
)
{
return
this
.
downloadAndInstall
(
compatibleVersion
);
const
message
=
nls
.
localize
(
'
installDependecies
'
,
"
This extension has dependencies. Would you like to install them along with it?
"
);
const
options
=
[
nls
.
localize
(
'
installWithDependenices
'
,
"
Install With Dependencies
"
),
nls
.
localize
(
'
installWithoutDependenices
'
,
"
Install only this
"
),
nls
.
localize
(
'
close
'
,
"
Close
"
)
];
return
this
.
choiceService
.
choose
(
Severity
.
Info
,
message
,
options
)
.
then
(
value
=>
{
switch
(
value
)
{
case
0
:
return
this
.
installWithDependencies
(
extension
);
case
1
:
return
this
.
downloadAndInstall
(
extension
);
default
:
return
TPromise
.
wrapError
(
errors
.
canceled
());
}
}
});
const
message
=
nls
.
localize
(
'
installDependecies
'
,
"
This extension has dependencies. Would you like to install them along with it?
"
);
const
options
=
[
nls
.
localize
(
'
installWithDependenices
'
,
"
Install With Dependencies
"
),
nls
.
localize
(
'
installWithoutDependenices
'
,
"
Install only this
"
),
nls
.
localize
(
'
close
'
,
"
Close
"
)
];
return
this
.
choiceService
.
choose
(
Severity
.
Info
,
message
,
options
)
.
then
(
value
=>
{
switch
(
value
)
{
case
0
:
return
this
.
installWithDependencies
(
compatibleVersion
);
case
1
:
return
this
.
downloadAndInstall
(
compatibleVersion
);
default
:
return
TPromise
.
wrapError
(
errors
.
canceled
());
}
});
});
}
}
private
getDependenciesToInstall
(
extension
:
IGalleryExtension
):
string
[]
{
private
getDependenciesToInstall
(
extension
:
IGalleryExtension
):
string
[]
{
...
@@ -191,13 +193,41 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -191,13 +193,41 @@ export class ExtensionManagementService implements IExtensionManagementService {
private
installWithDependencies
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
private
installWithDependencies
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
return
this
.
galleryService
.
getAllDependencies
(
extension
)
return
this
.
galleryService
.
getAllDependencies
(
extension
)
.
then
(
allDependencies
=>
this
.
filterOutInstalled
(
allDependencies
))
.
then
(
allDependencies
=>
this
.
filterOutInstalled
(
allDependencies
))
.
then
(
toInstall
=>
this
.
bulkInstallWithDependencies
(
extension
,
toInstall
));
.
then
(
toInstall
=>
this
.
filterObsolete
(...
toInstall
.
map
(
i
=>
getExtensionId
(
i
,
i
.
version
)))
.
then
((
obsolete
)
=>
{
if
(
obsolete
.
length
)
{
return
TPromise
.
wrapError
<
ILocalExtension
>
(
new
Error
(
nls
.
localize
(
'
restartCode
'
,
"
Please restart Code before reinstalling {0}.
"
,
extension
.
displayName
||
extension
.
name
)));
}
return
this
.
bulkInstallWithDependencies
(
extension
,
toInstall
);
})
);
}
}
private
bulkInstallWithDependencies
(
extension
:
IGalleryExtension
,
dependecies
:
IGalleryExtension
[]):
TPromise
<
ILocalExtension
>
{
private
bulkInstallWithDependencies
(
extension
:
IGalleryExtension
,
dependecies
:
IGalleryExtension
[]):
TPromise
<
ILocalExtension
>
{
for
(
const
dependency
of
dependecies
)
{
const
id
=
getExtensionId
(
dependency
,
dependency
.
version
);
this
.
_onInstallExtension
.
fire
({
id
,
gallery
:
dependency
});
}
return
this
.
downloadAndInstall
(
extension
)
return
this
.
downloadAndInstall
(
extension
)
.
then
(
localExtension
=>
TPromise
.
join
(
dependecies
.
map
((
dep
)
=>
this
.
installFromGallery
(
dep
,
false
)))
.
then
(
localExtension
=>
{
.
then
(()
=>
localExtension
,
error
=>
this
.
rollback
(
localExtension
,
dependecies
).
then
(()
=>
error
)));
return
TPromise
.
join
(
dependecies
.
map
((
dep
)
=>
this
.
installCompatibleVersion
(
dep
,
false
)))
.
then
(
installedLocalExtensions
=>
{
for
(
const
installedLocalExtension
of
installedLocalExtensions
)
{
const
gallery
=
this
.
getGalleryExtensionForLocalExtension
(
dependecies
,
installedLocalExtension
);
this
.
_onDidInstallExtension
.
fire
({
id
:
installedLocalExtension
.
id
,
local
:
installedLocalExtension
,
gallery
});
}
return
localExtension
;
},
error
=>
{
return
this
.
rollback
(
localExtension
,
dependecies
).
then
(()
=>
{
for
(
const
dependency
of
dependecies
)
{
this
.
_onDidInstallExtension
.
fire
({
id
:
getExtensionId
(
dependency
,
dependency
.
version
),
gallery
:
dependency
,
error
});
}
return
TPromise
.
wrapError
(
Array
.
isArray
(
error
)
?
error
[
error
.
length
-
1
]
:
error
);
});
});
});
}
}
private
rollback
(
localExtension
:
ILocalExtension
,
dependecies
:
IGalleryExtension
[]):
TPromise
<
void
>
{
private
rollback
(
localExtension
:
ILocalExtension
,
dependecies
:
IGalleryExtension
[]):
TPromise
<
void
>
{
...
@@ -219,11 +249,16 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -219,11 +249,16 @@ export class ExtensionManagementService implements IExtensionManagementService {
private
filterOutUnInstalled
(
extensions
:
IGalleryExtension
[]):
TPromise
<
ILocalExtension
[]
>
{
private
filterOutUnInstalled
(
extensions
:
IGalleryExtension
[]):
TPromise
<
ILocalExtension
[]
>
{
return
this
.
getInstalled
().
then
(
installed
=>
{
return
this
.
getInstalled
().
then
(
installed
=>
{
return
installed
.
filter
(
local
=>
{
return
installed
.
filter
(
local
=>
{
return
extensions
.
every
(
extension
=>
getExtensionId
(
extension
,
extension
.
version
)
===
local
.
id
);
return
!!
this
.
getGalleryExtensionForLocalExtension
(
extensions
,
local
);
});
});
});
});
}
}
private
getGalleryExtensionForLocalExtension
(
galleryExtensions
:
IGalleryExtension
[],
localExtension
:
ILocalExtension
):
IGalleryExtension
{
const
filtered
=
galleryExtensions
.
filter
(
galleryExtension
=>
getExtensionId
(
galleryExtension
,
galleryExtension
.
version
)
===
localExtension
.
id
);
return
filtered
.
length
?
filtered
[
0
]
:
null
;
}
private
downloadAndInstall
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
private
downloadAndInstall
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
const
id
=
getExtensionId
(
extension
,
extension
.
version
);
const
id
=
getExtensionId
(
extension
,
extension
.
version
);
const
metadata
=
{
const
metadata
=
{
...
@@ -358,7 +393,19 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -358,7 +393,19 @@ export class ExtensionManagementService implements IExtensionManagementService {
}
}
private
isObsolete
(
id
:
string
):
TPromise
<
boolean
>
{
private
isObsolete
(
id
:
string
):
TPromise
<
boolean
>
{
return
this
.
withObsoleteExtensions
(
obsolete
=>
!!
obsolete
[
id
]);
return
this
.
filterObsolete
(
id
).
then
(
obsolete
=>
obsolete
.
length
===
1
);
}
private
filterObsolete
(...
ids
:
string
[]):
TPromise
<
string
[]
>
{
return
this
.
withObsoleteExtensions
(
allObsolete
=>
{
const
obsolete
=
[];
for
(
const
id
of
ids
)
{
if
(
!!
allObsolete
[
id
])
{
obsolete
.
push
(
id
);
}
}
return
obsolete
;
});
}
}
private
setObsolete
(
id
:
string
):
TPromise
<
void
>
{
private
setObsolete
(
id
:
string
):
TPromise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录