Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
87e2e7d8
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
87e2e7d8
编写于
8月 11, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
report uninstall telemetry
上级
fdcf26e8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
14 deletion
+38
-14
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+5
-0
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
...tform/extensionManagement/node/extensionGalleryService.ts
+18
-1
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+15
-13
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
87e2e7d8
...
...
@@ -195,12 +195,17 @@ export interface IQueryOptions {
sortOrder
?:
SortOrder
;
}
export
enum
StatisticType
{
Uninstall
=
'
uninstall
'
}
export
interface
IExtensionGalleryService
{
_serviceBrand
:
any
;
isEnabled
():
boolean
;
getRequestHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
;
query
(
options
?:
IQueryOptions
):
TPromise
<
IPager
<
IGalleryExtension
>>
;
download
(
extension
:
IGalleryExtension
):
TPromise
<
string
>
;
reportStatistic
(
publisher
:
string
,
name
:
string
,
version
:
string
,
type
:
StatisticType
):
TPromise
<
void
>
;
getReadme
(
extension
:
IGalleryExtension
):
TPromise
<
string
>
;
getManifest
(
extension
:
IGalleryExtension
):
TPromise
<
IExtensionManifest
>
;
getChangelog
(
extension
:
IGalleryMetadata
):
TPromise
<
string
>
;
...
...
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
浏览文件 @
87e2e7d8
...
...
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
*
as
uuid
from
'
vs/base/common/uuid
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
getErrorMessage
}
from
'
vs/base/common/errors
'
;
import
{
IGalleryExtension
,
IExtensionGalleryService
,
IGalleryExtensionAsset
,
IQueryOptions
,
SortBy
,
SortOrder
,
IExtensionManifest
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
StatisticType
,
IGalleryExtension
,
IExtensionGalleryService
,
IGalleryExtensionAsset
,
IQueryOptions
,
SortBy
,
SortOrder
,
IExtensionManifest
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getGalleryExtensionId
,
getGalleryExtensionTelemetryData
,
adoptToGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
assign
,
getOrDefault
}
from
'
vs/base/common/objects
'
;
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
...
...
@@ -385,6 +385,23 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
return
{
galleryExtensions
,
total
};
}
async
reportStatistic
(
publisher
:
string
,
name
:
string
,
version
:
string
,
type
:
StatisticType
):
TPromise
<
void
>
{
if
(
!
this
.
isEnabled
())
{
return
;
}
try
{
const
headers
=
await
this
.
commonHTTPHeaders
;
await
this
.
requestService
.
request
({
type
:
'
POST
'
,
url
:
this
.
api
(
`/publishers/
${
publisher
}
/extensions/
${
name
}
/
${
version
}
/stats?statType=
${
type
}
`
),
headers
});
}
catch
(
err
)
{
// noop
}
}
download
(
extension
:
IGalleryExtension
):
TPromise
<
string
>
{
return
this
.
loadCompatibleVersion
(
extension
).
then
(
extension
=>
{
const
zipPath
=
path
.
join
(
tmpdir
(),
uuid
.
generateUuid
());
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
87e2e7d8
...
...
@@ -17,7 +17,8 @@ import { Promise, TPromise } from 'vs/base/common/winjs.base';
import
{
IExtensionManagementService
,
IExtensionGalleryService
,
ILocalExtension
,
IGalleryExtension
,
IExtensionManifest
,
IGalleryMetadata
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
DidUninstallExtensionEvent
,
LocalExtensionType
InstallExtensionEvent
,
DidInstallExtensionEvent
,
DidUninstallExtensionEvent
,
LocalExtensionType
,
StatisticType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getLocalExtensionIdFromGallery
,
getLocalExtensionIdFromManifest
,
getGalleryExtensionIdFromLocal
,
getIdAndVersionFromLocalExtensionId
,
adoptToGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
localizeManifest
}
from
'
../common/extensionNls
'
;
...
...
@@ -223,9 +224,9 @@ export class ExtensionManagementService implements IExtensionManagementService {
}
private
rollback
(
localExtension
:
ILocalExtension
,
dependecies
:
IGalleryExtension
[]):
TPromise
<
void
>
{
return
this
.
doUninstall
(
localExtension
.
id
)
return
this
.
doUninstall
(
localExtension
)
.
then
(()
=>
this
.
filterOutUninstalled
(
dependecies
))
.
then
(
installed
=>
TPromise
.
join
(
installed
.
map
((
i
)
=>
this
.
doUninstall
(
i
.
id
))))
.
then
(
installed
=>
TPromise
.
join
(
installed
.
map
((
i
)
=>
this
.
doUninstall
(
i
))))
.
then
(()
=>
null
);
}
...
...
@@ -304,7 +305,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
}
private
checkForDependenciesAndUninstall
(
extension
:
ILocalExtension
,
installed
:
ILocalExtension
[],
force
:
boolean
):
TPromise
<
void
>
{
return
this
.
preUninstallExtension
(
extension
.
id
)
return
this
.
preUninstallExtension
(
extension
)
.
then
(()
=>
this
.
hasDependencies
(
extension
,
installed
)
?
this
.
promptForDependenciesAndUninstall
(
extension
,
installed
,
force
)
:
this
.
promptAndUninstall
(
extension
,
installed
,
force
))
.
then
(()
=>
this
.
postUninstallExtension
(
extension
.
id
),
error
=>
{
...
...
@@ -370,7 +371,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
if
(
dependents
.
length
)
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
this
.
getDependentsErrorMessage
(
extension
,
dependents
)));
}
return
TPromise
.
join
([
this
.
uninstallExtension
(
extension
.
id
),
...
dependenciesToUninstall
.
map
(
d
=>
this
.
doUninstall
(
d
.
id
))]).
then
(()
=>
null
);
return
TPromise
.
join
([
this
.
uninstallExtension
(
extension
.
id
),
...
dependenciesToUninstall
.
map
(
d
=>
this
.
doUninstall
(
d
))]).
then
(()
=>
null
);
}
private
getDependentsErrorMessage
(
extension
:
ILocalExtension
,
dependents
:
ILocalExtension
[]):
string
{
...
...
@@ -419,21 +420,22 @@ export class ExtensionManagementService implements IExtensionManagementService {
return
installed
.
filter
(
e
=>
e
.
manifest
.
extensionDependencies
&&
e
.
manifest
.
extensionDependencies
.
indexOf
(
getGalleryExtensionIdFromLocal
(
extension
))
!==
-
1
);
}
private
doUninstall
(
id
:
string
):
TPromise
<
void
>
{
return
this
.
preUninstallExtension
(
id
)
.
then
(()
=>
this
.
uninstallExtension
(
id
))
.
then
(()
=>
this
.
postUninstallExtension
(
id
),
private
doUninstall
(
extension
:
ILocalExtension
):
TPromise
<
void
>
{
return
this
.
preUninstallExtension
(
extension
)
.
then
(()
=>
this
.
uninstallExtension
(
extension
.
id
))
.
then
(()
=>
this
.
postUninstallExtension
(
extension
.
id
),
error
=>
{
this
.
postUninstallExtension
(
id
,
error
);
this
.
postUninstallExtension
(
extension
.
id
,
error
);
return
TPromise
.
wrapError
(
error
);
});
}
private
preUninstallExtension
(
id
:
string
):
TPromise
<
void
>
{
const
extensionPath
=
path
.
join
(
this
.
extensionsPath
,
id
);
private
preUninstallExtension
(
extension
:
ILocalExtension
):
TPromise
<
void
>
{
const
extensionPath
=
path
.
join
(
this
.
extensionsPath
,
extension
.
id
);
return
pfs
.
exists
(
extensionPath
)
.
then
(
exists
=>
exists
?
null
:
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
notExists
'
,
"
Could not find extension
"
))))
.
then
(()
=>
this
.
_onUninstallExtension
.
fire
(
id
));
.
then
(()
=>
this
.
_onUninstallExtension
.
fire
(
extension
.
id
))
.
then
(()
=>
this
.
galleryService
.
reportStatistic
(
extension
.
manifest
.
publisher
,
extension
.
manifest
.
name
,
extension
.
manifest
.
version
,
StatisticType
.
Uninstall
));
}
private
uninstallExtension
(
id
:
string
):
TPromise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录