Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
783ed71a
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,发现更多精彩内容 >>
提交
783ed71a
编写于
11月 08, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweaks
上级
e99b83dd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
137 addition
and
2 deletion
+137
-2
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+10
-0
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+67
-1
src/vs/platform/remote/node/remoteAgentConnection.ts
src/vs/platform/remote/node/remoteAgentConnection.ts
+21
-0
src/vs/platform/remote/node/remoteAuthorityResolverService.ts
...vs/platform/remote/node/remoteAuthorityResolverService.ts
+37
-0
src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts
...ervices/remote/electron-browser/remoteAgentServiceImpl.ts
+2
-1
未找到文件。
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
783ed71a
...
...
@@ -43,6 +43,9 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
DownloadService
}
from
'
vs/platform/download/node/downloadService
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
RemoteAuthorityResolverService
}
from
'
vs/platform/remote/node/remoteAuthorityResolverService
'
;
import
{
IRemoteAuthorityResolverService
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
RemoteAuthorityResolverChannel
}
from
'
vs/platform/remote/node/remoteAuthorityResolverChannel
'
;
export
interface
ISharedProcessConfiguration
{
readonly
machineId
:
string
;
...
...
@@ -126,10 +129,16 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
services
.
set
(
IExtensionManagementService
,
new
SyncDescriptor
(
ExtensionManagementService
));
services
.
set
(
IExtensionGalleryService
,
new
SyncDescriptor
(
ExtensionGalleryService
));
services
.
set
(
ILocalizationsService
,
new
SyncDescriptor
(
LocalizationsService
));
services
.
set
(
IRemoteAuthorityResolverService
,
new
SyncDescriptor
(
RemoteAuthorityResolverService
));
const
instantiationService2
=
instantiationService
.
createChild
(
services
);
instantiationService2
.
invokeFunction
(
accessor
=>
{
const
remoteAuthorityResolverService
=
accessor
.
get
(
IRemoteAuthorityResolverService
);
const
remoteAuthorityResolverChannel
=
new
RemoteAuthorityResolverChannel
(
remoteAuthorityResolverService
);
server
.
registerChannel
(
'
remoteAuthorityResolver
'
,
remoteAuthorityResolverChannel
);
const
extensionManagementService
=
accessor
.
get
(
IExtensionManagementService
);
const
channel
=
new
ExtensionManagementChannel
(
extensionManagementService
);
server
.
registerChannel
(
'
extensions
'
,
channel
);
...
...
@@ -143,6 +152,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
createSharedProcessContributions
(
instantiationService2
);
disposables
.
push
(
extensionManagementService
as
ExtensionManagementService
);
disposables
.
push
(
remoteAuthorityResolverService
as
RemoteAuthorityResolverService
);
});
});
}
...
...
src/vs/code/electron-main/app.ts
浏览文件 @
783ed71a
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
app
,
ipcMain
as
ipc
,
systemPreferences
,
shell
,
Event
,
contentTracing
}
from
'
electron
'
;
import
{
app
,
ipcMain
as
ipc
,
systemPreferences
,
shell
,
Event
,
contentTracing
,
protocol
}
from
'
electron
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
WindowsManager
}
from
'
vs/code/electron-main/windows
'
;
import
{
IWindowsService
,
OpenContext
,
ActiveWindowManager
}
from
'
vs/platform/windows/common/windows
'
;
...
...
@@ -57,6 +57,7 @@ import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
ElectronURLListener
}
from
'
vs/platform/url/electron-main/electronUrlListener
'
;
import
{
serve
as
serveDriver
}
from
'
vs/platform/driver/electron-main/driver
'
;
import
{
connectRemoteAgentManagement
}
from
'
vs/platform/remote/node/remoteAgentConnection
'
;
import
{
IMenubarService
}
from
'
vs/platform/menubar/common/menubar
'
;
import
{
MenubarService
}
from
'
vs/platform/menubar/electron-main/menubarService
'
;
import
{
MenubarChannel
}
from
'
vs/platform/menubar/node/menubarIpc
'
;
...
...
@@ -68,6 +69,10 @@ import { THEME_STORAGE_KEY, THEME_BG_STORAGE_KEY } from 'vs/code/electron-main/t
import
{
nativeSep
,
join
}
from
'
vs/base/common/paths
'
;
import
{
homedir
}
from
'
os
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
REMOTE_HOST_SCHEME
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
IRemoteAuthorityResolverChannel
,
RemoteAuthorityResolverChannelClient
}
from
'
vs/platform/remote/node/remoteAuthorityResolverChannel
'
;
import
{
IRemoteAgentFileSystemChannel
,
REMOTE_FILE_SYSTEM_CHANNEL_NAME
}
from
'
vs/platform/remote/node/remoteAgentFileSystemChannel
'
;
import
{
ResolvedAuthority
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
SnapUpdateService
}
from
'
vs/platform/update/electron-main/updateService.snap
'
;
export
class
CodeApplication
{
...
...
@@ -165,6 +170,67 @@ export class CodeApplication {
});
});
const
connectionPool
:
Map
<
string
,
ActiveConnection
>
=
new
Map
<
string
,
ActiveConnection
>
();
class
ActiveConnection
{
private
_authority
:
string
;
private
_client
:
TPromise
<
Client
>
;
private
_disposeRunner
:
RunOnceScheduler
;
constructor
(
authority
:
string
,
connectionInfo
:
TPromise
<
ResolvedAuthority
>
)
{
this
.
_authority
=
authority
;
this
.
_client
=
connectionInfo
.
then
(({
host
,
port
})
=>
{
return
connectRemoteAgentManagement
(
host
,
port
,
`main`
);
});
this
.
_disposeRunner
=
new
RunOnceScheduler
(()
=>
this
.
_dispose
(),
5000
);
}
private
_dispose
():
void
{
this
.
_disposeRunner
.
dispose
();
connectionPool
.
delete
(
this
.
_authority
);
this
.
_client
.
then
((
connection
)
=>
{
connection
.
dispose
();
});
}
public
getClient
():
TPromise
<
Client
>
{
this
.
_disposeRunner
.
schedule
();
return
this
.
_client
;
}
}
protocol
.
registerBufferProtocol
(
REMOTE_HOST_SCHEME
,
async
(
request
,
callback
)
=>
{
if
(
request
.
method
!==
'
GET
'
)
{
return
callback
(
null
);
}
const
uri
=
URI
.
parse
(
request
.
url
);
let
activeConnection
:
ActiveConnection
=
null
;
if
(
connectionPool
.
has
(
uri
.
authority
))
{
activeConnection
=
connectionPool
.
get
(
uri
.
authority
);
}
else
{
if
(
this
.
sharedProcessClient
)
{
const
remoteAuthorityResolverChannel
=
getDelayedChannel
<
IRemoteAuthorityResolverChannel
>
(
this
.
sharedProcessClient
.
then
(
c
=>
c
.
getChannel
(
'
remoteAuthorityResolver
'
)));
const
remoteAuthorityResolverChannelClient
=
new
RemoteAuthorityResolverChannelClient
(
remoteAuthorityResolverChannel
);
activeConnection
=
new
ActiveConnection
(
uri
.
authority
,
remoteAuthorityResolverChannelClient
.
resolveAuthority
(
uri
.
authority
));
connectionPool
.
set
(
uri
.
authority
,
activeConnection
);
}
}
try
{
const
rawClient
=
await
activeConnection
.
getClient
();
if
(
connectionPool
.
has
(
uri
.
authority
))
{
// not disposed in the meantime
const
channel
=
rawClient
.
getChannel
<
IRemoteAgentFileSystemChannel
>
(
REMOTE_FILE_SYSTEM_CHANNEL_NAME
);
const
fileContents
=
await
channel
.
call
(
'
readFile
'
,
[
uri
.
authority
,
uri
]);
callback
(
Buffer
.
from
(
fileContents
));
}
else
{
callback
(
null
);
}
}
catch
(
err
)
{
errors
.
onUnexpectedError
(
err
);
callback
(
null
);
}
});
let
macOpenFileURIs
:
URI
[]
=
[];
let
runningTimeout
:
any
=
null
;
app
.
on
(
'
open-file
'
,
(
event
:
Event
,
path
:
string
)
=>
{
...
...
src/vs/platform/remote/node/remoteAgentConnection.ts
0 → 100644
浏览文件 @
783ed71a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Client
,
Protocol
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
IExtensionHostDebugParams
}
from
'
vs/platform/environment/common/environment
'
;
export
function
connectRemoteAgentManagement
(
host
:
string
,
port
:
number
,
clientId
:
string
):
TPromise
<
Client
>
{
throw
new
Error
(
`Not implemented`
);
}
export
interface
IExtensionHostConnectionResult
{
protocol
:
Protocol
;
debugPort
?:
number
;
}
export
function
connectRemoteAgentExtensionHost
(
host
:
string
,
port
:
number
,
debugArguments
:
IExtensionHostDebugParams
):
TPromise
<
IExtensionHostConnectionResult
>
{
throw
new
Error
(
`Not implemented`
);
}
src/vs/platform/remote/node/remoteAuthorityResolverService.ts
0 → 100644
浏览文件 @
783ed71a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IRemoteAuthorityResolverService
,
ResolvedAuthority
,
IResolvingProgressEvent
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IExtensionManagementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
export
class
RemoteAuthorityResolverService
extends
Disposable
implements
IRemoteAuthorityResolverService
{
_serviceBrand
:
any
;
private
_onResolvingProgress
:
Emitter
<
IResolvingProgressEvent
>
=
this
.
_register
(
new
Emitter
<
IResolvingProgressEvent
>
());
readonly
onResolvingProgress
:
Event
<
IResolvingProgressEvent
>
=
this
.
_onResolvingProgress
.
event
;
constructor
(
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ILogService
logService
:
ILogService
,
@
IExtensionManagementService
extensionManagementService
:
IExtensionManagementService
)
{
super
();
}
async
resolveAuthority
(
authority
:
string
):
Promise
<
ResolvedAuthority
>
{
throw
new
Error
(
`Not implemented`
);
}
async
getLabel
(
authority
:
string
):
Promise
<
string
|
null
>
{
throw
new
Error
(
`Not implemented`
);
}
}
src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts
浏览文件 @
783ed71a
...
...
@@ -10,6 +10,7 @@ import { IChannel, getDelayedChannel } from 'vs/base/parts/ipc/node/ipc';
import
{
Client
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
connectRemoteAgentManagement
}
from
'
vs/platform/remote/node/remoteAgentConnection
'
;
import
{
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
RemoteExtensionEnvironmentChannelClient
}
from
'
vs/workbench/services/remote/node/remoteAgentEnvironmentChannel
'
;
import
{
IRemoteAgentConnection
,
IRemoteAgentEnvironment
,
IRemoteAgentService
}
from
'
vs/workbench/services/remote/node/remoteAgentService
'
;
...
...
@@ -77,7 +78,7 @@ class RemoteAgentConnection extends Disposable implements IRemoteAgentConnection
private
_getOrCreateConnection
():
TPromise
<
Client
>
{
if
(
!
this
.
_connection
)
{
this
.
_connection
=
this
.
_remoteAuthorityResolverService
.
resolveAuthority
(
this
.
remoteAuthority
).
then
((
resolvedAuthority
)
=>
{
throw
new
Error
(
`Not implemented
`
);
return
connectRemoteAgentManagement
(
resolvedAuthority
.
host
,
resolvedAuthority
.
port
,
`renderer
`
);
});
}
return
this
.
_connection
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录