Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
6f80511a
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
6f80511a
编写于
3月 06, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #45122
上级
8f6c4465
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
33 addition
and
32 deletion
+33
-32
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+3
-7
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
...form/extensionManagement/common/extensionManagementIpc.ts
+6
-5
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+8
-7
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
...bench/parts/extensions/node/extensionsWorkbenchService.ts
+3
-3
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
...kbench/parts/welcome/page/electron-browser/welcomePage.ts
+4
-6
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
.../services/extensions/electron-browser/extensionService.ts
+9
-4
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
6f80511a
...
...
@@ -271,10 +271,10 @@ export interface IExtensionManagementService {
onUninstallExtension
:
Event
<
IExtensionIdentifier
>
;
onDidUninstallExtension
:
Event
<
DidUninstallExtensionEvent
>
;
install
(
zipPath
:
string
):
TPromise
<
void
>
;
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
install
(
zipPath
:
string
):
TPromise
<
ILocalExtension
>
;
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
;
uninstall
(
extension
:
ILocalExtension
,
force
?:
boolean
):
TPromise
<
void
>
;
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
void
>
;
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
ILocalExtension
>
;
getInstalled
(
type
?:
LocalExtensionType
):
TPromise
<
ILocalExtension
[]
>
;
getExtensionsReport
():
TPromise
<
IReportedExtension
[]
>
;
...
...
@@ -330,10 +330,6 @@ export interface IExtensionEnablementService {
* Throws error if enablement is requested for workspace and there is no workspace
*/
setEnablement
(
extension
:
ILocalExtension
,
state
:
EnablementState
):
TPromise
<
boolean
>
;
/**
* TODO: @Sandy. Use setEnablement(extension: ILocalExtension, state: EnablementState): TPromise<boolean>. Use one model for extension management and runtime
*/
setEnablement
(
identifier
:
IExtensionIdentifier
,
state
:
EnablementState
):
TPromise
<
boolean
>
;
}
export
const
IExtensionTipsService
=
createDecorator
<
IExtensionTipsService
>
(
'
extensionTipsService
'
);
...
...
src/vs/platform/extensionManagement/common/extensionManagementIpc.ts
浏览文件 @
6f80511a
...
...
@@ -15,9 +15,10 @@ export interface IExtensionManagementChannel extends IChannel {
call
(
command
:
'
event:onDidInstallExtension
'
):
TPromise
<
void
>
;
call
(
command
:
'
event:onUninstallExtension
'
):
TPromise
<
void
>
;
call
(
command
:
'
event:onDidUninstallExtension
'
):
TPromise
<
void
>
;
call
(
command
:
'
install
'
,
path
:
string
):
TPromise
<
void
>
;
call
(
command
:
'
installFromGallery
'
,
extension
:
IGalleryExtension
):
TPromise
<
void
>
;
call
(
command
:
'
install
'
,
path
:
string
):
TPromise
<
ILocalExtension
>
;
call
(
command
:
'
installFromGallery
'
,
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
;
call
(
command
:
'
uninstall
'
,
args
:
[
ILocalExtension
,
boolean
]):
TPromise
<
void
>
;
call
(
command
:
'
reinstall
'
,
args
:
[
ILocalExtension
]):
TPromise
<
ILocalExtension
>
;
call
(
command
:
'
getInstalled
'
):
TPromise
<
ILocalExtension
[]
>
;
call
(
command
:
'
getExtensionsReport
'
):
TPromise
<
IReportedExtension
[]
>
;
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
;
...
...
@@ -73,11 +74,11 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
private
_onDidUninstallExtension
=
eventFromCall
<
DidUninstallExtensionEvent
>
(
this
.
channel
,
'
event:onDidUninstallExtension
'
);
get
onDidUninstallExtension
():
Event
<
DidUninstallExtensionEvent
>
{
return
this
.
_onDidUninstallExtension
;
}
install
(
zipPath
:
string
):
TPromise
<
void
>
{
install
(
zipPath
:
string
):
TPromise
<
ILocalExtension
>
{
return
this
.
channel
.
call
(
'
install
'
,
zipPath
);
}
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
{
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
return
this
.
channel
.
call
(
'
installFromGallery
'
,
[
extension
]);
}
...
...
@@ -85,7 +86,7 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
return
this
.
channel
.
call
(
'
uninstall
'
,
[
extension
,
force
]);
}
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
void
>
{
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
ILocalExtension
>
{
return
this
.
channel
.
call
(
'
reinstall
'
,
[
extension
]);
}
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
6f80511a
...
...
@@ -141,7 +141,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
this
.
extensionLifecycle
=
this
.
_register
(
new
ExtensionsLifecycle
(
this
.
logService
));
}
install
(
zipPath
:
string
):
TPromise
<
void
>
{
install
(
zipPath
:
string
):
TPromise
<
ILocalExtension
>
{
zipPath
=
path
.
resolve
(
zipPath
);
return
validateLocalExtension
(
zipPath
)
...
...
@@ -159,7 +159,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
metadata
=>
this
.
installFromZipPath
(
identifier
,
zipPath
,
metadata
,
manifest
),
error
=>
this
.
installFromZipPath
(
identifier
,
zipPath
,
null
,
manifest
))
.
then
(
()
=>
this
.
logService
.
info
(
'
Successfully installed the extension:
'
,
identifier
.
id
)
,
local
=>
{
this
.
logService
.
info
(
'
Successfully installed the extension:
'
,
identifier
.
id
);
return
local
;
}
,
e
=>
{
this
.
logService
.
error
(
'
Failed to install the extension:
'
,
identifier
.
id
,
e
.
message
);
return
TPromise
.
wrapError
(
e
);
...
...
@@ -208,7 +208,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
});
}
private
installFromZipPath
(
identifier
:
IExtensionIdentifier
,
zipPath
:
string
,
metadata
:
IGalleryMetadata
,
manifest
:
IExtensionManifest
):
TPromise
<
void
>
{
private
installFromZipPath
(
identifier
:
IExtensionIdentifier
,
zipPath
:
string
,
metadata
:
IGalleryMetadata
,
manifest
:
IExtensionManifest
):
TPromise
<
ILocalExtension
>
{
return
this
.
installExtension
({
zipPath
,
id
:
identifier
.
id
,
metadata
})
.
then
(
local
=>
{
if
(
this
.
galleryService
.
isEnabled
()
&&
local
.
manifest
.
extensionDependencies
&&
local
.
manifest
.
extensionDependencies
.
length
)
{
...
...
@@ -222,12 +222,12 @@ export class ExtensionManagementService extends Disposable implements IExtension
return
local
;
})
.
then
(
local
=>
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
local
})
,
local
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
local
});
return
local
;
}
,
error
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
error
});
return
TPromise
.
wrapError
(
error
);
}
);
}
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
void
>
{
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
this
.
onInstallExtensions
([
extension
]);
return
this
.
collectExtensionsToInstall
(
extension
)
.
then
(
...
...
@@ -237,13 +237,14 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
return
this
.
downloadAndInstallExtensions
(
extensionsToInstall
)
.
then
(
locals
=>
this
.
onDidInstallExtensions
(
extensionsToInstall
,
locals
,
[]),
locals
=>
this
.
onDidInstallExtensions
(
extensionsToInstall
,
locals
,
[])
.
then
(()
=>
locals
.
filter
(
l
=>
areSameExtensions
({
id
:
getGalleryExtensionIdFromLocal
(
l
),
uuid
:
l
.
identifier
.
uuid
},
extension
.
identifier
)[
0
])),
errors
=>
this
.
onDidInstallExtensions
(
extensionsToInstall
,
[],
errors
));
},
error
=>
this
.
onDidInstallExtensions
([
extension
],
[],
[
error
]));
}
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
void
>
{
reinstall
(
extension
:
ILocalExtension
):
TPromise
<
ILocalExtension
>
{
if
(
!
this
.
galleryService
.
isEnabled
())
{
return
TPromise
.
wrapError
(
new
Error
(
nls
.
localize
(
'
MarketPlaceDisabled
'
,
"
Marketplace is not enabled
"
)));
}
...
...
src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
6f80511a
...
...
@@ -589,7 +589,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
location
:
ProgressLocation
.
Extensions
,
title
:
nls
.
localize
(
'
installingVSIXExtension
'
,
'
Installing extension from VSIX...
'
),
tooltip
:
`
${
extension
}
`
},
()
=>
this
.
extensionService
.
install
(
extension
));
},
()
=>
this
.
extensionService
.
install
(
extension
)
.
then
(()
=>
null
)
);
}
if
(
!
(
extension
instanceof
Extension
))
{
...
...
@@ -611,7 +611,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
location
:
ProgressLocation
.
Extensions
,
title
:
nls
.
localize
(
'
installingMarketPlaceExtension
'
,
'
Installing extension from Marketplace....
'
),
tooltip
:
`
${
extension
.
id
}
`
},
()
=>
this
.
extensionService
.
installFromGallery
(
gallery
));
},
()
=>
this
.
extensionService
.
installFromGallery
(
gallery
)
.
then
(()
=>
null
)
);
}
setEnablement
(
extension
:
IExtension
,
enablementState
:
EnablementState
):
TPromise
<
void
>
{
...
...
@@ -670,7 +670,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return
this
.
progressService
.
withProgress
({
location
:
ProgressLocation
.
Extensions
,
tooltip
:
`
${
local
.
identifier
.
id
}
`
},
()
=>
this
.
extensionService
.
reinstall
(
local
));
},
()
=>
this
.
extensionService
.
reinstall
(
local
)
.
then
(()
=>
null
)
);
}
private
promptAndSetEnablement
(
extension
:
IExtension
,
enablementState
:
EnablementState
,
enable
:
boolean
):
TPromise
<
any
>
{
...
...
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
浏览文件 @
6f80511a
...
...
@@ -416,18 +416,16 @@ class WelcomePage {
this
.
notificationService
.
info
(
strings
.
alreadyInstalled
.
replace
(
'
{0}
'
,
extensionSuggestion
.
name
));
return
;
}
const
foundAndInstalled
=
installedExtension
?
TPromise
.
as
(
installedExtension
.
identifier
)
:
this
.
extensionGalleryService
.
query
({
names
:
[
extensionSuggestion
.
id
],
source
:
telemetryFrom
})
const
foundAndInstalled
=
installedExtension
?
TPromise
.
as
(
installedExtension
.
local
)
:
this
.
extensionGalleryService
.
query
({
names
:
[
extensionSuggestion
.
id
],
source
:
telemetryFrom
})
.
then
(
result
=>
{
const
[
extension
]
=
result
.
firstPage
;
if
(
!
extension
)
{
return
null
;
}
return
this
.
extensionManagementService
.
installFromGallery
(
extension
)
.
then
(
()
=>
{
.
then
(
local
=>
{
// TODO: Do this as part of the install to avoid multiple events.
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
identifier
,
EnablementState
.
Disabled
);
}).
then
(()
=>
{
return
extension
.
identifier
;
return
this
.
extensionEnablementService
.
setEnablement
(
local
,
EnablementState
.
Disabled
).
then
(()
=>
local
);
});
});
...
...
@@ -440,7 +438,7 @@ class WelcomePage {
});
TPromise
.
join
(
extensionSuggestion
.
isKeymap
?
extensions
.
filter
(
extension
=>
isKeymapExtension
(
this
.
tipsService
,
extension
)
&&
extension
.
globallyEnabled
)
.
map
(
extension
=>
{
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
identifier
,
EnablementState
.
Disabled
);
return
this
.
extensionEnablementService
.
setEnablement
(
extension
.
local
,
EnablementState
.
Disabled
);
})
:
[]).
then
(()
=>
{
return
foundAndInstalled
.
then
(
foundExtension
=>
{
messageDelay
.
cancel
();
...
...
src/vs/workbench/services/extensions/electron-browser/extensionService.ts
浏览文件 @
6f80511a
...
...
@@ -17,8 +17,8 @@ import * as platform from 'vs/base/common/platform';
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/node/extensionDescriptionRegistry
'
;
import
{
IMessage
,
IExtensionDescription
,
IExtensionsStatus
,
IExtensionService
,
ExtensionPointContribution
,
ActivationTimes
,
ProfileSession
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
USER_MANIFEST_CACHE_FILE
,
BUILTIN_MANIFEST_CACHE_FILE
,
MANIFEST_CACHE_FOLDER
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtensionEnablementService
,
IExtensionIdentifier
,
EnablementState
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
areSameExtensions
,
BetterMergeId
,
BetterMergeDisabledNowKey
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IExtensionEnablementService
,
IExtensionIdentifier
,
EnablementState
,
IExtensionManagementService
,
LocalExtensionType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
areSameExtensions
,
BetterMergeId
,
BetterMergeDisabledNowKey
,
getGalleryExtensionIdFromLocal
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
ExtensionsRegistry
,
ExtensionPoint
,
IExtensionPointUser
,
ExtensionMessageCollector
,
IExtensionPoint
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
import
{
ExtensionScanner
,
ILog
,
ExtensionScannerInput
,
IExtensionResolver
,
IExtensionReference
,
Translations
}
from
'
vs/workbench/services/extensions/node/extensionPoints
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/extensions/node/proxyIdentifier
'
;
...
...
@@ -150,7 +150,8 @@ export class ExtensionService extends Disposable implements IExtensionService {
@
IExtensionEnablementService
private
readonly
_extensionEnablementService
:
IExtensionEnablementService
,
@
IStorageService
private
readonly
_storageService
:
IStorageService
,
@
IWindowService
private
readonly
_windowService
:
IWindowService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IExtensionManagementService
private
extensionManagementService
:
IExtensionManagementService
)
{
super
();
this
.
_registry
=
null
;
...
...
@@ -500,7 +501,11 @@ export class ExtensionService extends Disposable implements IExtensionService {
});
if
(
extensionsToDisable
.
length
)
{
return
TPromise
.
join
(
extensionsToDisable
.
map
(
e
=>
this
.
_extensionEnablementService
.
setEnablement
(
e
,
EnablementState
.
Disabled
)))
return
this
.
extensionManagementService
.
getInstalled
(
LocalExtensionType
.
User
)
.
then
(
installed
=>
{
const
toDisable
=
installed
.
filter
(
i
=>
extensionsToDisable
.
some
(
e
=>
areSameExtensions
({
id
:
getGalleryExtensionIdFromLocal
(
i
)
},
e
)));
return
TPromise
.
join
(
toDisable
.
map
(
e
=>
this
.
_extensionEnablementService
.
setEnablement
(
e
,
EnablementState
.
Disabled
)));
})
.
then
(()
=>
{
this
.
_storageService
.
store
(
BetterMergeDisabledNowKey
,
true
);
return
runtimeExtensions
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录