Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
32d834b0
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,发现更多精彩内容 >>
提交
32d834b0
编写于
10月 26, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Store metadata for Local extensions
- While installing from zip - While syncing with gallery
上级
77ba628a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
14 deletion
+45
-14
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+2
-0
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
...form/extensionManagement/common/extensionManagementIpc.ts
+6
-1
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+29
-10
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+8
-3
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
32d834b0
...
@@ -257,6 +257,8 @@ export interface IExtensionManagementService {
...
@@ -257,6 +257,8 @@ export interface IExtensionManagementService {
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
uninstall
(
extension
:
ILocalExtension
,
force
?:
boolean
):
TPromise
<
void
>
;
uninstall
(
extension
:
ILocalExtension
,
force
?:
boolean
):
TPromise
<
void
>
;
getInstalled
(
type
?:
LocalExtensionType
):
TPromise
<
ILocalExtension
[]
>
;
getInstalled
(
type
?:
LocalExtensionType
):
TPromise
<
ILocalExtension
[]
>
;
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
;
}
}
export
const
IExtensionEnablementService
=
createDecorator
<
IExtensionEnablementService
>
(
'
extensionEnablementService
'
);
export
const
IExtensionEnablementService
=
createDecorator
<
IExtensionEnablementService
>
(
'
extensionEnablementService
'
);
...
...
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
浏览文件 @
32d834b0
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IChannel
,
eventToCall
,
eventFromCall
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IExtensionManagementService
,
ILocalExtension
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
IGalleryExtension
,
LocalExtensionType
,
DidUninstallExtensionEvent
,
IExtensionIdentifier
}
from
'
./extensionManagement
'
;
import
{
IExtensionManagementService
,
ILocalExtension
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
IGalleryExtension
,
LocalExtensionType
,
DidUninstallExtensionEvent
,
IExtensionIdentifier
,
IGalleryMetadata
}
from
'
./extensionManagement
'
;
import
Event
,
{
buffer
}
from
'
vs/base/common/event
'
;
import
Event
,
{
buffer
}
from
'
vs/base/common/event
'
;
export
interface
IExtensionManagementChannel
extends
IChannel
{
export
interface
IExtensionManagementChannel
extends
IChannel
{
...
@@ -46,6 +46,7 @@ export class ExtensionManagementChannel implements IExtensionManagementChannel {
...
@@ -46,6 +46,7 @@ export class ExtensionManagementChannel implements IExtensionManagementChannel {
case
'
installFromGallery
'
:
return
this
.
service
.
installFromGallery
(
arg
[
0
]);
case
'
installFromGallery
'
:
return
this
.
service
.
installFromGallery
(
arg
[
0
]);
case
'
uninstall
'
:
return
this
.
service
.
uninstall
(
arg
[
0
],
arg
[
1
]);
case
'
uninstall
'
:
return
this
.
service
.
uninstall
(
arg
[
0
],
arg
[
1
]);
case
'
getInstalled
'
:
return
this
.
service
.
getInstalled
(
arg
);
case
'
getInstalled
'
:
return
this
.
service
.
getInstalled
(
arg
);
case
'
updateMetadata
'
:
return
this
.
service
.
updateMetadata
(
arg
[
0
],
arg
[
1
]);
}
}
return
undefined
;
return
undefined
;
}
}
...
@@ -84,4 +85,8 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
...
@@ -84,4 +85,8 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
getInstalled
(
type
:
LocalExtensionType
=
null
):
TPromise
<
ILocalExtension
[]
>
{
getInstalled
(
type
:
LocalExtensionType
=
null
):
TPromise
<
ILocalExtension
[]
>
{
return
this
.
channel
.
call
(
'
getInstalled
'
,
type
);
return
this
.
channel
.
call
(
'
getInstalled
'
,
type
);
}
}
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
{
return
this
.
channel
.
call
(
'
updateMetadata
'
,
[
local
,
metadata
]);
}
}
}
\ No newline at end of file
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
32d834b0
...
@@ -123,11 +123,17 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -123,11 +123,17 @@ export class ExtensionManagementService implements IExtensionManagementService {
this
.
_onInstallExtension
.
fire
({
identifier
,
zipPath
});
this
.
_onInstallExtension
.
fire
({
identifier
,
zipPath
});
return
this
.
installExtension
({
zipPath
,
id
:
identifier
.
id
,
metadata
:
null
})
return
this
.
galleryService
.
query
({
names
:
[
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)],
pageSize
:
1
})
.
then
(
.
then
(
galleryResult
=>
{
local
=>
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
local
}),
const
galleryExtension
=
galleryResult
.
firstPage
[
0
];
error
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
error
});
return
TPromise
.
wrapError
(
error
);
}
const
metadata
=
galleryExtension
?
<
IGalleryMetadata
>
{
id
:
galleryExtension
.
identifier
.
uuid
,
publisherDisplayName
:
galleryExtension
.
publisherDisplayName
,
publisherId
:
galleryExtension
.
publisherId
}
:
null
;
);
return
this
.
installExtension
({
zipPath
,
id
:
identifier
.
id
,
metadata
})
.
then
(
local
=>
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
local
}),
error
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
error
});
return
TPromise
.
wrapError
(
error
);
}
);
});
});
});
});
});
}
}
...
@@ -253,12 +259,8 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -253,12 +259,8 @@ export class ExtensionManagementService implements IExtensionManagementService {
const
identifier
=
{
id
,
uuid
:
metadata
?
metadata
.
id
:
null
};
const
identifier
=
{
id
,
uuid
:
metadata
?
metadata
.
id
:
null
};
const
local
:
ILocalExtension
=
{
type
,
identifier
,
manifest
,
metadata
,
path
:
extensionPath
,
readmeUrl
,
changelogUrl
};
const
local
:
ILocalExtension
=
{
type
,
identifier
,
manifest
,
metadata
,
path
:
extensionPath
,
readmeUrl
,
changelogUrl
};
const
manifestPath
=
path
.
join
(
extensionPath
,
'
package.json
'
);
return
pfs
.
readFile
(
manifestPath
,
'
utf8
'
)
return
this
.
saveMetadataForLocalExtension
(
local
)
.
then
(
raw
=>
parseManifest
(
raw
))
.
then
(({
manifest
})
=>
assign
(
manifest
,
{
__metadata
:
metadata
}))
.
then
(
manifest
=>
pfs
.
writeFile
(
manifestPath
,
JSON
.
stringify
(
manifest
,
null
,
'
\t
'
)))
.
then
(()
=>
this
.
checkForRename
(
current
,
local
))
.
then
(()
=>
this
.
checkForRename
(
current
,
local
))
.
then
(()
=>
local
);
.
then
(()
=>
local
);
});
});
...
@@ -279,6 +281,23 @@ export class ExtensionManagementService implements IExtensionManagementService {
...
@@ -279,6 +281,23 @@ export class ExtensionManagementService implements IExtensionManagementService {
.
then
(()
=>
{
/* drop resolved value */
});
.
then
(()
=>
{
/* drop resolved value */
});
}
}
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
{
local
.
metadata
=
metadata
;
return
this
.
saveMetadataForLocalExtension
(
local
);
}
private
saveMetadataForLocalExtension
(
local
:
ILocalExtension
):
TPromise
<
ILocalExtension
>
{
if
(
!
local
.
metadata
)
{
return
TPromise
.
as
(
local
);
}
const
manifestPath
=
path
.
join
(
this
.
extensionsPath
,
local
.
identifier
.
id
,
'
package.json
'
);
return
pfs
.
readFile
(
manifestPath
,
'
utf8
'
)
.
then
(
raw
=>
parseManifest
(
raw
))
.
then
(({
manifest
})
=>
assign
(
manifest
,
{
__metadata
:
local
.
metadata
}))
.
then
(
manifest
=>
pfs
.
writeFile
(
manifestPath
,
JSON
.
stringify
(
manifest
,
null
,
'
\t
'
)))
.
then
(()
=>
local
);
}
private
checkForRename
(
currentExtension
:
ILocalExtension
,
newExtension
:
ILocalExtension
):
TPromise
<
void
>
{
private
checkForRename
(
currentExtension
:
ILocalExtension
,
newExtension
:
ILocalExtension
):
TPromise
<
void
>
{
// Check if the gallery id for current and new exensions are same, if not, remove the current one.
// Check if the gallery id for current and new exensions are same, if not, remove the current one.
if
(
currentExtension
&&
getGalleryExtensionIdFromLocal
(
currentExtension
)
!==
getGalleryExtensionIdFromLocal
(
newExtension
))
{
if
(
currentExtension
&&
getGalleryExtensionIdFromLocal
(
currentExtension
)
!==
getGalleryExtensionIdFromLocal
(
newExtension
))
{
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
32d834b0
...
@@ -459,9 +459,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
...
@@ -459,9 +459,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
}
private
syncLocalWithGalleryExtension
(
local
:
Extension
,
gallery
:
IGalleryExtension
)
{
private
syncLocalWithGalleryExtension
(
local
:
Extension
,
gallery
:
IGalleryExtension
)
{
local
.
gallery
=
gallery
;
// Sync the local extension with gallery extension if local extension doesnot has metadata
this
.
_onChange
.
fire
();
(
local
.
local
.
metadata
?
TPromise
.
as
(
local
.
local
)
:
this
.
extensionService
.
updateMetadata
(
local
.
local
,
{
id
:
gallery
.
identifier
.
uuid
,
publisherDisplayName
:
gallery
.
publisherDisplayName
,
publisherId
:
gallery
.
publisherId
}))
this
.
eventuallyAutoUpdateExtensions
();
.
then
(
localExtension
=>
{
local
.
local
=
localExtension
;
local
.
gallery
=
gallery
;
this
.
_onChange
.
fire
();
this
.
eventuallyAutoUpdateExtensions
();
});
}
}
checkForUpdates
():
TPromise
<
void
>
{
checkForUpdates
():
TPromise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录