Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
0519295e
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
0519295e
编写于
12月 02, 2021
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #138271
上级
e53bee0f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
9 deletion
+30
-9
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+3
-1
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+12
-5
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
.../contrib/extensions/browser/extensionsWorkbenchService.ts
+15
-3
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
0519295e
...
...
@@ -268,8 +268,11 @@ export interface IGalleryMetadata {
id
:
string
;
publisherId
:
string
;
publisherDisplayName
:
string
;
isPreReleaseVersion
:
boolean
,
}
export
type
Metadata
=
Partial
<
IGalleryMetadata
&
{
isMachineScoped
:
boolean
;
isBuiltin
:
boolean
;
preRelease
:
boolean
,
installedTimestamp
:
number
}
>
;
export
interface
ILocalExtension
extends
IExtension
{
isMachineScoped
:
boolean
;
publisherId
:
string
|
null
;
...
...
@@ -389,7 +392,6 @@ export class ExtensionManagementError extends Error {
}
}
export
type
Metadata
=
Partial
<
IGalleryMetadata
&
{
isMachineScoped
:
boolean
;
isBuiltin
:
boolean
;
isPreReleaseVersion
:
boolean
,
preRelease
:
boolean
,
installedTimestamp
:
number
}
>
;
export
type
InstallOptions
=
{
isBuiltin
?:
boolean
,
isMachineScoped
?:
boolean
,
donotIncludePackAndDependencies
?:
boolean
,
installGivenVersion
?:
boolean
,
installPreReleaseVersion
?:
boolean
};
export
type
InstallVSIXOptions
=
Omit
<
InstallOptions
,
'
installGivenVersion
'
>
&
{
installOnlyNewlyAddedFromExtensionPack
?:
boolean
};
export
type
UninstallOptions
=
{
donotIncludePack
?:
boolean
,
donotCheckDependents
?:
boolean
};
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
0519295e
...
...
@@ -148,7 +148,11 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
async
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
Promise
<
ILocalExtension
>
{
this
.
logService
.
trace
(
'
ExtensionManagementService#updateMetadata
'
,
local
.
identifier
.
id
);
local
=
await
this
.
extensionsScanner
.
saveMetadataForLocalExtension
(
local
,
{
...((
<
ILocalExtensionManifest
>
local
.
manifest
).
__metadata
||
{}),
...
metadata
});
const
localMetadata
:
Metadata
=
{
...((
<
ILocalExtensionManifest
>
local
.
manifest
).
__metadata
||
{}),
...
metadata
};
if
(
metadata
.
isPreReleaseVersion
)
{
localMetadata
.
preRelease
=
true
;
}
local
=
await
this
.
extensionsScanner
.
saveMetadataForLocalExtension
(
local
,
localMetadata
);
this
.
manifestCache
.
invalidate
();
return
local
;
}
...
...
@@ -354,7 +358,7 @@ class InstallVSIXTask extends AbstractInstallExtensionTask {
const
identifierWithVersion
=
new
ExtensionIdentifierWithVersion
(
this
.
identifier
,
this
.
manifest
.
version
);
const
installedExtensions
=
await
this
.
extensionsScanner
.
scanExtensions
(
ExtensionType
.
User
);
const
existing
=
installedExtensions
.
find
(
i
=>
areSameExtensions
(
this
.
identifier
,
i
.
identifier
));
const
metadata
=
await
this
.
getMetadata
(
this
.
identifier
.
id
,
token
);
const
metadata
=
await
this
.
getMetadata
(
this
.
identifier
.
id
,
t
his
.
manifest
.
version
,
t
oken
);
metadata
.
isMachineScoped
=
this
.
options
.
isMachineScoped
||
existing
?.
isMachineScoped
;
metadata
.
isBuiltin
=
this
.
options
.
isBuiltin
||
existing
?.
isBuiltin
;
...
...
@@ -385,11 +389,14 @@ class InstallVSIXTask extends AbstractInstallExtensionTask {
return
this
.
installExtension
({
zipPath
:
path
.
resolve
(
this
.
location
.
fsPath
),
identifierWithVersion
,
metadata
},
token
);
}
private
async
getMetadata
(
name
:
string
,
token
:
CancellationToken
):
Promise
<
Metadata
>
{
private
async
getMetadata
(
id
:
string
,
version
:
string
,
token
:
CancellationToken
):
Promise
<
Metadata
>
{
try
{
const
galleryExtension
=
(
await
this
.
galleryService
.
query
({
names
:
[
name
],
pageSize
:
1
},
token
)).
firstPage
[
0
];
let
[
galleryExtension
]
=
await
this
.
galleryService
.
getExtensions
([{
id
,
version
}],
token
);
if
(
!
galleryExtension
)
{
[
galleryExtension
]
=
await
this
.
galleryService
.
getExtensions
([{
id
}],
token
);
}
if
(
galleryExtension
)
{
return
{
id
:
galleryExtension
.
identifier
.
uuid
,
publisherDisplayName
:
galleryExtension
.
publisherDisplayName
,
publisherId
:
galleryExtension
.
publisherId
};
return
{
id
:
galleryExtension
.
identifier
.
uuid
,
publisherDisplayName
:
galleryExtension
.
publisherDisplayName
,
publisherId
:
galleryExtension
.
publisherId
,
isPreReleaseVersion
:
galleryExtension
.
properties
.
isPreReleaseVersion
,
preRelease
:
galleryExtension
.
properties
.
isPreReleaseVersion
};
}
}
catch
(
error
)
{
/* Ignore Error */
...
...
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
浏览文件 @
0519295e
...
...
@@ -437,14 +437,26 @@ class Extensions extends Disposable {
hasChanged
=
true
;
}
const
compatible
=
await
this
.
getCompatibleExtension
(
gallery
,
!!
extension
.
local
?
.
isPreReleaseVersion
);
const
compatible
=
await
this
.
getCompatibleExtension
(
gallery
,
extension
.
local
.
isPreReleaseVersion
);
if
(
compatible
)
{
const
local
=
extension
.
local
.
identifier
.
uuid
?
extension
.
local
:
await
this
.
server
.
extensionManagementService
.
updateMetadata
(
extension
.
local
,
{
id
:
compatible
.
identifier
.
uuid
,
publisherDisplayName
:
compatible
.
publisherDisplayName
,
publisherId
:
compatible
.
publisherId
});
extension
.
local
=
local
;
extension
.
gallery
=
compatible
;
hasChanged
=
true
;
}
if
(
!
extension
.
local
.
identifier
.
uuid
)
{
let
galleryExtension
=
!
extension
.
outdated
?
extension
.
gallery
:
undefined
;
if
(
!
galleryExtension
)
{
[
galleryExtension
]
=
await
this
.
galleryService
.
getExtensions
([{
...
extension
.
local
.
identifier
,
version
:
extension
.
version
}],
CancellationToken
.
None
);
}
if
(
!
galleryExtension
)
{
[
galleryExtension
]
=
await
this
.
galleryService
.
getExtensions
([
extension
.
local
.
identifier
],
CancellationToken
.
None
);
}
if
(
galleryExtension
)
{
const
local
=
await
this
.
server
.
extensionManagementService
.
updateMetadata
(
extension
.
local
,
{
id
:
galleryExtension
.
identifier
.
uuid
,
publisherDisplayName
:
galleryExtension
.
publisherDisplayName
,
publisherId
:
galleryExtension
.
publisherId
,
isPreReleaseVersion
:
gallery
.
properties
.
isPreReleaseVersion
});
extension
.
local
=
local
;
}
}
const
unsupportedPreRelease
=
extensionsControlManifest
.
unsupportedPreReleaseExtensions
?
extensionsControlManifest
.
unsupportedPreReleaseExtensions
[
extension
.
identifier
.
id
.
toLowerCase
()]
:
undefined
;
if
(
unsupportedPreRelease
)
{
if
(
isBoolean
(
extension
.
isUnsupported
)
||
!
areSameExtensions
({
id
:
extension
.
isUnsupported
.
preReleaseExtension
.
id
},
{
id
:
unsupportedPreRelease
.
id
}))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录