Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b01183bd
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 搜索 >>
提交
b01183bd
编写于
11月 26, 2020
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add extension source to forwarded ports
Part of microsoft/vscode-remote-release#4021
上级
2f8f00d6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
35 addition
and
17 deletion
+35
-17
src/vs/workbench/api/browser/mainThreadTunnelService.ts
src/vs/workbench/api/browser/mainThreadTunnelService.ts
+2
-2
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostTunnelService.ts
src/vs/workbench/api/common/extHostTunnelService.ts
+3
-2
src/vs/workbench/api/node/extHostTunnelService.ts
src/vs/workbench/api/node/extHostTunnelService.ts
+3
-2
src/vs/workbench/contrib/remote/browser/tunnelView.ts
src/vs/workbench/contrib/remote/browser/tunnelView.ts
+18
-4
src/vs/workbench/services/remote/common/remoteExplorerService.ts
...workbench/services/remote/common/remoteExplorerService.ts
+7
-5
未找到文件。
src/vs/workbench/api/browser/mainThreadTunnelService.ts
浏览文件 @
b01183bd
...
...
@@ -26,8 +26,8 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
this
.
_register
(
tunnelService
.
onTunnelClosed
(()
=>
this
.
_proxy
.
$onDidTunnelsChange
()));
}
async
$openTunnel
(
tunnelOptions
:
TunnelOptions
):
Promise
<
TunnelDto
|
undefined
>
{
const
tunnel
=
await
this
.
remoteExplorerService
.
forward
(
tunnelOptions
.
remoteAddress
,
tunnelOptions
.
localAddressPort
,
tunnelOptions
.
label
);
async
$openTunnel
(
tunnelOptions
:
TunnelOptions
,
source
:
string
):
Promise
<
TunnelDto
|
undefined
>
{
const
tunnel
=
await
this
.
remoteExplorerService
.
forward
(
tunnelOptions
.
remoteAddress
,
tunnelOptions
.
localAddressPort
,
tunnelOptions
.
label
,
source
);
if
(
tunnel
)
{
return
TunnelDto
.
fromServiceTunnel
(
tunnel
);
}
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
b01183bd
...
...
@@ -859,7 +859,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
openTunnel
:
(
forward
:
vscode
.
TunnelOptions
)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostTunnelService
.
openTunnel
(
forward
).
then
(
value
=>
{
return
extHostTunnelService
.
openTunnel
(
extension
,
forward
).
then
(
value
=>
{
if
(
!
value
)
{
throw
new
Error
(
'
cannot open tunnel
'
);
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
b01183bd
...
...
@@ -955,7 +955,7 @@ export interface MainThreadWindowShape extends IDisposable {
}
export
interface
MainThreadTunnelServiceShape
extends
IDisposable
{
$openTunnel
(
tunnelOptions
:
TunnelOptions
):
Promise
<
TunnelDto
|
undefined
>
;
$openTunnel
(
tunnelOptions
:
TunnelOptions
,
source
:
string
|
undefined
):
Promise
<
TunnelDto
|
undefined
>
;
$closeTunnel
(
remote
:
{
host
:
string
,
port
:
number
}):
Promise
<
void
>
;
$getTunnels
():
Promise
<
TunnelDescription
[]
>
;
$setTunnelProvider
():
Promise
<
void
>
;
...
...
src/vs/workbench/api/common/extHostTunnelService.ts
浏览文件 @
b01183bd
...
...
@@ -10,6 +10,7 @@ import { RemoteTunnel, TunnelCreationOptions, TunnelOptions } from 'vs/platform/
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
'
;
export
interface
TunnelDto
{
remoteAddress
:
{
port
:
number
,
host
:
string
};
...
...
@@ -32,7 +33,7 @@ export interface Tunnel extends vscode.Disposable {
export
interface
IExtHostTunnelService
extends
ExtHostTunnelServiceShape
{
readonly
_serviceBrand
:
undefined
;
openTunnel
(
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
;
openTunnel
(
extension
:
IExtensionDescription
,
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
;
getTunnels
():
Promise
<
vscode
.
TunnelDescription
[]
>
;
onDidChangeTunnels
:
vscode
.
Event
<
void
>
;
setTunnelExtensionFunctions
(
provider
:
vscode
.
RemoteAuthorityResolver
|
undefined
):
Promise
<
IDisposable
>
;
...
...
@@ -51,7 +52,7 @@ export class ExtHostTunnelService implements IExtHostTunnelService {
this
.
_proxy
=
extHostRpc
.
getProxy
(
MainContext
.
MainThreadTunnelService
);
}
async
openTunnel
(
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
async
openTunnel
(
extension
:
IExtensionDescription
,
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
return
undefined
;
}
async
getTunnels
():
Promise
<
vscode
.
TunnelDescription
[]
>
{
...
...
src/vs/workbench/api/node/extHostTunnelService.ts
浏览文件 @
b01183bd
...
...
@@ -17,6 +17,7 @@ import { IExtHostTunnelService, TunnelDto } from 'vs/workbench/api/common/extHos
import
{
asPromise
}
from
'
vs/base/common/async
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
TunnelOptions
,
TunnelCreationOptions
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
class
ExtensionTunnel
implements
vscode
.
Tunnel
{
private
_onDispose
:
Emitter
<
void
>
=
new
Emitter
();
...
...
@@ -53,8 +54,8 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
}
}
async
openTunnel
(
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
const
tunnel
=
await
this
.
_proxy
.
$openTunnel
(
forward
);
async
openTunnel
(
extension
:
IExtensionDescription
,
forward
:
TunnelOptions
):
Promise
<
vscode
.
Tunnel
|
undefined
>
{
const
tunnel
=
await
this
.
_proxy
.
$openTunnel
(
forward
,
extension
.
displayName
);
if
(
tunnel
)
{
const
disposableTunnel
:
vscode
.
Tunnel
=
new
ExtensionTunnel
(
tunnel
.
remoteAddress
,
tunnel
.
localAddress
,
()
=>
{
return
this
.
_proxy
.
$closeTunnel
(
tunnel
.
remoteAddress
);
...
...
src/vs/workbench/contrib/remote/browser/tunnelView.ts
浏览文件 @
b01183bd
...
...
@@ -384,7 +384,7 @@ interface ITunnelGroup {
class
TunnelItem
implements
ITunnelItem
{
static
createFromTunnel
(
tunnel
:
Tunnel
,
type
:
TunnelType
=
TunnelType
.
Forwarded
,
closeable
?:
boolean
)
{
return
new
TunnelItem
(
type
,
tunnel
.
remoteHost
,
tunnel
.
remotePort
,
tunnel
.
localAddress
,
tunnel
.
localPort
,
closeable
===
undefined
?
tunnel
.
closeable
:
closeable
,
tunnel
.
name
,
tunnel
.
description
??
tunnel
.
runningProcess
);
return
new
TunnelItem
(
type
,
tunnel
.
remoteHost
,
tunnel
.
remotePort
,
tunnel
.
localAddress
,
tunnel
.
localPort
,
closeable
===
undefined
?
tunnel
.
closeable
:
closeable
,
tunnel
.
name
,
tunnel
.
description
??
tunnel
.
runningProcess
,
tunnel
.
source
);
}
constructor
(
...
...
@@ -396,6 +396,7 @@ class TunnelItem implements ITunnelItem {
public
closeable
?:
boolean
,
public
name
?:
string
,
private
_description
?:
string
,
private
source
?:
string
)
{
}
get
label
():
string
{
if
(
this
.
name
)
{
...
...
@@ -435,11 +436,24 @@ class TunnelItem implements ITunnelItem {
}
get
description
():
string
|
undefined
{
const
description
:
string
[]
=
[];
if
(
this
.
name
&&
this
.
localAddress
)
{
description
.
push
(
nls
.
localize
(
'
remote.tunnelsView.forwardedPortDescription0
'
,
"
{0}
\
u2192 {1}
"
,
this
.
remotePort
,
TunnelItem
.
compactLongAddress
(
this
.
localAddress
)));
}
if
(
this
.
_description
)
{
return
this
.
_description
;
}
else
if
(
this
.
name
&&
this
.
localAddress
)
{
return
nls
.
localize
(
'
remote.tunnelsView.forwardedPortDescription0
'
,
"
{0}
\
u2192 {1}
"
,
this
.
remotePort
,
TunnelItem
.
compactLongAddress
(
this
.
localAddress
));
description
.
push
(
this
.
_description
);
}
if
(
this
.
source
)
{
description
.
push
(
this
.
source
);
}
if
(
description
.
length
>
0
)
{
return
description
.
join
(
'
\
u2022
'
);
}
return
undefined
;
}
}
...
...
src/vs/workbench/services/remote/common/remoteExplorerService.ts
浏览文件 @
b01183bd
...
...
@@ -48,6 +48,7 @@ export interface Tunnel {
description
?:
string
;
closeable
?:
boolean
;
runningProcess
:
string
|
undefined
;
source
?:
string
;
}
export
function
makeAddress
(
host
:
string
,
port
:
number
):
string
{
...
...
@@ -177,7 +178,7 @@ export class TunnelModel extends Disposable {
}
}
async
forward
(
remote
:
{
host
:
string
,
port
:
number
},
local
?:
number
,
name
?:
string
):
Promise
<
RemoteTunnel
|
void
>
{
async
forward
(
remote
:
{
host
:
string
,
port
:
number
},
local
?:
number
,
name
?:
string
,
source
?:
string
):
Promise
<
RemoteTunnel
|
void
>
{
const
existingTunnel
=
mapHasAddressLocalhostOrAllInterfaces
(
this
.
forwarded
,
remote
.
host
,
remote
.
port
);
if
(
!
existingTunnel
)
{
const
authority
=
this
.
environmentService
.
remoteAuthority
;
...
...
@@ -194,7 +195,8 @@ export class TunnelModel extends Disposable {
name
:
name
,
closeable
:
true
,
localAddress
:
tunnel
.
localAddress
,
runningProcess
:
mapHasAddressLocalhostOrAllInterfaces
(
this
.
_candidates
,
remote
.
host
,
remote
.
port
)?.
detail
runningProcess
:
mapHasAddressLocalhostOrAllInterfaces
(
this
.
_candidates
,
remote
.
host
,
remote
.
port
)?.
detail
,
source
};
const
key
=
makeAddress
(
remote
.
host
,
remote
.
port
);
this
.
forwarded
.
set
(
key
,
newForward
);
...
...
@@ -313,7 +315,7 @@ export interface IRemoteExplorerService {
onDidChangeEditable
:
Event
<
ITunnelItem
|
undefined
>
;
setEditable
(
tunnelItem
:
ITunnelItem
|
undefined
,
data
:
IEditableData
|
null
):
void
;
getEditableData
(
tunnelItem
:
ITunnelItem
|
undefined
):
IEditableData
|
undefined
;
forward
(
remote
:
{
host
:
string
,
port
:
number
},
localPort
?:
number
,
name
?:
string
):
Promise
<
RemoteTunnel
|
void
>
;
forward
(
remote
:
{
host
:
string
,
port
:
number
},
localPort
?:
number
,
name
?:
string
,
source
?:
string
):
Promise
<
RemoteTunnel
|
void
>
;
close
(
remote
:
{
host
:
string
,
port
:
number
}):
Promise
<
void
>
;
setTunnelInformation
(
tunnelInformation
:
TunnelInformation
|
undefined
):
void
;
setCandidateFilter
(
filter
:
((
candidates
:
{
host
:
string
,
port
:
number
,
detail
:
string
}[])
=>
Promise
<
{
host
:
string
,
port
:
number
,
detail
:
string
}[]
>
)
|
undefined
):
IDisposable
;
...
...
@@ -360,8 +362,8 @@ class RemoteExplorerService implements IRemoteExplorerService {
return
this
.
_tunnelModel
;
}
forward
(
remote
:
{
host
:
string
,
port
:
number
},
local
?:
number
,
name
?:
string
):
Promise
<
RemoteTunnel
|
void
>
{
return
this
.
tunnelModel
.
forward
(
remote
,
local
,
name
);
forward
(
remote
:
{
host
:
string
,
port
:
number
},
local
?:
number
,
name
?:
string
,
source
?:
string
):
Promise
<
RemoteTunnel
|
void
>
{
return
this
.
tunnelModel
.
forward
(
remote
,
local
,
name
,
source
);
}
close
(
remote
:
{
host
:
string
,
port
:
number
}):
Promise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录