Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
84cd19b9
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,发现更多精彩内容 >>
提交
84cd19b9
编写于
11月 12, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
explore extensions management
上级
effad7f9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
191 addition
and
1 deletion
+191
-1
src/vs/platform/download/node/downloadIpc.ts
src/vs/platform/download/node/downloadIpc.ts
+79
-0
src/vs/platform/extensionManagement/node/multiExtensionManagement.ts
...form/extensionManagement/node/multiExtensionManagement.ts
+101
-0
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+11
-1
未找到文件。
src/vs/platform/download/node/downloadIpc.ts
0 → 100644
浏览文件 @
84cd19b9
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
path
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
Event
,
Emitter
,
buffer
}
from
'
vs/base/common/event
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
IURITransformer
}
from
'
vs/base/common/uriIpc
'
;
export
type
UploadResponse
=
Buffer
|
string
|
undefined
;
export
function
upload
(
uri
:
URI
):
Event
<
UploadResponse
>
{
const
stream
=
new
Emitter
<
UploadResponse
>
();
const
readstream
=
fs
.
createReadStream
(
uri
.
fsPath
);
readstream
.
on
(
'
data
'
,
data
=>
stream
.
fire
(
data
));
readstream
.
on
(
'
error
'
,
error
=>
stream
.
fire
(
error
.
toString
()));
readstream
.
on
(
'
close
'
,
()
=>
stream
.
fire
());
return
stream
.
event
;
}
export
interface
IDownloadServiceChannel
extends
IChannel
{
listen
(
event
:
'
upload
'
,
uri
:
URI
):
Event
<
UploadResponse
>
;
listen
(
event
:
string
,
arg
?:
any
):
Event
<
any
>
;
}
export
class
DownloadServiceChannel
implements
IDownloadServiceChannel
{
constructor
()
{
}
listen
(
event
:
string
,
arg
?:
any
):
Event
<
any
>
{
switch
(
event
)
{
case
'
upload
'
:
return
buffer
(
upload
(
URI
.
revive
(
arg
)));
}
return
undefined
;
}
call
(
command
:
string
,
arg
?:
any
):
TPromise
<
any
>
{
throw
new
Error
(
'
No calls
'
);
}
}
export
class
DownloadServiceChannelClient
implements
IDownloadService
{
_serviceBrand
:
any
;
constructor
(
private
channel
:
IDownloadServiceChannel
,
private
uriTransformer
:
IURITransformer
)
{
}
download
(
from
:
URI
,
to
:
string
):
Promise
<
void
>
{
from
=
this
.
uriTransformer
.
transformOutgoing
(
from
);
const
dirName
=
path
.
dirname
(
to
);
let
out
:
fs
.
WriteStream
;
return
new
Promise
((
c
,
e
)
=>
{
return
mkdirp
(
dirName
)
.
then
(()
=>
{
out
=
fs
.
createWriteStream
(
to
);
out
.
once
(
'
close
'
,
()
=>
c
(
null
));
out
.
once
(
'
error
'
,
e
);
const
uploadStream
=
this
.
channel
.
listen
(
'
upload
'
,
from
);
const
disposable
=
uploadStream
((
result
:
UploadResponse
)
=>
{
if
(
result
===
void
0
)
{
disposable
.
dispose
();
out
.
end
(
c
);
}
else
if
(
Buffer
.
isBuffer
(
result
))
{
out
.
write
(
result
);
}
else
if
(
typeof
result
===
'
string
'
)
{
disposable
.
dispose
();
out
.
end
(()
=>
e
(
result
));
}
});
});
});
}
}
\ No newline at end of file
src/vs/platform/extensionManagement/node/multiExtensionManagement.ts
0 → 100644
浏览文件 @
84cd19b9
/*---------------------------------------------------------------------------------------------
* 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
{
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
isUIExtension
}
from
'
vs/platform/extensions/common/extensions
'
;
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
[];
constructor
(
@
IExtensionManagementServerService
private
extensionManagementServerService
:
IExtensionManagementServerService
,
@
IExtensionGalleryService
private
extensionGalleryService
:
IExtensionGalleryService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
();
this
.
servers
=
this
.
extensionManagementServerService
.
otherExtensionManagementServer
?
[
this
.
extensionManagementServerService
.
localExtensionManagementServer
,
this
.
extensionManagementServerService
.
otherExtensionManagementServer
]
:
[
this
.
extensionManagementServerService
.
localExtensionManagementServer
];
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
.
extensionManagementServerService
.
localExtensionManagementServer
.
extensionManagementService
.
install
(
vsix
)
.
then
(
extensionIdentifer
=>
this
.
extensionManagementServerService
.
localExtensionManagementServer
.
extensionManagementService
.
getInstalled
(
LocalExtensionType
.
User
)
.
then
(
installed
=>
{
const
extension
=
installed
.
filter
(
i
=>
areSameExtensions
(
i
.
identifier
,
extensionIdentifer
))[
0
];
if
(
this
.
extensionManagementServerService
.
otherExtensionManagementServer
&&
extension
&&
!
isUIExtension
(
extension
.
manifest
,
this
.
configurationService
))
{
return
this
.
extensionManagementServerService
.
otherExtensionManagementServer
.
extensionManagementService
.
install
(
vsix
)
.
then
(()
=>
extensionIdentifer
);
}
return
extensionIdentifer
;
}));
}
installFromGallery
(
gallery
:
IGalleryExtension
):
Promise
<
void
>
{
if
(
!
this
.
extensionManagementServerService
.
otherExtensionManagementServer
)
{
return
this
.
extensionManagementServerService
.
localExtensionManagementServer
.
extensionManagementService
.
installFromGallery
(
gallery
);
}
return
this
.
extensionGalleryService
.
getManifest
(
gallery
,
CancellationToken
.
None
)
.
then
(
manifest
=>
{
const
servers
=
!
isUIExtension
(
manifest
,
this
.
configurationService
)
?
this
.
servers
:
[
this
.
extensionManagementServerService
.
localExtensionManagementServer
];
return
Promise
.
all
(
servers
.
map
(
server
=>
server
.
extensionManagementService
.
installFromGallery
(
gallery
)))
.
then
(()
=>
null
);
});
}
getExtensionsReport
():
Promise
<
IReportedExtension
[]
>
{
return
this
.
extensionManagementServerService
.
localExtensionManagementServer
.
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
浏览文件 @
84cd19b9
...
@@ -96,11 +96,14 @@ import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHi
...
@@ -96,11 +96,14 @@ import { SearchHistoryService } from 'vs/workbench/services/search/node/searchHi
import
{
ExtensionManagementServerService
}
from
'
vs/workbench/services/extensions/node/extensionManagementServerService
'
;
import
{
ExtensionManagementServerService
}
from
'
vs/workbench/services/extensions/node/extensionManagementServerService
'
;
import
{
DefaultURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
DefaultURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
ExtensionGalleryService
}
from
'
vs/platform/extensionManagement/node/extensionGalleryService
'
;
import
{
ExtensionGalleryService
}
from
'
vs/platform/extensionManagement/node/extensionGalleryService
'
;
import
{
LogLevelSetterChannel
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
ILabelService
,
LabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
ILabelService
,
LabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
DownloadService
}
from
'
vs/platform/download/node/downloadService
'
;
import
{
DownloadService
}
from
'
vs/platform/download/node/downloadService
'
;
import
{
DownloadServiceChannel
}
from
'
vs/platform/download/node/downloadIpc
'
;
import
{
runWhenIdle
}
from
'
vs/base/common/async
'
;
import
{
runWhenIdle
}
from
'
vs/base/common/async
'
;
import
{
TextResourcePropertiesService
}
from
'
vs/workbench/services/textfile/electron-browser/textResourcePropertiesService
'
;
import
{
TextResourcePropertiesService
}
from
'
vs/workbench/services/textfile/electron-browser/textResourcePropertiesService
'
;
import
{
MulitExtensionManagementService
}
from
'
vs/platform/extensionManagement/node/multiExtensionManagement
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
RemoteAuthorityResolverChannelClient
,
IRemoteAuthorityResolverChannel
}
from
'
vs/platform/remote/node/remoteAuthorityResolverChannel
'
;
import
{
RemoteAuthorityResolverChannelClient
,
IRemoteAuthorityResolverChannel
}
from
'
vs/platform/remote/node/remoteAuthorityResolverChannel
'
;
...
@@ -460,10 +463,17 @@ export class WorkbenchShell extends Disposable {
...
@@ -460,10 +463,17 @@ export class WorkbenchShell extends Disposable {
const
remoteAgentService
=
new
RemoteAgentService
(
this
.
configuration
,
this
.
notificationService
,
this
.
environmentService
,
remoteAuthorityResolverService
);
const
remoteAgentService
=
new
RemoteAgentService
(
this
.
configuration
,
this
.
notificationService
,
this
.
environmentService
,
remoteAuthorityResolverService
);
serviceCollection
.
set
(
IRemoteAgentService
,
remoteAgentService
);
serviceCollection
.
set
(
IRemoteAgentService
,
remoteAgentService
);
const
remoteAgentConnection
=
remoteAgentService
.
getConnection
();
if
(
remoteAgentConnection
)
{
remoteAgentConnection
.
registerChannel
(
'
dialog
'
,
instantiationService
.
createInstance
(
DialogChannel
));
remoteAgentConnection
.
registerChannel
(
'
download
'
,
new
DownloadServiceChannel
());
remoteAgentConnection
.
registerChannel
(
'
loglevel
'
,
new
LogLevelSetterChannel
(
this
.
logService
));
}
const
extensionManagementChannel
=
getDelayedChannel
<
IExtensionManagementChannel
>
(
sharedProcess
.
then
(
c
=>
c
.
getChannel
(
'
extensions
'
)));
const
extensionManagementChannel
=
getDelayedChannel
<
IExtensionManagementChannel
>
(
sharedProcess
.
then
(
c
=>
c
.
getChannel
(
'
extensions
'
)));
const
extensionManagementChannelClient
=
new
ExtensionManagementChannelClient
(
extensionManagementChannel
,
DefaultURITransformer
);
const
extensionManagementChannelClient
=
new
ExtensionManagementChannelClient
(
extensionManagementChannel
,
DefaultURITransformer
);
serviceCollection
.
set
(
IExtensionManagementServerService
,
new
SyncDescriptor
(
ExtensionManagementServerService
,
[
extensionManagementChannelClient
]));
serviceCollection
.
set
(
IExtensionManagementServerService
,
new
SyncDescriptor
(
ExtensionManagementServerService
,
[
extensionManagementChannelClient
]));
serviceCollection
.
set
(
IExtensionManagementService
,
extensionManagementChannelClient
);
serviceCollection
.
set
(
IExtensionManagementService
,
new
SyncDescriptor
(
MulitExtensionManagementService
)
);
const
extensionEnablementService
=
this
.
_register
(
instantiationService
.
createInstance
(
ExtensionEnablementService
));
const
extensionEnablementService
=
this
.
_register
(
instantiationService
.
createInstance
(
ExtensionEnablementService
));
serviceCollection
.
set
(
IExtensionEnablementService
,
extensionEnablementService
);
serviceCollection
.
set
(
IExtensionEnablementService
,
extensionEnablementService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录