Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f68c9b04
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f68c9b04
编写于
12月 13, 2019
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a 'Forward a Port' command to the command palette
上级
cfed333e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
7 deletion
+19
-7
src/vs/workbench/contrib/remote/browser/remote.ts
src/vs/workbench/contrib/remote/browser/remote.ts
+4
-4
src/vs/workbench/contrib/remote/browser/tunnelView.ts
src/vs/workbench/contrib/remote/browser/tunnelView.ts
+15
-3
未找到文件。
src/vs/workbench/contrib/remote/browser/remote.ts
浏览文件 @
f68c9b04
...
...
@@ -17,7 +17,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
FilterViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
VIEWLET_ID
,
VIEW_CONTAINER
}
from
'
vs/workbench/contrib/remote/common/remote.contribution
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IViewDescriptor
,
IViewsRegistry
,
Extensions
}
from
'
vs/workbench/common/views
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
...
...
@@ -288,10 +288,11 @@ export class RemoteViewlet extends Viewlet {
}
}
export
const
forwardedPortsViewEnabled
=
new
RawContextKey
<
boolean
>
(
'
forwardedPortsViewEnabled
'
,
false
);
export
class
RemoteViewPaneContainer
extends
FilterViewPaneContainer
{
private
actions
:
IAction
[]
|
undefined
;
private
tunnelPanelDescriptor
:
TunnelPanelDescriptor
|
undefined
;
private
static
contextKeyName
:
string
=
'
forwardedPortsViewEnabled
'
;
constructor
(
@
IWorkbenchLayoutService
layoutService
:
IWorkbenchLayoutService
,
...
...
@@ -308,7 +309,6 @@ export class RemoteViewPaneContainer extends FilterViewPaneContainer {
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
)
{
super
(
VIEWLET_ID
,
remoteExplorerService
.
onDidChangeTargetType
,
configurationService
,
layoutService
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextMenuService
,
extensionService
,
contextService
);
this
.
contextKeyService
.
createKey
(
RemoteViewPaneContainer
.
contextKeyName
,
false
);
}
protected
getFilterOn
(
viewDescriptor
:
IViewDescriptor
):
string
|
undefined
{
...
...
@@ -345,7 +345,7 @@ export class RemoteViewPaneContainer extends FilterViewPaneContainer {
// Call to super MUST be first, since registering the additional view will cause this to be called again.
const
panels
:
ViewPane
[]
=
super
.
onDidAddViews
(
added
);
// This context key is set to false in the constructor, but is expected to be changed by resolver extensions to enable the forwarded ports view.
const
viewEnabled
:
boolean
=
!!
this
.
contextKeyService
.
getContextKeyValue
<
boolean
>
(
RemoteViewPaneContainer
.
contextKeyNam
e
);
const
viewEnabled
:
boolean
=
!!
forwardedPortsViewEnabled
.
getValue
(
this
.
contextKeyServic
e
);
if
(
this
.
environmentService
.
configuration
.
remoteAuthority
&&
!
this
.
tunnelPanelDescriptor
&&
viewEnabled
)
{
this
.
tunnelPanelDescriptor
=
new
TunnelPanelDescriptor
(
new
TunnelViewModel
(
this
.
remoteExplorerService
),
this
.
environmentService
);
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
);
...
...
src/vs/workbench/contrib/remote/browser/tunnelView.ts
浏览文件 @
f68c9b04
...
...
@@ -6,7 +6,7 @@
import
'
vs/css!./media/tunnelView
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
IViewDescriptor
,
IEditableData
}
from
'
vs/workbench/common/views
'
;
import
{
IViewDescriptor
,
IEditableData
,
IViewsService
}
from
'
vs/workbench/common/views
'
;
import
{
WorkbenchAsyncDataTree
,
TreeResourceNavigator2
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextMenuService
,
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
...
...
@@ -37,6 +37,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
ViewPane
,
IViewPaneOptions
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
forwardedPortsViewEnabled
}
from
'
vs/workbench/contrib/remote/browser/remote
'
;
class
TunnelTreeVirtualDelegate
implements
IListVirtualDelegate
<
ITunnelItem
>
{
getHeight
(
element
:
ITunnelItem
):
number
{
...
...
@@ -95,7 +96,7 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel {
});
}
groups
.
push
({
label
:
nls
.
localize
(
'
remote.tunnelsView.add
'
,
"
Forward Port...
"
),
label
:
nls
.
localize
(
'
remote.tunnelsView.add
'
,
"
Forward
a
Port...
"
),
tunnelType
:
TunnelType
.
Add
,
});
return
groups
;
...
...
@@ -592,7 +593,7 @@ namespace LabelTunnelAction {
namespace
ForwardPortAction
{
export
const
ID
=
'
remote.tunnel.forward
'
;
export
const
LABEL
=
nls
.
localize
(
'
remote.tunnel.forward
'
,
"
Forward Port
"
);
export
const
LABEL
=
nls
.
localize
(
'
remote.tunnel.forward
'
,
"
Forward
a
Port
"
);
export
function
handler
():
ICommandHandler
{
return
async
(
accessor
,
arg
)
=>
{
...
...
@@ -600,6 +601,8 @@ namespace ForwardPortAction {
if
(
arg
instanceof
TunnelItem
)
{
remoteExplorerService
.
tunnelModel
.
forward
(
arg
.
remote
);
}
else
{
const
viewsService
=
accessor
.
get
(
IViewsService
);
viewsService
.
openView
(
TunnelPanel
.
ID
,
true
);
remoteExplorerService
.
setEditable
(
undefined
,
{
onFinish
:
(
value
,
success
)
=>
{
if
(
success
)
{
...
...
@@ -679,6 +682,15 @@ CommandsRegistry.registerCommand(ClosePortAction.ID, ClosePortAction.handler());
CommandsRegistry
.
registerCommand
(
OpenPortInBrowserAction
.
ID
,
OpenPortInBrowserAction
.
handler
());
CommandsRegistry
.
registerCommand
(
CopyAddressAction
.
ID
,
CopyAddressAction
.
handler
());
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
({
command
:
{
id
:
ForwardPortAction
.
ID
,
title
:
ForwardPortAction
.
LABEL
},
when
:
forwardedPortsViewEnabled
}));
MenuRegistry
.
appendMenuItem
(
MenuId
.
TunnelTitle
,
({
group
:
'
navigation
'
,
order
:
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录