Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8b84e962
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,发现更多精彩内容 >>
提交
8b84e962
编写于
5月 08, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support debugPort in EH
上级
211d2ea5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
87 addition
and
65 deletion
+87
-65
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
.../workbench/api/electron-browser/mainThreadDebugService.ts
+4
-4
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+34
-15
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+2
-2
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
...parts/debug/electron-browser/debugConfigurationManager.ts
+2
-2
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
...workbench/parts/debug/electron-browser/rawDebugSession.ts
+2
-37
src/vs/workbench/parts/debug/node/debugAdapter.ts
src/vs/workbench/parts/debug/node/debugAdapter.ts
+34
-0
src/vs/workbench/parts/debug/node/debugger.ts
src/vs/workbench/parts/debug/node/debugger.ts
+8
-4
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
浏览文件 @
8b84e962
...
...
@@ -61,9 +61,9 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
this
.
_toDispose
.
push
(
this
.
debugService
.
getConfigurationManager
().
registerDebugAdapterProvider
(
debugTypes
,
this
));
}
createDebugAdapter
(
debugType
:
string
,
adapterInfo
):
IDebugAdapter
{
createDebugAdapter
(
debugType
:
string
,
adapterInfo
,
debugPort
:
number
):
IDebugAdapter
{
const
handle
=
this
.
_debugAdaptersHandleCounter
++
;
const
da
=
new
ExtensionHostDebugAdapter
(
handle
,
this
.
_proxy
,
debugType
,
adapterInfo
);
const
da
=
new
ExtensionHostDebugAdapter
(
handle
,
this
.
_proxy
,
debugType
,
adapterInfo
,
debugPort
);
this
.
_debugAdapters
.
set
(
handle
,
da
);
return
da
;
}
...
...
@@ -262,7 +262,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
*/
class
ExtensionHostDebugAdapter
extends
AbstractDebugAdapter
{
constructor
(
private
_handle
:
number
,
private
_proxy
:
ExtHostDebugServiceShape
,
private
_debugType
:
string
,
private
_adapterExecutable
:
IAdapterExecutable
|
null
)
{
constructor
(
private
_handle
:
number
,
private
_proxy
:
ExtHostDebugServiceShape
,
private
_debugType
:
string
,
private
_adapterExecutable
:
IAdapterExecutable
|
null
,
private
_debugPort
:
number
)
{
super
();
}
...
...
@@ -275,7 +275,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
}
public
startSession
():
TPromise
<
void
>
{
return
this
.
_proxy
.
$startDASession
(
this
.
_handle
,
this
.
_debugType
,
this
.
_adapterExecutable
);
return
this
.
_proxy
.
$startDASession
(
this
.
_handle
,
this
.
_debugType
,
this
.
_adapterExecutable
,
this
.
_debugPort
);
}
public
sendMessage
(
message
:
DebugProtocol
.
ProtocolMessage
):
void
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
8b84e962
...
...
@@ -821,7 +821,7 @@ export interface ISourceMultiBreakpointDto {
export
interface
ExtHostDebugServiceShape
{
$substituteVariables
(
folder
:
UriComponents
|
undefined
,
config
:
IConfig
):
TPromise
<
IConfig
>
;
$runInTerminal
(
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
;
$startDASession
(
handle
:
number
,
debugType
:
string
,
adapterExecutableInfo
:
IAdapterExecutable
|
null
):
TPromise
<
void
>
;
$startDASession
(
handle
:
number
,
debugType
:
string
,
adapterExecutableInfo
:
IAdapterExecutable
|
null
,
debugPort
:
number
):
TPromise
<
void
>
;
$stopDASession
(
handle
:
number
):
TPromise
<
void
>
;
$sendDAMessage
(
handle
:
number
,
message
:
DebugProtocol
.
ProtocolMessage
):
TPromise
<
void
>
;
$resolveDebugConfiguration
(
handle
:
number
,
folder
:
UriComponents
|
undefined
,
debugConfiguration
:
IConfig
):
TPromise
<
IConfig
>
;
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
8b84e962
...
...
@@ -17,11 +17,11 @@ import {
import
*
as
vscode
from
'
vscode
'
;
import
{
Disposable
,
Position
,
Location
,
SourceBreakpoint
,
FunctionBreakpoint
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
DebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
DebugAdapter
,
StreamDebugAdapter
,
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/node/extHostDocumentsAndEditors
'
;
import
{
IAdapterExecutable
,
ITerminalSettings
,
IDebuggerContribution
,
IConfig
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IAdapterExecutable
,
ITerminalSettings
,
IDebuggerContribution
,
IConfig
,
IDebugAdapter
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
getTerminalLauncher
}
from
'
vs/workbench/parts/debug/node/terminals
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
VariableResolver
}
from
'
vs/workbench/services/configurationResolver/node/variableResolver
'
;
...
...
@@ -62,7 +62,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
private
readonly
_onDidChangeBreakpoints
:
Emitter
<
vscode
.
BreakpointsChangeEvent
>
;
private
_debugAdapters
:
Map
<
number
,
DebugAdapter
>
;
private
_debugAdapters
:
Map
<
number
,
I
DebugAdapter
>
;
private
_variableResolver
:
IConfigurationResolverService
;
...
...
@@ -133,22 +133,41 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return
asWinJsPromise
(
token
=>
DebugAdapter
.
substituteVariables
(
folder
,
config
,
this
.
_variableResolver
));
}
public
$startDASession
(
handle
:
number
,
debugType
:
string
,
adpaterExecutable
:
IAdapterExecutable
|
null
):
TPromise
<
void
>
{
public
$startDASession
(
handle
:
number
,
debugType
:
string
,
adpaterExecutable
:
IAdapterExecutable
|
null
,
debugPort
:
number
):
TPromise
<
void
>
{
const
mythis
=
this
;
const
da
=
new
class
extends
DebugAdapter
{
let
da
:
StreamDebugAdapter
=
null
;
// DA -> VS Code
public
acceptMessage
(
message
:
DebugProtocol
.
ProtocolMessage
)
{
convertToVSCPaths
(
message
,
source
=>
{
if
(
paths
.
isAbsolute
(
source
.
path
))
{
(
<
any
>
source
).
path
=
URI
.
file
(
source
.
path
);
}
});
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
}
if
(
debugPort
>
0
)
{
da
=
new
class
extends
SocketDebugAdapter
{
// DA -> VS Code
public
acceptMessage
(
message
:
DebugProtocol
.
ProtocolMessage
)
{
convertToVSCPaths
(
message
,
source
=>
{
if
(
paths
.
isAbsolute
(
source
.
path
))
{
(
<
any
>
source
).
path
=
URI
.
file
(
source
.
path
);
}
});
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
}
}(
debugPort
);
}(
debugType
,
adpaterExecutable
,
this
.
_extensionService
.
getAllExtensionDescriptions
());
}
else
{
da
=
new
class
extends
DebugAdapter
{
// DA -> VS Code
public
acceptMessage
(
message
:
DebugProtocol
.
ProtocolMessage
)
{
convertToVSCPaths
(
message
,
source
=>
{
if
(
paths
.
isAbsolute
(
source
.
path
))
{
(
<
any
>
source
).
path
=
URI
.
file
(
source
.
path
);
}
});
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
}
}(
debugType
,
adpaterExecutable
,
this
.
_extensionService
.
getAllExtensionDescriptions
());
}
this
.
_debugAdapters
.
set
(
handle
,
da
);
da
.
onError
(
err
=>
this
.
_debugServiceProxy
.
$acceptDAError
(
handle
,
err
.
name
,
err
.
message
,
err
.
stack
));
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
8b84e962
...
...
@@ -406,7 +406,7 @@ export interface IDebugAdapter extends IDisposable {
}
export
interface
IDebugAdapterProvider
extends
ITerminalLauncher
{
createDebugAdapter
(
debugType
:
string
,
adapterInfo
:
IAdapterExecutable
|
null
):
IDebugAdapter
;
createDebugAdapter
(
debugType
:
string
,
adapterInfo
:
IAdapterExecutable
|
null
,
debugPort
:
number
):
IDebugAdapter
;
substituteVariables
(
folder
:
IWorkspaceFolder
,
config
:
IConfig
):
TPromise
<
IConfig
>
;
}
...
...
@@ -506,7 +506,7 @@ export interface IConfigurationManager {
debugAdapterExecutable
(
folderUri
:
uri
|
undefined
,
type
:
string
):
TPromise
<
IAdapterExecutable
|
undefined
>
;
registerDebugAdapterProvider
(
debugTypes
:
string
[],
debugAdapterLauncher
:
IDebugAdapterProvider
):
IDisposable
;
createDebugAdapter
(
debugType
:
string
,
adapterExecutable
:
IAdapterExecutable
|
null
):
IDebugAdapter
|
undefined
;
createDebugAdapter
(
debugType
:
string
,
adapterExecutable
:
IAdapterExecutable
|
null
,
debugPort
?:
number
):
IDebugAdapter
|
undefined
;
substituteVariables
(
debugType
:
string
,
folder
:
IWorkspaceFolder
,
config
:
IConfig
):
TPromise
<
IConfig
>
;
runInTerminal
(
debugType
:
string
,
args
:
DebugProtocol
.
RunInTerminalRequestArguments
,
config
:
ITerminalSettings
):
TPromise
<
void
>
;
}
...
...
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
浏览文件 @
8b84e962
...
...
@@ -140,10 +140,10 @@ export class ConfigurationManager implements IConfigurationManager {
return
this
.
debugAdapterProviders
.
get
(
type
);
}
public
createDebugAdapter
(
debugType
:
string
,
adapterExecutable
:
IAdapterExecutable
):
IDebugAdapter
|
undefined
{
public
createDebugAdapter
(
debugType
:
string
,
adapterExecutable
:
IAdapterExecutable
,
debugPort
:
number
):
IDebugAdapter
|
undefined
{
let
dap
=
this
.
getDebugAdapterProvider
(
debugType
);
if
(
dap
)
{
return
dap
.
createDebugAdapter
(
debugType
,
adapterExecutable
);
return
dap
.
createDebugAdapter
(
debugType
,
adapterExecutable
,
debugPort
);
}
return
undefined
;
}
...
...
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
浏览文件 @
8b84e962
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
net
from
'
net
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
...
...
@@ -16,8 +15,8 @@ import { Debugger } from 'vs/workbench/parts/debug/node/debugger';
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
StreamDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
formatPII
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
export
interface
SessionExitedEvent
extends
debug
.
DebugEvent
{
...
...
@@ -34,36 +33,6 @@ export interface SessionTerminatedEvent extends debug.DebugEvent {
};
}
export
class
SocketDebugAdapter
extends
StreamDebugAdapter
{
private
socket
:
net
.
Socket
;
constructor
(
private
host
:
string
,
private
port
:
number
)
{
super
();
}
startSession
():
TPromise
<
void
>
{
return
new
TPromise
<
void
>
((
c
,
e
)
=>
{
this
.
socket
=
net
.
createConnection
(
this
.
port
,
this
.
host
,
()
=>
{
this
.
connect
(
this
.
socket
,
<
any
>
this
.
socket
);
c
(
null
);
});
this
.
socket
.
on
(
'
error
'
,
(
err
:
any
)
=>
{
e
(
err
);
});
this
.
socket
.
on
(
'
close
'
,
()
=>
this
.
_onExit
.
fire
(
0
));
});
}
stopSession
():
TPromise
<
void
>
{
if
(
this
.
socket
!==
null
)
{
this
.
socket
.
end
();
this
.
socket
=
undefined
;
}
return
void
0
;
}
}
export
class
RawDebugSession
implements
debug
.
IRawSession
{
private
debugAdapter
:
debug
.
IDebugAdapter
;
...
...
@@ -186,11 +155,7 @@ export class RawDebugSession implements debug.IRawSession {
private
startSession
():
TPromise
<
void
>
{
const
debugAdapterP
=
this
.
debugServerPort
?
TPromise
.
as
(
new
SocketDebugAdapter
(
'
127.0.0.1
'
,
this
.
debugServerPort
))
:
this
.
_debugger
.
createDebugAdapter
(
this
.
root
,
this
.
outputService
);
return
debugAdapterP
.
then
(
debugAdapter
=>
{
return
this
.
_debugger
.
createDebugAdapter
(
this
.
root
,
this
.
outputService
,
this
.
debugServerPort
).
then
(
debugAdapter
=>
{
this
.
debugAdapter
=
debugAdapter
;
...
...
src/vs/workbench/parts/debug/node/debugAdapter.ts
浏览文件 @
8b84e962
...
...
@@ -7,6 +7,7 @@ import * as fs from 'fs';
import
*
as
cp
from
'
child_process
'
;
import
*
as
stream
from
'
stream
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
net
from
'
net
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
...
...
@@ -215,6 +216,39 @@ export abstract class StreamDebugAdapter extends AbstractDebugAdapter {
}
}
/**
* An implementation that connects to a debug adapter via a socket.
*/
export
class
SocketDebugAdapter
extends
StreamDebugAdapter
{
private
socket
:
net
.
Socket
;
constructor
(
private
port
:
number
,
private
host
=
'
127.0.0.1
'
)
{
super
();
}
startSession
():
TPromise
<
void
>
{
return
new
TPromise
<
void
>
((
c
,
e
)
=>
{
this
.
socket
=
net
.
createConnection
(
this
.
port
,
this
.
host
,
()
=>
{
this
.
connect
(
this
.
socket
,
<
any
>
this
.
socket
);
c
(
null
);
});
this
.
socket
.
on
(
'
error
'
,
(
err
:
any
)
=>
{
e
(
err
);
});
this
.
socket
.
on
(
'
close
'
,
()
=>
this
.
_onExit
.
fire
(
0
));
});
}
stopSession
():
TPromise
<
void
>
{
if
(
this
.
socket
!==
null
)
{
this
.
socket
.
end
();
this
.
socket
=
undefined
;
}
return
void
0
;
}
}
/**
* An implementation that launches the debug adapter as a separate process and communicates via stdin/stdout.
*/
...
...
src/vs/workbench/parts/debug/node/debugger.ts
浏览文件 @
8b84e962
...
...
@@ -16,7 +16,7 @@ import { IExtensionDescription } from 'vs/workbench/services/extensions/common/e
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
DebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
DebugAdapter
,
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
uri
from
'
vs/base/common/uri
'
;
...
...
@@ -38,13 +38,17 @@ export class Debugger {
public
hasConfigurationProvider
=
false
;
public
createDebugAdapter
(
root
:
IWorkspaceFolder
,
outputService
:
IOutputService
):
TPromise
<
IDebugAdapter
>
{
public
createDebugAdapter
(
root
:
IWorkspaceFolder
,
outputService
:
IOutputService
,
debugPort
?:
number
):
TPromise
<
IDebugAdapter
>
{
return
this
.
getAdapterExecutable
(
root
).
then
(
adapterExecutable
=>
{
const
debugConfigs
=
this
.
configurationService
.
getValue
<
IDebugConfiguration
>
(
'
debug
'
);
if
(
debugConfigs
.
extensionHostDebugAdapter
)
{
return
this
.
configurationManager
.
createDebugAdapter
(
this
.
type
,
adapterExecutable
);
return
this
.
configurationManager
.
createDebugAdapter
(
this
.
type
,
adapterExecutable
,
debugPort
);
}
else
{
return
new
DebugAdapter
(
this
.
type
,
adapterExecutable
,
this
.
mergedExtensionDescriptions
,
outputService
);
if
(
debugPort
)
{
return
new
SocketDebugAdapter
(
debugPort
);
}
else
{
return
new
DebugAdapter
(
this
.
type
,
adapterExecutable
,
this
.
mergedExtensionDescriptions
,
outputService
);
}
}
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录