Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0c43f4ef
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,发现更多精彩内容 >>
提交
0c43f4ef
编写于
10月 03, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up
上级
b7639f6f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
2 addition
and
131 deletion
+2
-131
src/vs/platform/extensionManagement/common/extensionManagementUtil.ts
...orm/extensionManagement/common/extensionManagementUtil.ts
+1
-25
src/vs/platform/extensionManagement/node/multiExtensionManagement.ts
...form/extensionManagement/node/multiExtensionManagement.ts
+0
-104
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+1
-2
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagementUtil.ts
浏览文件 @
0c43f4ef
...
...
@@ -3,8 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ILocalExtension
,
IGalleryExtension
,
IExtensionIdentifier
,
IReportedExtension
,
IExtensionManifest
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILocalExtension
,
IGalleryExtension
,
IExtensionIdentifier
,
IReportedExtension
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
compareIgnoreCase
}
from
'
vs/base/common/strings
'
;
export
function
areSameExtensions
(
a
:
IExtensionIdentifier
,
b
:
IExtensionIdentifier
):
boolean
{
...
...
@@ -117,27 +116,4 @@ export function getMaliciousExtensionsSet(report: IReportedExtension[]): Set<str
}
return
result
;
}
const
nonWorkspaceExtensions
=
new
Set
<
string
>
();
export
function
isWorkspaceExtension
(
manifest
:
IExtensionManifest
,
configurationService
:
IConfigurationService
):
boolean
{
const
extensionId
=
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
);
const
configuredWorkspaceExtensions
=
configurationService
.
getValue
<
string
[]
>
(
'
_workbench.workspaceExtensions
'
)
||
[];
if
(
configuredWorkspaceExtensions
.
length
)
{
if
(
configuredWorkspaceExtensions
.
indexOf
(
extensionId
)
!==
-
1
)
{
return
true
;
}
if
(
configuredWorkspaceExtensions
.
indexOf
(
`-
${
extensionId
}
`
)
!==
-
1
)
{
return
false
;
}
}
if
(
manifest
.
main
)
{
if
((
manifest
.
categories
||
[]).
indexOf
(
'
Workspace Extension
'
)
!==
-
1
)
{
return
true
;
}
return
!
nonWorkspaceExtensions
.
has
(
extensionId
);
}
return
false
;
}
\ No newline at end of file
src/vs/platform/extensionManagement/node/multiExtensionManagement.ts
已删除
100644 → 0
浏览文件 @
b7639f6f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
,
EventMultiplexer
}
from
'
vs/base/common/event
'
;
import
{
IExtensionManagementService
,
ILocalExtension
,
IGalleryExtension
,
LocalExtensionType
,
InstallExtensionEvent
,
DidInstallExtensionEvent
,
IExtensionIdentifier
,
DidUninstallExtensionEvent
,
IReportedExtension
,
IGalleryMetadata
,
IExtensionManagementServerService
,
IExtensionManagementServer
,
IExtensionGalleryService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
flatten
}
from
'
vs/base/common/arrays
'
;
import
{
isWorkspaceExtension
,
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
export
class
MulitExtensionManagementService
extends
Disposable
implements
IExtensionManagementService
{
_serviceBrand
:
any
;
readonly
onInstallExtension
:
Event
<
InstallExtensionEvent
>
;
readonly
onDidInstallExtension
:
Event
<
DidInstallExtensionEvent
>
;
readonly
onUninstallExtension
:
Event
<
IExtensionIdentifier
>
;
readonly
onDidUninstallExtension
:
Event
<
DidUninstallExtensionEvent
>
;
private
readonly
servers
:
IExtensionManagementServer
[];
private
readonly
localServer
:
IExtensionManagementServer
;
private
readonly
otherServers
:
IExtensionManagementServer
[];
constructor
(
@
IExtensionManagementServerService
private
extensionManagementServerService
:
IExtensionManagementServerService
,
@
IExtensionGalleryService
private
extensionGalleryService
:
IExtensionGalleryService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
();
this
.
servers
=
this
.
extensionManagementServerService
.
extensionManagementServers
;
this
.
localServer
=
this
.
extensionManagementServerService
.
getLocalExtensionManagementServer
();
this
.
otherServers
=
this
.
servers
.
filter
(
s
=>
s
!==
this
.
localServer
);
this
.
onInstallExtension
=
this
.
_register
(
this
.
servers
.
reduce
((
emitter
:
EventMultiplexer
<
InstallExtensionEvent
>
,
server
)
=>
{
emitter
.
add
(
server
.
extensionManagementService
.
onInstallExtension
);
return
emitter
;
},
new
EventMultiplexer
<
InstallExtensionEvent
>
())).
event
;
this
.
onDidInstallExtension
=
this
.
_register
(
this
.
servers
.
reduce
((
emitter
:
EventMultiplexer
<
DidInstallExtensionEvent
>
,
server
)
=>
{
emitter
.
add
(
server
.
extensionManagementService
.
onDidInstallExtension
);
return
emitter
;
},
new
EventMultiplexer
<
DidInstallExtensionEvent
>
())).
event
;
this
.
onUninstallExtension
=
this
.
_register
(
this
.
servers
.
reduce
((
emitter
:
EventMultiplexer
<
IExtensionIdentifier
>
,
server
)
=>
{
emitter
.
add
(
server
.
extensionManagementService
.
onUninstallExtension
);
return
emitter
;
},
new
EventMultiplexer
<
IExtensionIdentifier
>
())).
event
;
this
.
onDidUninstallExtension
=
this
.
_register
(
this
.
servers
.
reduce
((
emitter
:
EventMultiplexer
<
DidUninstallExtensionEvent
>
,
server
)
=>
{
emitter
.
add
(
server
.
extensionManagementService
.
onDidUninstallExtension
);
return
emitter
;
},
new
EventMultiplexer
<
DidUninstallExtensionEvent
>
())).
event
;
}
getInstalled
(
type
?:
LocalExtensionType
):
Promise
<
ILocalExtension
[]
>
{
return
Promise
.
all
(
this
.
servers
.
map
(({
extensionManagementService
})
=>
extensionManagementService
.
getInstalled
(
type
)))
.
then
(
result
=>
flatten
(
result
));
}
uninstall
(
extension
:
ILocalExtension
,
force
?:
boolean
):
Promise
<
void
>
{
return
this
.
getServer
(
extension
).
extensionManagementService
.
uninstall
(
extension
,
force
);
}
reinstallFromGallery
(
extension
:
ILocalExtension
):
Promise
<
void
>
{
return
this
.
getServer
(
extension
).
extensionManagementService
.
reinstallFromGallery
(
extension
);
}
updateMetadata
(
extension
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
Promise
<
ILocalExtension
>
{
return
this
.
getServer
(
extension
).
extensionManagementService
.
updateMetadata
(
extension
,
metadata
);
}
zip
(
extension
:
ILocalExtension
):
Promise
<
URI
>
{
throw
new
Error
(
'
Not Supported
'
);
}
unzip
(
zipLocation
:
URI
,
type
:
LocalExtensionType
):
Promise
<
IExtensionIdentifier
>
{
return
Promise
.
all
(
this
.
servers
.
map
(({
extensionManagementService
})
=>
extensionManagementService
.
unzip
(
zipLocation
,
type
))).
then
(()
=>
null
);
}
install
(
vsix
:
URI
):
Promise
<
IExtensionIdentifier
>
{
return
this
.
localServer
.
extensionManagementService
.
install
(
vsix
)
.
then
(
extensionIdentifer
=>
this
.
localServer
.
extensionManagementService
.
getInstalled
(
LocalExtensionType
.
User
)
.
then
(
installed
=>
{
const
extension
=
installed
.
filter
(
i
=>
areSameExtensions
(
i
.
identifier
,
extensionIdentifer
))[
0
];
if
(
this
.
otherServers
.
length
&&
extension
&&
isWorkspaceExtension
(
extension
.
manifest
,
this
.
configurationService
))
{
return
Promise
.
all
(
this
.
otherServers
.
map
(
server
=>
server
.
extensionManagementService
.
install
(
vsix
)))
.
then
(()
=>
extensionIdentifer
);
}
return
extensionIdentifer
;
}));
}
installFromGallery
(
gallery
:
IGalleryExtension
):
Promise
<
void
>
{
if
(
this
.
otherServers
.
length
===
0
)
{
return
this
.
localServer
.
extensionManagementService
.
installFromGallery
(
gallery
);
}
return
this
.
extensionGalleryService
.
getManifest
(
gallery
,
CancellationToken
.
None
)
.
then
(
manifest
=>
{
const
servers
=
isWorkspaceExtension
(
manifest
,
this
.
configurationService
)
?
this
.
servers
:
[
this
.
localServer
];
return
Promise
.
all
(
servers
.
map
(
server
=>
server
.
extensionManagementService
.
installFromGallery
(
gallery
)))
.
then
(()
=>
null
);
});
}
getExtensionsReport
():
Promise
<
IReportedExtension
[]
>
{
return
this
.
extensionManagementServerService
.
getLocalExtensionManagementServer
().
extensionManagementService
.
getExtensionsReport
();
}
private
getServer
(
extension
:
ILocalExtension
):
IExtensionManagementServer
{
return
this
.
extensionManagementServerService
.
getExtensionManagementServer
(
extension
.
location
);
}
}
\ No newline at end of file
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
0c43f4ef
...
...
@@ -92,7 +92,6 @@ import { EventType, addDisposableListener, addClass, measure } from 'vs/base/bro
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
OpenerService
}
from
'
vs/editor/browser/services/openerService
'
;
import
{
SearchHistoryService
}
from
'
vs/workbench/services/search/node/searchHistoryService
'
;
import
{
MulitExtensionManagementService
}
from
'
vs/platform/extensionManagement/node/multiExtensionManagement
'
;
import
{
ExtensionManagementServerService
}
from
'
vs/workbench/services/extensions/node/extensionManagementServerService
'
;
import
{
DefaultURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
ExtensionGalleryService
}
from
'
vs/platform/extensionManagement/node/extensionGalleryService
'
;
...
...
@@ -394,7 +393,7 @@ export class WorkbenchShell extends Disposable {
const
extensionManagementChannel
=
getDelayedChannel
<
IExtensionManagementChannel
>
(
sharedProcess
.
then
(
c
=>
c
.
getChannel
(
'
extensions
'
)));
const
extensionManagementChannelClient
=
new
ExtensionManagementChannelClient
(
extensionManagementChannel
,
DefaultURITransformer
);
serviceCollection
.
set
(
IExtensionManagementServerService
,
new
SyncDescriptor
(
ExtensionManagementServerService
,
extensionManagementChannelClient
));
serviceCollection
.
set
(
IExtensionManagementService
,
new
SyncDescriptor
(
MulitExtensionManagementService
)
);
serviceCollection
.
set
(
IExtensionManagementService
,
extensionManagementChannelClient
);
const
extensionEnablementService
=
this
.
_register
(
instantiationService
.
createInstance
(
ExtensionEnablementService
));
serviceCollection
.
set
(
IExtensionEnablementService
,
extensionEnablementService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录