Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b903748b
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
b903748b
编写于
1月 13, 2021
作者:
A
Alex Ross
提交者:
GitHub
1月 13, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix candidate filter and auto forwarding wiring (#114290)
上级
d66db5cc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
6 deletion
+29
-6
src/vs/workbench/api/browser/mainThreadTunnelService.ts
src/vs/workbench/api/browser/mainThreadTunnelService.ts
+11
-1
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+4
-0
src/vs/workbench/api/common/extHostTunnelService.ts
src/vs/workbench/api/common/extHostTunnelService.ts
+4
-0
src/vs/workbench/api/node/extHostTunnelService.ts
src/vs/workbench/api/node/extHostTunnelService.ts
+10
-5
未找到文件。
src/vs/workbench/api/browser/mainThreadTunnelService.ts
浏览文件 @
b903748b
...
...
@@ -24,7 +24,10 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostTunnelService
);
this
.
_register
(
tunnelService
.
onTunnelOpened
(()
=>
this
.
_proxy
.
$onDidTunnelsChange
()));
this
.
_register
(
tunnelService
.
onTunnelClosed
(()
=>
this
.
_proxy
.
$onDidTunnelsChange
()));
this
.
_register
(
remoteExplorerService
.
onEnabledPortsFeatures
(()
=>
this
.
_proxy
.
$registerCandidateFinder
()));
}
async
$setCandidateFinder
():
Promise
<
void
>
{
this
.
_register
(
this
.
remoteExplorerService
.
onEnabledPortsFeatures
(()
=>
this
.
_proxy
.
$registerCandidateFinder
()));
}
async
$openTunnel
(
tunnelOptions
:
TunnelOptions
,
source
:
string
):
Promise
<
TunnelDto
|
undefined
>
{
...
...
@@ -79,6 +82,13 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
this
.
tunnelService
.
setTunnelProvider
(
tunnelProvider
,
features
);
}
async
$setCandidateFilter
():
Promise
<
void
>
{
this
.
remoteExplorerService
.
setCandidateFilter
((
candidates
:
CandidatePort
[]):
Promise
<
CandidatePort
[]
>
=>
{
return
this
.
_proxy
.
$applyCandidateFilter
(
candidates
);
});
}
dispose
():
void
{
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
b903748b
...
...
@@ -59,6 +59,7 @@ import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/api/common/e
import
{
IAccessibilityInformation
}
from
'
vs/platform/accessibility/common/accessibility
'
;
import
{
IExtensionIdWithVersion
}
from
'
vs/platform/userDataSync/common/extensionsStorageSync
'
;
import
{
InternalTestItem
,
RunTestForProviderRequest
,
RunTestsRequest
,
RunTestsResult
,
TestIdWithProvider
,
TestsDiff
}
from
'
vs/workbench/contrib/testing/common/testCollection
'
;
import
{
CandidatePort
}
from
'
vs/workbench/services/remote/common/remoteExplorerService
'
;
export
interface
IEnvironment
{
isExtensionDevelopmentDebug
:
boolean
;
...
...
@@ -984,6 +985,8 @@ export interface MainThreadTunnelServiceShape extends IDisposable {
$closeTunnel
(
remote
:
{
host
:
string
,
port
:
number
}):
Promise
<
void
>
;
$getTunnels
():
Promise
<
TunnelDescription
[]
>
;
$setTunnelProvider
(
features
:
TunnelProviderFeatures
):
Promise
<
void
>
;
$setCandidateFinder
():
Promise
<
void
>
;
$setCandidateFilter
():
Promise
<
void
>
;
$onFoundNewCandidates
(
candidates
:
{
host
:
string
,
port
:
number
,
detail
:
string
}[]):
Promise
<
void
>
;
}
...
...
@@ -1785,6 +1788,7 @@ export interface ExtHostTunnelServiceShape {
$closeTunnel
(
remote
:
{
host
:
string
,
port
:
number
},
silent
?:
boolean
):
Promise
<
void
>
;
$onDidTunnelsChange
():
Promise
<
void
>
;
$registerCandidateFinder
():
Promise
<
void
>
;
$applyCandidateFilter
(
candidates
:
CandidatePort
[]):
Promise
<
CandidatePort
[]
>
;
}
export
interface
ExtHostTimelineShape
{
...
...
src/vs/workbench/api/common/extHostTunnelService.ts
浏览文件 @
b903748b
...
...
@@ -11,6 +11,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
CandidatePort
}
from
'
vs/workbench/services/remote/common/remoteExplorerService
'
;
export
interface
TunnelDto
{
remoteAddress
:
{
port
:
number
,
host
:
string
};
...
...
@@ -57,6 +58,9 @@ export class ExtHostTunnelService implements IExtHostTunnelService {
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
)
{
}
async
$applyCandidateFilter
(
candidates
:
CandidatePort
[]):
Promise
<
CandidatePort
[]
>
{
return
candidates
;
}
async
openTunnel
(
extension
:
IExtensionDescription
,
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
return
undefined
;
...
...
src/vs/workbench/api/node/extHostTunnelService.ts
浏览文件 @
b903748b
...
...
@@ -141,10 +141,13 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
constructor
(
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
@
IExtHostInitDataService
private
initData
:
IExtHostInitDataService
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
)
{
super
();
this
.
_proxy
=
extHostRpc
.
getProxy
(
MainContext
.
MainThreadTunnelService
);
if
(
isLinux
&&
initData
.
remote
.
isRemote
&&
initData
.
remote
.
authority
)
{
this
.
_proxy
.
$setCandidateFinder
();
}
}
async
openTunnel
(
extension
:
IExtensionDescription
,
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
...
...
@@ -169,9 +172,6 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
}
async
$registerCandidateFinder
():
Promise
<
void
>
{
if
(
!
isLinux
||
!
this
.
initData
.
remote
.
isRemote
||
!
this
.
initData
.
remote
.
authority
)
{
return
;
}
// Regularly scan to see if the candidate ports have changed.
let
movingAverage
=
new
MovingAverage
();
let
oldPorts
:
{
host
:
string
,
port
:
number
,
detail
:
string
}[]
|
undefined
=
undefined
;
...
...
@@ -182,7 +182,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
movingAverage
.
update
(
timeTaken
);
if
(
!
oldPorts
||
(
JSON
.
stringify
(
oldPorts
)
!==
JSON
.
stringify
(
newPorts
)))
{
oldPorts
=
newPorts
;
await
this
.
_proxy
.
$onFoundNewCandidates
(
oldPorts
.
filter
(
async
(
candidate
)
=>
await
this
.
_showCandidatePort
(
candidate
.
host
,
candidate
.
port
,
candidate
.
detail
))
);
await
this
.
_proxy
.
$onFoundNewCandidates
(
oldPorts
);
}
await
(
new
Promise
<
void
>
(
resolve
=>
setTimeout
(()
=>
resolve
(),
this
.
calculateDelay
(
movingAverage
.
value
))));
}
...
...
@@ -192,6 +192,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
if
(
provider
)
{
if
(
provider
.
showCandidatePort
)
{
this
.
_showCandidatePort
=
provider
.
showCandidatePort
;
await
this
.
_proxy
.
$setCandidateFilter
();
}
if
(
provider
.
tunnelFactory
)
{
this
.
_forwardPortProvider
=
provider
.
tunnelFactory
;
...
...
@@ -242,6 +243,10 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
return
undefined
;
}
async
$applyCandidateFilter
(
candidates
:
CandidatePort
[]):
Promise
<
CandidatePort
[]
>
{
return
Promise
.
all
(
candidates
.
filter
(
candidate
=>
this
.
_showCandidatePort
(
candidate
.
host
,
candidate
.
port
,
candidate
.
detail
)));
}
async
findCandidatePorts
():
Promise
<
CandidatePort
[]
>
{
let
tcp
:
string
=
''
;
let
tcp6
:
string
=
''
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录