Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3a0be849
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,发现更多精彩内容 >>
提交
3a0be849
编写于
12月 13, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#64755 Check strict nulls in ExtensionWorkbenchService
上级
6dee3396
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
96 addition
and
88 deletion
+96
-88
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-1
src/vs/workbench/parts/extensions/browser/extensionsWidgets.ts
...s/workbench/parts/extensions/browser/extensionsWidgets.ts
+5
-5
src/vs/workbench/parts/extensions/common/extensions.ts
src/vs/workbench/parts/extensions/common/extensions.ts
+11
-11
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
...ench/parts/extensions/electron-browser/extensionEditor.ts
+21
-16
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+57
-55
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
3a0be849
...
...
@@ -766,7 +766,8 @@
"./vs/workbench/test/electron-browser/api/mock.ts"
,
"./vs/platform/extensionManagement/node/multiExtensionManagement.ts"
,
"./vs/platform/extensionManagement/node/extensionManagementService.ts"
,
"./vs/platform/extensionManagement/node/extensionGalleryService.ts"
"./vs/platform/extensionManagement/node/extensionGalleryService.ts"
,
"./vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts"
],
"exclude"
:
[
"./typings/require-monaco.d.ts"
...
...
src/vs/workbench/parts/extensions/browser/extensionsWidgets.ts
浏览文件 @
3a0be849
...
...
@@ -67,7 +67,7 @@ export class InstallCountWidget implements IDisposable {
const
installCount
=
this
.
extension
.
installCount
;
if
(
installCount
===
null
)
{
if
(
installCount
===
undefined
)
{
return
;
}
...
...
@@ -126,16 +126,16 @@ export class RatingsWidget implements IDisposable {
return
;
}
const
rating
=
Math
.
round
(
this
.
extension
.
rating
*
2
)
/
2
;
if
(
this
.
extension
.
rating
===
null
)
{
if
(
this
.
extension
.
rating
===
undefined
)
{
return
;
}
if
(
this
.
options
.
small
&&
this
.
extension
.
ratingCount
===
0
)
{
if
(
this
.
options
.
small
&&
!
this
.
extension
.
ratingCount
)
{
return
;
}
const
rating
=
Math
.
round
(
this
.
extension
.
rating
*
2
)
/
2
;
if
(
this
.
options
.
small
)
{
append
(
this
.
container
,
$
(
'
span.full.star
'
));
...
...
src/vs/workbench/parts/extensions/common/extensions.ts
浏览文件 @
3a0be849
...
...
@@ -27,32 +27,32 @@ export const enum ExtensionState {
}
export
interface
IExtension
{
type
:
LocalExtensionType
;
type
?
:
LocalExtensionType
;
state
:
ExtensionState
;
name
:
string
;
displayName
:
string
;
id
:
string
;
uuid
:
string
;
uuid
?
:
string
;
publisher
:
string
;
publisherDisplayName
:
string
;
version
:
string
;
latestVersion
:
string
;
description
:
string
;
url
:
string
;
repository
:
string
;
url
?
:
string
;
repository
?
:
string
;
iconUrl
:
string
;
iconUrlFallback
:
string
;
licenseUrl
:
string
;
installCount
:
number
;
rating
:
number
;
ratingCount
:
number
;
licenseUrl
?
:
string
;
installCount
?
:
number
;
rating
?
:
number
;
ratingCount
?
:
number
;
outdated
:
boolean
;
enablementState
:
EnablementState
;
dependencies
:
string
[];
extensionPack
:
string
[];
telemetryData
:
any
;
preview
:
boolean
;
getManifest
(
token
:
CancellationToken
):
Promise
<
IExtensionManifest
|
undefined
>
;
getManifest
(
token
:
CancellationToken
):
Promise
<
IExtensionManifest
|
null
>
;
getReadme
(
token
:
CancellationToken
):
Promise
<
string
>
;
hasReadme
():
boolean
;
getChangelog
(
token
:
CancellationToken
):
Promise
<
string
>
;
...
...
@@ -68,7 +68,7 @@ export interface IExtensionDependencies {
hasDependencies
:
boolean
;
identifier
:
string
;
extension
:
IExtension
;
dependent
:
IExtensionDependencies
;
dependent
:
IExtensionDependencies
|
null
;
}
export
const
SERVICE_ID
=
'
extensionsWorkbenchService
'
;
...
...
@@ -88,7 +88,7 @@ export interface IExtensionsWorkbenchService {
installVersion
(
extension
:
IExtension
,
version
:
string
):
Promise
<
void
>
;
reinstall
(
extension
:
IExtension
):
Promise
<
void
>
;
setEnablement
(
extensions
:
IExtension
|
IExtension
[],
enablementState
:
EnablementState
):
Promise
<
void
>
;
loadDependencies
(
extension
:
IExtension
,
token
:
CancellationToken
):
Promise
<
IExtensionDependencies
>
;
loadDependencies
(
extension
:
IExtension
,
token
:
CancellationToken
):
Promise
<
IExtensionDependencies
|
null
>
;
open
(
extension
:
IExtension
,
sideByside
?:
boolean
):
Promise
<
any
>
;
checkForUpdates
():
Promise
<
void
>
;
allowedBadgeProviders
:
string
[];
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
浏览文件 @
3a0be849
...
...
@@ -602,24 +602,29 @@ export class ExtensionEditor extends BaseEditor {
}
return
this
.
loadContents
(()
=>
this
.
extensionDependencies
.
get
())
.
then
(
extensionDependencies
=>
{
const
content
=
$
(
'
div
'
,
{
class
:
'
subcontent
'
});
const
scrollableContent
=
new
DomScrollableElement
(
content
,
{});
append
(
this
.
content
,
scrollableContent
.
getDomNode
());
this
.
contentDisposables
.
push
(
scrollableContent
);
.
then
<
IActiveElement
>
(
extensionDependencies
=>
{
if
(
extensionDependencies
)
{
const
content
=
$
(
'
div
'
,
{
class
:
'
subcontent
'
});
const
scrollableContent
=
new
DomScrollableElement
(
content
,
{});
append
(
this
.
content
,
scrollableContent
.
getDomNode
());
this
.
contentDisposables
.
push
(
scrollableContent
);
const
dependenciesTree
=
this
.
renderDependencies
(
content
,
extensionDependencies
);
const
layout
=
()
=>
{
scrollableContent
.
scanDomNode
();
const
scrollDimensions
=
scrollableContent
.
getScrollDimensions
();
dependenciesTree
.
layout
(
scrollDimensions
.
height
);
};
const
removeLayoutParticipant
=
arrays
.
insert
(
this
.
layoutParticipants
,
{
layout
});
this
.
contentDisposables
.
push
(
toDisposable
(
removeLayoutParticipant
));
const
dependenciesTree
=
this
.
renderDependencies
(
content
,
extensionDependencies
);
const
layout
=
()
=>
{
scrollableContent
.
scanDomNode
();
const
scrollDimensions
=
scrollableContent
.
getScrollDimensions
();
dependenciesTree
.
layout
(
scrollDimensions
.
height
);
};
const
removeLayoutParticipant
=
arrays
.
insert
(
this
.
layoutParticipants
,
{
layout
});
this
.
contentDisposables
.
push
(
toDisposable
(
removeLayoutParticipant
));
this
.
contentDisposables
.
push
(
dependenciesTree
);
scrollableContent
.
scanDomNode
();
return
{
focus
()
{
dependenciesTree
.
domFocus
();
}
};
this
.
contentDisposables
.
push
(
dependenciesTree
);
scrollableContent
.
scanDomNode
();
return
{
focus
()
{
dependenciesTree
.
domFocus
();
}
};
}
else
{
append
(
this
.
content
,
$
(
'
p.nocontent
'
)).
textContent
=
localize
(
'
noDependencies
'
,
"
No Dependencies
"
);
return
Promise
.
resolve
(
this
.
content
);
}
},
error
=>
{
append
(
this
.
content
,
$
(
'
p.nocontent
'
)).
textContent
=
error
;
this
.
notificationService
.
error
(
error
);
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
3a0be849
...
...
@@ -51,13 +51,13 @@ class Extension implements IExtension {
private
galleryService
:
IExtensionGalleryService
,
private
stateProvider
:
IExtensionStateProvider
<
ExtensionState
>
,
public
locals
:
ILocalExtension
[],
public
gallery
:
IGalleryExtension
,
public
gallery
:
IGalleryExtension
|
undefined
,
private
telemetryService
:
ITelemetryService
,
private
logService
:
ILogService
)
{
}
get
type
():
LocalExtensionType
{
return
this
.
local
?
this
.
local
.
type
:
null
;
get
type
():
LocalExtensionType
|
undefined
{
return
this
.
local
?
this
.
local
.
type
:
undefined
;
}
get
name
():
string
{
...
...
@@ -79,7 +79,7 @@ class Extension implements IExtension {
return
getGalleryExtensionIdFromLocal
(
this
.
local
);
}
get
uuid
():
string
{
get
uuid
():
string
|
undefined
{
return
this
.
gallery
?
this
.
gallery
.
identifier
.
uuid
:
this
.
local
.
identifier
.
uuid
;
}
...
...
@@ -100,7 +100,7 @@ class Extension implements IExtension {
}
get
version
():
string
{
return
this
.
local
?
this
.
local
.
manifest
.
version
:
this
.
gallery
.
v
ersion
;
return
this
.
local
?
this
.
local
.
manifest
.
version
:
this
.
latestV
ersion
;
}
get
latestVersion
():
string
{
...
...
@@ -108,12 +108,12 @@ class Extension implements IExtension {
}
get
description
():
string
{
return
this
.
gallery
?
this
.
gallery
.
description
:
this
.
local
.
manifest
.
description
;
return
this
.
gallery
?
this
.
gallery
.
description
:
this
.
local
.
manifest
.
description
||
''
;
}
get
url
():
string
{
get
url
():
string
|
undefined
{
if
(
!
product
.
extensionsGallery
||
!
this
.
gallery
)
{
return
null
;
return
undefined
;
}
return
`
${
product
.
extensionsGallery
.
itemUrl
}
?itemName=
${
this
.
publisher
}
.
${
this
.
name
}
`
;
...
...
@@ -127,19 +127,19 @@ class Extension implements IExtension {
return
this
.
galleryIconUrlFallback
||
this
.
localIconUrl
||
this
.
defaultIconUrl
;
}
private
get
localIconUrl
():
string
{
private
get
localIconUrl
():
string
|
null
{
if
(
this
.
local
&&
this
.
local
.
manifest
.
icon
)
{
return
resources
.
joinPath
(
this
.
local
.
location
,
this
.
local
.
manifest
.
icon
).
toString
();
}
return
null
;
}
private
get
galleryIconUrl
():
string
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
icon
.
uri
;
private
get
galleryIconUrl
():
string
|
null
{
return
this
.
gallery
?
this
.
gallery
.
assets
.
icon
.
uri
:
null
;
}
private
get
galleryIconUrlFallback
():
string
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
icon
.
fallbackUri
;
private
get
galleryIconUrlFallback
():
string
|
null
{
return
this
.
gallery
?
this
.
gallery
.
assets
.
icon
.
fallbackUri
:
null
;
}
private
get
defaultIconUrl
():
string
{
...
...
@@ -156,12 +156,12 @@ class Extension implements IExtension {
return
require
.
toUrl
(
'
../electron-browser/media/defaultIcon.png
'
);
}
get
repository
():
string
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
repository
&&
this
.
gallery
.
assets
.
repository
.
uri
;
get
repository
():
string
|
undefined
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
repository
?
this
.
gallery
.
assets
.
repository
.
uri
:
undefined
;
}
get
licenseUrl
():
string
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
license
&&
this
.
gallery
.
assets
.
license
.
uri
;
get
licenseUrl
():
string
|
undefined
{
return
this
.
gallery
&&
this
.
gallery
.
assets
.
license
?
this
.
gallery
.
assets
.
license
.
uri
:
undefined
;
}
get
state
():
ExtensionState
{
...
...
@@ -170,16 +170,16 @@ class Extension implements IExtension {
public
isMalicious
:
boolean
=
false
;
get
installCount
():
number
{
return
this
.
gallery
?
this
.
gallery
.
installCount
:
null
;
get
installCount
():
number
|
undefined
{
return
this
.
gallery
?
this
.
gallery
.
installCount
:
undefined
;
}
get
rating
():
number
{
return
this
.
gallery
?
this
.
gallery
.
rating
:
null
;
get
rating
():
number
|
undefined
{
return
this
.
gallery
?
this
.
gallery
.
rating
:
undefined
;
}
get
ratingCount
():
number
{
return
this
.
gallery
?
this
.
gallery
.
ratingCount
:
null
;
get
ratingCount
():
number
|
undefined
{
return
this
.
gallery
?
this
.
gallery
.
ratingCount
:
undefined
;
}
get
outdated
():
boolean
{
...
...
@@ -201,16 +201,16 @@ class Extension implements IExtension {
}
private
isGalleryOutdated
():
boolean
{
return
this
.
local
&&
this
.
gallery
&&
semver
.
gt
(
this
.
local
.
manifest
.
version
,
this
.
gallery
.
version
)
;
return
this
.
local
&&
this
.
gallery
?
semver
.
gt
(
this
.
local
.
manifest
.
version
,
this
.
gallery
.
version
)
:
false
;
}
getManifest
(
token
:
CancellationToken
):
Promise
<
IExtensionManifest
>
{
getManifest
(
token
:
CancellationToken
):
Promise
<
IExtensionManifest
|
null
>
{
if
(
this
.
gallery
&&
!
this
.
isGalleryOutdated
())
{
if
(
this
.
gallery
.
assets
.
manifest
)
{
return
this
.
galleryService
.
getManifest
(
this
.
gallery
,
token
);
}
this
.
logService
.
error
(
nls
.
localize
(
'
Manifest is not found
'
,
"
Manifest is not found
"
),
this
.
id
);
return
Promise
.
resolve
(
undefined
);
return
Promise
.
resolve
(
null
);
}
return
Promise
.
resolve
(
this
.
local
.
manifest
);
...
...
@@ -333,7 +333,7 @@ class ExtensionDependencies implements IExtensionDependencies {
return
this
.
_identifier
;
}
get
dependent
():
IExtensionDependencies
{
get
dependent
():
IExtensionDependencies
|
null
{
return
this
.
_dependent
;
}
...
...
@@ -443,7 +443,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
const
locals
=
groupById
[
getGalleryExtensionIdFromLocal
(
local
)];
locals
.
splice
(
locals
.
indexOf
(
local
),
1
);
locals
.
splice
(
0
,
0
,
local
);
const
extension
=
installedById
[
local
.
identifier
.
id
]
||
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
locals
,
null
,
this
.
telemetryService
,
this
.
logService
);
const
extension
=
installedById
[
local
.
identifier
.
id
]
||
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
locals
,
void
0
,
this
.
telemetryService
,
this
.
logService
);
extension
.
locals
=
locals
;
extension
.
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
local
);
return
extension
;
...
...
@@ -471,9 +471,9 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
});
}
loadDependencies
(
extension
:
IExtension
,
token
:
CancellationToken
):
Promise
<
IExtensionDependencies
>
{
loadDependencies
(
extension
:
IExtension
,
token
:
CancellationToken
):
Promise
<
IExtensionDependencies
|
null
>
{
if
(
!
extension
.
dependencies
.
length
)
{
return
Promise
.
resolve
<
IExtensionDependencies
>
(
null
);
return
Promise
.
resolve
(
null
);
}
return
this
.
extensionService
.
getExtensionsReport
()
...
...
@@ -481,9 +481,8 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
const
maliciousSet
=
getMaliciousExtensionsSet
(
report
);
return
this
.
galleryService
.
loadAllDependencies
((
<
Extension
>
extension
).
dependencies
.
map
(
id
=>
({
id
})),
token
)
.
then
(
galleryExtensions
=>
galleryExtensions
.
map
(
galleryExtension
=>
this
.
fromGallery
(
galleryExtension
,
maliciousSet
)))
.
then
(
extensions
=>
[...
this
.
local
,
...
extensions
])
.
then
(
extensions
=>
{
.
then
(
galleryExtensions
=>
{
const
extensions
:
IExtension
[]
=
[...
this
.
local
,
...
galleryExtensions
.
map
(
galleryExtension
=>
this
.
fromGallery
(
galleryExtension
,
maliciousSet
))];
const
map
=
new
Map
<
string
,
IExtension
>
();
for
(
const
extension
of
extensions
)
{
map
.
set
(
extension
.
id
,
extension
);
...
...
@@ -494,7 +493,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
open
(
extension
:
IExtension
,
sideByside
:
boolean
=
false
):
Promise
<
any
>
{
return
Promise
.
resolve
(
this
.
editorService
.
openEditor
(
this
.
instantiationService
.
createInstance
(
ExtensionsInput
,
extension
),
null
,
sideByside
?
SIDE_GROUP
:
ACTIVE_GROUP
));
return
Promise
.
resolve
(
this
.
editorService
.
openEditor
(
this
.
instantiationService
.
createInstance
(
ExtensionsInput
,
extension
),
void
0
,
sideByside
?
SIDE_GROUP
:
ACTIVE_GROUP
));
}
private
getDistinctInstalledExtensions
(
allInstalled
:
ILocalExtension
[]):
Promise
<
ILocalExtension
[]
>
{
...
...
@@ -557,7 +556,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
// Otherwise falling back to old way so that we will not make many roundtrips
if
(
gallery
.
properties
.
engine
)
{
this
.
galleryService
.
loadCompatibleVersion
(
gallery
)
.
then
(
compatible
=>
compatible
?
this
.
syncLocalWithGalleryExtension
(
result
,
compatible
)
:
null
);
.
then
(
compatible
=>
compatible
?
this
.
syncLocalWithGalleryExtension
(
result
!
,
compatible
)
:
null
);
}
else
{
this
.
syncLocalWithGalleryExtension
(
result
,
gallery
);
}
...
...
@@ -572,7 +571,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
return
result
;
}
private
getInstalledExtensionMatchingGallery
(
gallery
:
IGalleryExtension
):
Extension
{
private
getInstalledExtensionMatchingGallery
(
gallery
:
IGalleryExtension
):
Extension
|
null
{
for
(
const
installed
of
this
.
installed
)
{
if
(
installed
.
uuid
)
{
// Installed from Gallery
if
(
installed
.
uuid
===
gallery
.
identifier
.
uuid
)
{
...
...
@@ -612,7 +611,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
private
eventuallySyncWithGallery
(
immediate
=
false
):
void
{
const
shouldSync
=
this
.
isAutoUpdateEnabled
()
||
this
.
isAutoCheckUpdatesEnabled
();
const
loop
=
()
=>
(
shouldSync
?
this
.
syncWithGallery
()
:
Promise
.
resolve
(
null
)).
then
(()
=>
this
.
eventuallySyncWithGallery
());
const
loop
=
()
=>
(
shouldSync
?
this
.
syncWithGallery
()
:
Promise
.
resolve
(
void
0
)).
then
(()
=>
this
.
eventuallySyncWithGallery
());
const
delay
=
immediate
?
0
:
ExtensionsWorkbenchService
.
SyncPeriod
;
this
.
syncDelayer
.
trigger
(
loop
,
delay
)
...
...
@@ -639,7 +638,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
promises
.
push
(
this
.
queryGallery
({
names
,
pageSize
:
names
.
length
}));
}
return
Promise
.
all
(
promises
).
then
(()
=>
null
);
return
Promise
.
all
(
promises
).
then
(()
=>
void
0
);
}
private
eventuallyAutoUpdateExtensions
():
void
{
...
...
@@ -649,7 +648,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
private
autoUpdateExtensions
():
Promise
<
any
>
{
if
(
!
this
.
isAutoUpdateEnabled
())
{
return
Promise
.
resolve
(
null
);
return
Promise
.
resolve
();
}
const
toUpdate
=
this
.
local
.
filter
(
e
=>
...
...
@@ -703,7 +702,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
uninstall
(
extension
:
IExtension
):
Promise
<
void
>
{
if
(
!
(
extension
instanceof
Extension
))
{
return
undefined
;
return
Promise
.
resolve
()
;
}
const
ext
=
extension
as
Extension
;
...
...
@@ -718,7 +717,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
location
:
ProgressLocation
.
Extensions
,
title
:
nls
.
localize
(
'
uninstallingExtension
'
,
'
Uninstalling extension....
'
),
source
:
`
${
toUninstall
[
0
].
identifier
.
id
}
`
},
()
=>
Promise
.
all
(
toUninstall
.
map
(
local
=>
this
.
extensionService
.
uninstall
(
local
))).
then
(()
=>
null
));
},
()
=>
Promise
.
all
(
toUninstall
.
map
(
local
=>
this
.
extensionService
.
uninstall
(
local
))).
then
(()
=>
void
0
));
}
installVersion
(
extension
:
IExtension
,
version
:
string
):
Promise
<
void
>
{
...
...
@@ -733,7 +732,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
return
this
.
galleryService
.
getExtension
(
extension
.
gallery
.
identifier
,
version
)
.
then
(
gallery
=>
{
if
(
!
gallery
)
{
return
null
;
return
void
0
;
}
return
this
.
installWithProgress
(
()
=>
this
.
extensionService
.
installFromGallery
(
gallery
)
...
...
@@ -744,7 +743,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
reinstall
(
extension
:
IExtension
):
Promise
<
void
>
{
if
(
!
(
extension
instanceof
Extension
))
{
return
undefined
;
return
Promise
.
resolve
()
;
}
const
ext
=
extension
as
Extension
;
...
...
@@ -757,7 +756,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
return
this
.
progressService
.
withProgress
({
location
:
ProgressLocation
.
Extensions
,
source
:
`
${
toReinstall
[
0
].
identifier
.
id
}
`
},
()
=>
Promise
.
all
(
toReinstall
.
map
(
local
=>
this
.
extensionService
.
reinstallFromGallery
(
local
))).
then
(()
=>
null
));
},
()
=>
Promise
.
all
(
toReinstall
.
map
(
local
=>
this
.
extensionService
.
reinstallFromGallery
(
local
))).
then
(()
=>
void
0
));
}
private
installWithProgress
(
installTask
:
()
=>
Promise
<
void
>
,
extensionName
?:
string
):
Promise
<
void
>
{
...
...
@@ -769,14 +768,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
private
checkAndEnableDisabledDependencies
(
extensionIdentifier
:
IExtensionIdentifier
):
Promise
<
void
>
{
const
extension
=
this
.
local
.
filter
(
e
=>
(
e
.
local
||
e
.
gallery
)
&&
areSameExtensions
(
extensionIdentifier
,
e
.
local
?
e
.
local
.
identifier
:
e
.
gallery
.
identifier
))[
0
];
const
extension
=
this
.
local
.
filter
(
e
=>
(
e
.
local
||
e
.
gallery
)
&&
areSameExtensions
(
extensionIdentifier
,
e
.
local
?
e
.
local
.
identifier
:
e
.
gallery
!
.
identifier
))[
0
];
if
(
extension
)
{
const
disabledDepencies
=
this
.
getExtensionsRecursively
([
extension
],
this
.
local
,
EnablementState
.
Enabled
,
{
dependencies
:
true
,
pack
:
false
});
if
(
disabledDepencies
.
length
)
{
return
this
.
setEnablement
(
disabledDepencies
,
EnablementState
.
Enabled
);
}
}
return
Promise
.
resolve
(
null
);
return
Promise
.
resolve
();
}
private
promptAndSetEnablement
(
extensions
:
IExtension
[],
enablementState
:
EnablementState
):
Promise
<
any
>
{
...
...
@@ -877,7 +876,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
private
doSetEnablement
(
extension
:
IExtension
,
enablementState
:
EnablementState
):
Promise
<
boolean
>
{
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
local
,
enablementState
)
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
local
!
,
enablementState
)
.
then
(
changed
=>
{
if
(
changed
)
{
/* __GDPR__
...
...
@@ -930,15 +929,18 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
private
onDidInstallExtension
(
event
:
DidInstallExtensionEvent
):
void
{
const
{
local
,
zipPath
,
error
,
gallery
}
=
event
;
const
installingExtension
=
gallery
?
this
.
installing
.
filter
(
e
=>
areSameExtensions
(
e
,
gallery
.
identifier
))[
0
]
:
null
;
let
extension
:
Extension
=
installingExtension
?
installingExtension
:
zipPath
?
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
[
local
],
null
,
this
.
telemetryService
,
this
.
logService
)
:
null
;
let
extension
:
Extension
|
undefined
=
installingExtension
?
installingExtension
:
zipPath
?
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
local
?
[
local
]
:
[],
void
0
,
this
.
telemetryService
,
this
.
logService
)
:
undefined
;
if
(
extension
)
{
this
.
installing
=
installingExtension
?
this
.
installing
.
filter
(
e
=>
e
!==
installingExtension
)
:
this
.
installing
;
if
(
!
error
)
{
const
installed
=
this
.
installed
.
filter
(
e
=>
e
.
id
===
extension
.
id
)[
0
];
if
(
local
)
{
const
installed
=
this
.
installed
.
filter
(
e
=>
e
.
id
===
extension
!
.
id
)[
0
];
if
(
installed
)
{
extension
=
installed
;
const
server
=
this
.
extensionManagementServerService
.
getExtensionManagementServer
(
local
.
location
);
const
existingLocal
=
installed
.
locals
.
filter
(
l
=>
this
.
extensionManagementServerService
.
getExtensionManagementServer
(
l
.
location
).
authority
===
server
.
authority
)[
0
];
const
newServer
=
this
.
extensionManagementServerService
.
getExtensionManagementServer
(
local
.
location
);
const
existingLocal
=
newServer
&&
installed
.
locals
.
filter
(
l
=>
{
const
server
=
this
.
extensionManagementServerService
.
getExtensionManagementServer
(
l
.
location
);
return
server
&&
server
.
authority
===
newServer
.
authority
;
})[
0
];
if
(
existingLocal
)
{
const
locals
=
[...
installed
.
locals
];
locals
.
splice
(
installed
.
locals
.
indexOf
(
existingLocal
),
1
,
local
);
...
...
@@ -952,7 +954,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
}
}
this
.
_onChange
.
fire
(
error
?
null
:
extension
);
this
.
_onChange
.
fire
(
error
?
undefined
:
extension
);
}
private
onUninstallExtension
({
id
}:
IExtensionIdentifier
):
void
{
...
...
@@ -997,7 +999,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
private
getExtensionState
(
extension
:
Extension
):
ExtensionState
{
if
(
extension
.
gallery
&&
this
.
installing
.
some
(
e
=>
e
.
gallery
&&
areSameExtensions
(
e
.
gallery
.
identifier
,
extension
.
gallery
.
identifier
)))
{
if
(
extension
.
gallery
&&
this
.
installing
.
some
(
e
=>
!!
e
.
gallery
&&
areSameExtensions
(
e
.
gallery
.
identifier
,
extension
.
gallery
!
.
identifier
)))
{
return
ExtensionState
.
Installing
;
}
...
...
@@ -1099,7 +1101,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
private
resetIgnoreAutoUpdateExtensions
():
void
{
this
.
ignoredAutoUpdateExtensions
=
this
.
ignoredAutoUpdateExtensions
.
filter
(
extensionId
=>
this
.
local
.
some
(
local
=>
local
.
local
&&
local
.
local
.
identifier
.
id
.
toLowerCase
()
===
extensionId
));
this
.
ignoredAutoUpdateExtensions
=
this
.
ignoredAutoUpdateExtensions
.
filter
(
extensionId
=>
this
.
local
.
some
(
local
=>
!!
local
.
local
&&
local
.
local
.
identifier
.
id
.
toLowerCase
()
===
extensionId
));
}
dispose
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录