Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3305ae77
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,发现更多精彩内容 >>
提交
3305ae77
编写于
10月 26, 2020
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Find Urls in debug output for forwarding
Fixes microsoft/vscode-remote-release#3836
上级
69bfc5af
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
46 addition
and
5 deletion
+46
-5
src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
+4
-2
src/vs/workbench/contrib/remote/browser/urlFinder.ts
src/vs/workbench/contrib/remote/browser/urlFinder.ts
+42
-3
未找到文件。
src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
浏览文件 @
3305ae77
...
...
@@ -18,6 +18,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
INotificationService
,
IPromptChoice
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
ITerminalService
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
IDebugService
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
export
const
VIEWLET_ID
=
'
workbench.view.remote
'
;
...
...
@@ -128,7 +129,8 @@ export class AutomaticPortForwarding extends Disposable implements IWorkbenchCon
@
IRemoteExplorerService
private
readonly
remoteExplorerService
:
IRemoteExplorerService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IDebugService
private
readonly
debugService
:
IDebugService
)
{
super
();
this
.
_register
(
configurationService
.
onDidChangeConfiguration
((
e
)
=>
{
...
...
@@ -162,7 +164,7 @@ export class AutomaticPortForwarding extends Disposable implements IWorkbenchCon
if
(
this
.
contextServiceListener
)
{
this
.
contextServiceListener
.
dispose
();
}
this
.
urlFinder
=
this
.
_register
(
new
UrlFinder
(
this
.
terminalService
));
this
.
urlFinder
=
this
.
_register
(
new
UrlFinder
(
this
.
terminalService
,
this
.
debugService
));
this
.
_register
(
this
.
urlFinder
.
onDidMatchLocalUrl
(
async
(
localUrl
)
=>
{
if
(
mapHasTunnelLocalhostOrAllInterfaces
(
this
.
remoteExplorerService
.
tunnelModel
.
forwarded
,
localUrl
.
host
,
localUrl
.
port
))
{
return
;
...
...
src/vs/workbench/contrib/remote/browser/urlFinder.ts
浏览文件 @
3305ae77
...
...
@@ -6,6 +6,7 @@
import
{
ITerminalInstance
,
ITerminalService
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDebugService
,
IDebugSession
,
IReplElement
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
export
class
UrlFinder
extends
Disposable
{
private
static
readonly
terminalCodesRegex
=
/
(?:\u
001B|
\u
009B
)[\[\]
()#;?
]
*
(?:(?:(?:[
a-zA-Z0-9
]
*
(?:
;
[
a-zA-Z0-9
]
*
)
*
)?\u
0007
)
|
(?:(?:\d{1,4}(?:
;
\d{0,4})
*
)?[
0-9A-PR-TZcf-ntqry=><~
]))
/g
;
...
...
@@ -20,10 +21,11 @@ export class UrlFinder extends Disposable {
private
_onDidMatchLocalUrl
:
Emitter
<
{
host
:
string
,
port
:
number
}
>
=
new
Emitter
();
public
readonly
onDidMatchLocalUrl
=
this
.
_onDidMatchLocalUrl
.
event
;
private
listeners
:
Map
<
ITerminalInstance
,
IDisposable
>
=
new
Map
();
private
listeners
:
Map
<
ITerminalInstance
|
string
,
IDisposable
>
=
new
Map
();
constructor
(
terminalService
:
ITerminalService
)
{
constructor
(
terminalService
:
ITerminalService
,
debugService
:
IDebugService
)
{
super
();
// Terminal
terminalService
.
terminalInstances
.
forEach
(
instance
=>
{
this
.
listeners
.
set
(
instance
,
instance
.
onData
(
data
=>
{
this
.
processData
(
data
);
...
...
@@ -35,8 +37,45 @@ export class UrlFinder extends Disposable {
}));
}));
this
.
_register
(
terminalService
.
onInstanceDisposed
(
instance
=>
{
this
.
listeners
.
get
(
instance
)?.
dispose
();
this
.
listeners
.
delete
(
instance
);
}));
// Debug
this
.
_register
(
debugService
.
onDidNewSession
(
session
=>
{
if
(
!
session
.
parentSession
||
(
session
.
parentSession
&&
session
.
hasSeparateRepl
()))
{
this
.
listeners
.
set
(
session
.
getId
(),
session
.
onDidChangeReplElements
(()
=>
{
this
.
processNewReplElements
(
session
);
}));
}
}));
this
.
_register
(
debugService
.
onDidEndSession
(
session
=>
{
if
(
this
.
listeners
.
has
(
session
.
getId
()))
{
this
.
listeners
.
get
(
session
.
getId
())?.
dispose
();
this
.
listeners
.
delete
(
session
.
getId
());
}
}));
}
private
replPositions
:
Map
<
string
,
{
position
:
number
,
tail
:
IReplElement
}
>
=
new
Map
();
private
processNewReplElements
(
session
:
IDebugSession
)
{
const
oldReplPosition
=
this
.
replPositions
.
get
(
session
.
getId
());
const
replElements
=
session
.
getReplElements
();
this
.
replPositions
.
set
(
session
.
getId
(),
{
position
:
replElements
.
length
-
1
,
tail
:
replElements
[
replElements
.
length
-
1
]
});
if
(
!
oldReplPosition
&&
replElements
.
length
>
0
)
{
replElements
.
forEach
(
element
=>
this
.
processData
(
element
.
toString
()));
}
else
if
(
oldReplPosition
&&
(
replElements
.
length
-
1
!==
oldReplPosition
.
position
))
{
// Process lines until we reach the old "tail"
for
(
let
i
=
replElements
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
element
=
replElements
[
i
];
if
(
element
===
oldReplPosition
.
tail
)
{
break
;
}
else
{
this
.
processData
(
element
.
toString
());
}
}
}
}
dispose
()
{
...
...
@@ -63,7 +102,7 @@ export class UrlFinder extends Disposable {
if
(
host
!==
'
0.0.0.0
'
&&
host
!==
'
127.0.0.1
'
)
{
host
=
'
localhost
'
;
}
// Exclude node inspect, except when using def
ua
lt port
// Exclude node inspect, except when using def
au
lt port
if
(
port
!==
9229
&&
data
.
startsWith
(
'
Debugger listening on
'
))
{
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录