Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b3d2c603
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,发现更多精彩内容 >>
提交
b3d2c603
编写于
9月 19, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support EH based DAs
上级
abee50e7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
175 addition
and
77 deletion
+175
-77
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+22
-3
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-0
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+80
-30
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+9
-0
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+8
-3
src/vs/workbench/parts/debug/node/debugAdapter.ts
src/vs/workbench/parts/debug/node/debugAdapter.ts
+42
-30
src/vs/workbench/parts/debug/node/debugger.ts
src/vs/workbench/parts/debug/node/debugger.ts
+8
-6
src/vs/workbench/parts/debug/test/node/debugger.test.ts
src/vs/workbench/parts/debug/test/node/debugger.test.ts
+5
-5
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
b3d2c603
...
...
@@ -491,11 +491,14 @@ declare module 'vscode' {
readonly
cwd
?:
string
;
/**
* Create a
new debug adapter specification
.
* Create a
description for a debug adapter based on an executable program
.
*/
constructor
(
command
:
string
,
args
?:
string
[],
env
?:
{
[
key
:
string
]:
string
},
cwd
?:
string
);
}
/**
* Represents a debug adapter running as a socket based server.
*/
export
class
DebugAdapterServer
{
readonly
type
:
'
server
'
;
...
...
@@ -511,12 +514,28 @@ declare module 'vscode' {
readonly
host
?:
string
;
/**
* Create a
new debug adapter specification
.
* Create a
description for a debug adapter running as a socket based server
.
*/
constructor
(
port
:
number
,
host
?:
string
);
}
export
type
DebugAdapterDescriptor
=
DebugAdapterExecutable
|
DebugAdapterServer
;
/**
* Represents a debug adapter that is implemented in the extension.
*/
export
class
DebugAdapterImplementation
{
readonly
type
:
'
implementation
'
;
readonly
implementation
:
any
;
/**
* Create a description for a debug adapter directly implemented in the extension.
* The implementation's "type": TBD
*/
constructor
(
implementation
:
any
);
}
export
type
DebugAdapterDescriptor
=
DebugAdapterExecutable
|
DebugAdapterServer
|
DebugAdapterImplementation
;
export
interface
DebugConfigurationProvider
{
/**
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
b3d2c603
...
...
@@ -726,6 +726,7 @@ export function createApiFactory(
ConfigurationTarget
:
extHostTypes
.
ConfigurationTarget
,
DebugAdapterExecutable
:
extHostTypes
.
DebugAdapterExecutable
,
DebugAdapterServer
:
extHostTypes
.
DebugAdapterServer
,
DebugAdapterImplementation
:
extHostTypes
.
DebugAdapterImplementation
,
DecorationRangeBehavior
:
extHostTypes
.
DecorationRangeBehavior
,
Diagnostic
:
extHostTypes
.
Diagnostic
,
DiagnosticRelatedInformation
:
extHostTypes
.
DiagnosticRelatedInformation
,
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
b3d2c603
...
...
@@ -18,7 +18,7 @@ import {
import
*
as
vscode
from
'
vscode
'
;
import
{
Disposable
,
Position
,
Location
,
SourceBreakpoint
,
FunctionBreakpoint
,
DebugAdapterServer
,
DebugAdapterExecutable
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
DebugAdapter
,
Socke
tDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
ExecutableDebugAdapter
,
SocketDebugAdapter
,
Abstrac
tDebugAdapter
}
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
'
;
...
...
@@ -107,7 +107,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
this
.
_breakpoints
=
new
Map
<
string
,
vscode
.
Breakpoint
>
();
this
.
_breakpointEventsActive
=
false
;
this
.
_debugAdapters
=
new
Map
<
number
,
DebugAdapter
>
();
this
.
_debugAdapters
=
new
Map
();
// register all debug extensions
const
debugTypes
:
string
[]
=
[];
...
...
@@ -336,40 +336,20 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return
this
.
getAdapterDescriptor
(
this
.
_providerByType
.
get
(
config
.
type
),
sessionDto
,
folderUri
,
config
).
then
(
adapter
=>
{
let
da
:
I
DebugAdapter
=
undefined
;
let
da
:
Abstract
DebugAdapter
=
undefined
;
switch
(
adapter
.
type
)
{
case
'
server
'
:
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
);
}
}(
adapter
);
da
=
new
SocketDebugAdapter
(
adapter
);
break
;
case
'
executable
'
:
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
);
}
da
=
new
ExecutableDebugAdapter
(
adapter
,
config
.
type
);
break
;
}(
adapter
,
config
.
type
);
case
'
implementation
'
:
da
=
new
DirectDebugAdapter
(
adapter
.
implementation
);
break
;
default
:
...
...
@@ -378,6 +358,15 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if
(
da
)
{
this
.
_debugAdapters
.
set
(
handle
,
da
);
da
.
onMessage
(
message
=>
{
// DA -> VS Code
convertToVSCPaths
(
message
,
source
=>
{
if
(
paths
.
isAbsolute
(
source
.
path
))
{
(
<
any
>
source
).
path
=
URI
.
file
(
source
.
path
);
}
});
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
handle
,
message
);
});
da
.
onError
(
err
=>
this
.
_debugServiceProxy
.
$acceptDAError
(
handle
,
err
.
name
,
err
.
message
,
err
.
stack
));
da
.
onExit
(
code
=>
this
.
_debugServiceProxy
.
$acceptDAExit
(
handle
,
code
,
null
));
return
da
.
startSession
();
...
...
@@ -541,7 +530,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if
(
debugConfigProvider
)
{
// try the proposed "provideDebugAdapter" API
if
(
debugConfigProvider
.
provideDebugAdapter
)
{
const
adapterExecutable
=
DebugAdapter
.
platformAdapterExecutable
(
this
.
_extensionService
.
getAllExtensionDescriptions
(),
config
.
type
);
const
adapterExecutable
=
Executable
DebugAdapter
.
platformAdapterExecutable
(
this
.
_extensionService
.
getAllExtensionDescriptions
(),
config
.
type
);
return
asThenable
(()
=>
debugConfigProvider
.
provideDebugAdapter
(
this
.
getSession
(
sessionDto
),
this
.
getFolder
(
folderUri
),
adapterExecutable
,
config
,
CancellationToken
.
None
));
}
// try the deprecated "debugAdapterExecutable" API
...
...
@@ -560,7 +549,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
// fallback: use executable information from package.json
return
TPromise
.
wrap
(
DebugAdapter
.
platformAdapterExecutable
(
this
.
_extensionService
.
getAllExtensionDescriptions
(),
config
.
type
));
return
TPromise
.
wrap
(
Executable
DebugAdapter
.
platformAdapterExecutable
(
this
.
_extensionService
.
getAllExtensionDescriptions
(),
config
.
type
));
}
private
startBreakpoints
()
{
...
...
@@ -698,3 +687,64 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
});
}
}
interface
IDapTransport
{
start
(
cb
:
(
msg
:
DebugProtocol
.
ProtocolMessage
)
=>
void
,
errorcb
:
(
event
:
DebugProtocol
.
Event
)
=>
void
);
send
(
message
:
DebugProtocol
.
ProtocolMessage
);
stop
():
void
;
}
class
DirectTransport
implements
IDapTransport
{
private
_sendUp
:
(
msg
:
DebugProtocol
.
ProtocolMessage
)
=>
void
;
constructor
(
private
da
:
DirectDebugAdapter
)
{
}
start
(
cb
:
(
msg
:
DebugProtocol
.
ProtocolMessage
)
=>
void
,
errorcb
:
(
event
:
DebugProtocol
.
Event
)
=>
void
)
{
this
.
_sendUp
=
cb
;
}
sendUp
(
message
:
DebugProtocol
.
ProtocolMessage
)
{
this
.
_sendUp
(
message
);
}
// DA -> VSCode
send
(
message
:
DebugProtocol
.
ProtocolMessage
)
{
this
.
da
.
acceptMessage
(
message
);
}
stop
():
void
{
throw
new
Error
(
'
Method not implemented.
'
);
}
}
class
DirectDebugAdapter
extends
AbstractDebugAdapter
{
readonly
onError
:
Event
<
Error
>
;
readonly
onExit
:
Event
<
number
>
;
private
transport
:
DirectTransport
;
constructor
(
implementation
:
any
)
{
super
();
if
(
implementation
.
__setTransport
)
{
this
.
transport
=
new
DirectTransport
(
this
);
implementation
.
__setTransport
(
this
.
transport
);
}
}
startSession
():
TPromise
<
void
>
{
return
TPromise
.
wrap
(
void
0
);
}
// VSCode -> DA
sendMessage
(
message
:
DebugProtocol
.
ProtocolMessage
):
void
{
this
.
transport
.
sendUp
(
message
);
}
stopSession
():
TPromise
<
void
>
{
this
.
transport
.
stop
();
return
TPromise
.
wrap
(
void
0
);
}
}
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
b3d2c603
...
...
@@ -1914,6 +1914,15 @@ export class DebugAdapterServer implements vscode.DebugAdapterServer {
}
}
export
class
DebugAdapterImplementation
implements
vscode
.
DebugAdapterImplementation
{
readonly
type
=
'
implementation
'
;
readonly
implementation
:
any
;
constructor
(
transport
:
any
)
{
this
.
implementation
=
transport
;
}
}
export
enum
LogLevel
{
Trace
=
1
,
Debug
=
2
,
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
b3d2c603
...
...
@@ -459,7 +459,7 @@ export interface IDebugAdapterProvider extends ITerminalLauncher {
substituteVariables
(
folder
:
IWorkspaceFolder
,
config
:
IConfig
):
TPromise
<
IConfig
>
;
}
export
interface
IAdapterExecutable
{
export
interface
I
Debug
AdapterExecutable
{
readonly
type
:
'
executable
'
;
readonly
command
:
string
;
readonly
args
:
string
[];
...
...
@@ -467,13 +467,18 @@ export interface IAdapterExecutable {
readonly
env
?:
{
[
key
:
string
]:
string
};
}
export
interface
IAdapterServer
{
export
interface
I
Debug
AdapterServer
{
readonly
type
:
'
server
'
;
readonly
port
:
number
;
readonly
host
?:
string
;
}
export
type
IAdapterDescriptor
=
IAdapterExecutable
|
IAdapterServer
;
export
interface
IDebugAdapterImplementation
{
readonly
type
:
'
implementation
'
;
readonly
implementation
:
any
;
}
export
type
IAdapterDescriptor
=
IDebugAdapterExecutable
|
IDebugAdapterServer
|
IDebugAdapterImplementation
;
export
interface
IPlatformSpecificAdapterContribution
{
program
?:
string
;
...
...
src/vs/workbench/parts/debug/node/debugAdapter.ts
浏览文件 @
b3d2c603
...
...
@@ -17,7 +17,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
ExtensionsChannelId
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
IDebugAdapter
,
I
AdapterExecutable
,
IDebuggerContribution
,
IPlatformSpecificAdapterContribution
,
I
AdapterServer
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugAdapter
,
I
DebugAdapterExecutable
,
IDebuggerContribution
,
IPlatformSpecificAdapterContribution
,
IDebug
AdapterServer
}
from
'
vs/workbench/parts/debug/common/debug
'
;
/**
* Abstract implementation of the low level API for a debug adapter.
...
...
@@ -29,6 +29,7 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter {
private
pendingRequests
:
Map
<
number
,
(
e
:
DebugProtocol
.
Response
)
=>
void
>
;
private
requestCallback
:
(
request
:
DebugProtocol
.
Request
)
=>
void
;
private
eventCallback
:
(
request
:
DebugProtocol
.
Event
)
=>
void
;
private
messageCallback
:
(
message
:
DebugProtocol
.
ProtocolMessage
)
=>
void
;
protected
readonly
_onError
:
Emitter
<
Error
>
;
protected
readonly
_onExit
:
Emitter
<
number
>
;
...
...
@@ -57,6 +58,13 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter {
return
this
.
_onExit
.
event
;
}
public
onMessage
(
callback
:
(
message
:
DebugProtocol
.
ProtocolMessage
)
=>
void
):
void
{
if
(
this
.
eventCallback
)
{
this
.
_onError
.
fire
(
new
Error
(
`attempt to set more than one 'Message' callback`
));
}
this
.
messageCallback
=
callback
;
}
public
onEvent
(
callback
:
(
event
:
DebugProtocol
.
Event
)
=>
void
):
void
{
if
(
this
.
eventCallback
)
{
this
.
_onError
.
fire
(
new
Error
(
`attempt to set more than one 'Event' callback`
));
...
...
@@ -116,25 +124,29 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter {
}
public
acceptMessage
(
message
:
DebugProtocol
.
ProtocolMessage
):
void
{
switch
(
message
.
type
)
{
case
'
event
'
:
if
(
this
.
eventCallback
)
{
this
.
eventCallback
(
<
DebugProtocol
.
Event
>
message
);
}
break
;
case
'
request
'
:
if
(
this
.
requestCallback
)
{
this
.
requestCallback
(
<
DebugProtocol
.
Request
>
message
);
}
break
;
case
'
response
'
:
const
response
=
<
DebugProtocol
.
Response
>
message
;
const
clb
=
this
.
pendingRequests
.
get
(
response
.
request_seq
);
if
(
clb
)
{
this
.
pendingRequests
.
delete
(
response
.
request_seq
);
clb
(
response
);
}
break
;
if
(
this
.
messageCallback
)
{
this
.
messageCallback
(
message
);
}
else
{
switch
(
message
.
type
)
{
case
'
event
'
:
if
(
this
.
eventCallback
)
{
this
.
eventCallback
(
<
DebugProtocol
.
Event
>
message
);
}
break
;
case
'
request
'
:
if
(
this
.
requestCallback
)
{
this
.
requestCallback
(
<
DebugProtocol
.
Request
>
message
);
}
break
;
case
'
response
'
:
const
response
=
<
DebugProtocol
.
Response
>
message
;
const
clb
=
this
.
pendingRequests
.
get
(
response
.
request_seq
);
if
(
clb
)
{
this
.
pendingRequests
.
delete
(
response
.
request_seq
);
clb
(
response
);
}
break
;
}
}
}
...
...
@@ -245,7 +257,7 @@ export class SocketDebugAdapter extends StreamDebugAdapter {
private
socket
:
net
.
Socket
;
constructor
(
private
adapterServer
:
IAdapterServer
)
{
constructor
(
private
adapterServer
:
I
Debug
AdapterServer
)
{
super
();
}
...
...
@@ -290,11 +302,11 @@ export class SocketDebugAdapter extends StreamDebugAdapter {
/**
* An implementation that launches the debug adapter as a separate process and communicates via stdin/stdout.
*/
export
class
DebugAdapter
extends
StreamDebugAdapter
{
export
class
Executable
DebugAdapter
extends
StreamDebugAdapter
{
private
serverProcess
:
cp
.
ChildProcess
;
constructor
(
private
adapterExecutable
:
IAdapterExecutable
,
private
debugType
:
string
,
private
outputService
?:
IOutputService
)
{
constructor
(
private
adapterExecutable
:
I
Debug
AdapterExecutable
,
private
debugType
:
string
,
private
outputService
?:
IOutputService
)
{
super
();
}
...
...
@@ -445,24 +457,24 @@ export class DebugAdapter extends StreamDebugAdapter {
}
if
(
contribution
.
win
)
{
result
.
win
=
DebugAdapter
.
extract
(
contribution
.
win
,
extensionFolderPath
);
result
.
win
=
Executable
DebugAdapter
.
extract
(
contribution
.
win
,
extensionFolderPath
);
}
if
(
contribution
.
winx86
)
{
result
.
winx86
=
DebugAdapter
.
extract
(
contribution
.
winx86
,
extensionFolderPath
);
result
.
winx86
=
Executable
DebugAdapter
.
extract
(
contribution
.
winx86
,
extensionFolderPath
);
}
if
(
contribution
.
windows
)
{
result
.
windows
=
DebugAdapter
.
extract
(
contribution
.
windows
,
extensionFolderPath
);
result
.
windows
=
Executable
DebugAdapter
.
extract
(
contribution
.
windows
,
extensionFolderPath
);
}
if
(
contribution
.
osx
)
{
result
.
osx
=
DebugAdapter
.
extract
(
contribution
.
osx
,
extensionFolderPath
);
result
.
osx
=
Executable
DebugAdapter
.
extract
(
contribution
.
osx
,
extensionFolderPath
);
}
if
(
contribution
.
linux
)
{
result
.
linux
=
DebugAdapter
.
extract
(
contribution
.
linux
,
extensionFolderPath
);
result
.
linux
=
Executable
DebugAdapter
.
extract
(
contribution
.
linux
,
extensionFolderPath
);
}
return
result
;
}
public
static
platformAdapterExecutable
(
extensionDescriptions
:
IExtensionDescription
[],
debugType
:
string
):
IAdapterExecutable
{
public
static
platformAdapterExecutable
(
extensionDescriptions
:
IExtensionDescription
[],
debugType
:
string
):
I
Debug
AdapterExecutable
{
const
result
:
IDebuggerContribution
=
Object
.
create
(
null
);
debugType
=
debugType
.
toLowerCase
();
...
...
@@ -473,7 +485,7 @@ export class DebugAdapter extends StreamDebugAdapter {
if
(
debuggers
&&
debuggers
.
length
>
0
)
{
debuggers
.
filter
(
dbg
=>
strings
.
equalsIgnoreCase
(
dbg
.
type
,
debugType
)).
forEach
(
dbg
=>
{
// extract relevant attributes and make then absolute where needed
const
extractedDbg
=
DebugAdapter
.
extract
(
dbg
,
ed
.
extensionLocation
.
fsPath
);
const
extractedDbg
=
Executable
DebugAdapter
.
extract
(
dbg
,
ed
.
extensionLocation
.
fsPath
);
// merge
objects
.
mixin
(
result
,
extractedDbg
,
ed
.
isBuiltin
);
...
...
src/vs/workbench/parts/debug/node/debugger.ts
浏览文件 @
b3d2c603
...
...
@@ -11,12 +11,12 @@ import * as objects from 'vs/base/common/objects';
import
{
TelemetryAppenderClient
}
from
'
vs/platform/telemetry/node/telemetryIpc
'
;
import
{
IJSONSchema
,
IJSONSchemaSnippet
}
from
'
vs/base/common/jsonSchema
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfig
,
IDebuggerContribution
,
I
AdapterExecutable
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
IConfigurationManager
,
IDebugAdapter
,
IDebugConfiguration
,
ITerminalSettings
,
IDebugger
,
IDebugSession
,
IAdapterDescriptor
,
I
AdapterServer
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IConfig
,
IDebuggerContribution
,
I
DebugAdapterExecutable
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
IConfigurationManager
,
IDebugAdapter
,
IDebugConfiguration
,
ITerminalSettings
,
IDebugger
,
IDebugSession
,
IAdapterDescriptor
,
IDebug
AdapterServer
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
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
,
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
Executable
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
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -48,7 +48,9 @@ export class Debugger implements IDebugger {
case
'
server
'
:
return
new
SocketDebugAdapter
(
adapterDescriptor
);
case
'
executable
'
:
return
new
DebugAdapter
(
adapterDescriptor
,
this
.
type
,
outputService
);
return
new
ExecutableDebugAdapter
(
adapterDescriptor
,
this
.
type
,
outputService
);
case
'
implementation
'
:
return
undefined
;
// seeing 'direct' here is an error
default
:
return
undefined
;
}
...
...
@@ -60,7 +62,7 @@ export class Debugger implements IDebugger {
// a "debugServer" attribute in the launch config takes precedence
if
(
typeof
config
.
debugServer
===
'
number
'
)
{
return
TPromise
.
wrap
(
<
IAdapterServer
>
{
return
TPromise
.
wrap
(
<
I
Debug
AdapterServer
>
{
type
:
'
server
'
,
port
:
config
.
debugServer
});
...
...
@@ -76,7 +78,7 @@ export class Debugger implements IDebugger {
// try deprecated command based extension API "adapterExecutableCommand" to determine the executable
if
(
this
.
debuggerContribution
.
adapterExecutableCommand
)
{
const
rootFolder
=
root
?
root
.
uri
.
toString
()
:
undefined
;
return
this
.
commandService
.
executeCommand
<
IAdapterExecutable
>
(
this
.
debuggerContribution
.
adapterExecutableCommand
,
rootFolder
).
then
((
ae
:
{
command
:
string
,
args
:
string
[]
})
=>
{
return
this
.
commandService
.
executeCommand
<
I
Debug
AdapterExecutable
>
(
this
.
debuggerContribution
.
adapterExecutableCommand
,
rootFolder
).
then
((
ae
:
{
command
:
string
,
args
:
string
[]
})
=>
{
return
<
IAdapterDescriptor
>
{
type
:
'
executable
'
,
command
:
ae
.
command
,
...
...
@@ -86,7 +88,7 @@ export class Debugger implements IDebugger {
}
// fallback: use executable information from package.json
return
DebugAdapter
.
platformAdapterExecutable
(
this
.
mergedExtensionDescriptions
,
this
.
type
);
return
Executable
DebugAdapter
.
platformAdapterExecutable
(
this
.
mergedExtensionDescriptions
,
this
.
type
);
});
}
...
...
src/vs/workbench/parts/debug/test/node/debugger.test.ts
浏览文件 @
b3d2c603
...
...
@@ -6,12 +6,12 @@
import
*
as
assert
from
'
assert
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
IAdapterExecutable
,
IConfigurationManager
,
IConfig
,
IDebugSession
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
I
Debug
AdapterExecutable
,
IConfigurationManager
,
IConfig
,
IDebugSession
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
Debugger
}
from
'
vs/workbench/parts/debug/node/debugger
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
DebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
Executable
DebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
suite
(
'
Debug - Debugger
'
,
()
=>
{
...
...
@@ -117,7 +117,7 @@ suite('Debug - Debugger', () => {
const
configurationManager
=
<
IConfigurationManager
>
{
provideDebugAdapter
(
session
:
IDebugSession
,
folderUri
:
URI
|
undefined
,
config
:
IConfig
):
TPromise
<
IAdapterExecutable
|
undefined
>
{
provideDebugAdapter
(
session
:
IDebugSession
,
folderUri
:
URI
|
undefined
,
config
:
IConfig
):
TPromise
<
I
Debug
AdapterExecutable
|
undefined
>
{
return
TPromise
.
as
(
undefined
);
}
};
...
...
@@ -134,7 +134,7 @@ suite('Debug - Debugger', () => {
assert
.
equal
(
_debugger
.
type
,
debuggerContribution
.
type
);
assert
.
equal
(
_debugger
.
label
,
debuggerContribution
.
label
);
const
ae
=
DebugAdapter
.
platformAdapterExecutable
([
extensionDescriptor0
],
'
mock
'
);
const
ae
=
Executable
DebugAdapter
.
platformAdapterExecutable
([
extensionDescriptor0
],
'
mock
'
);
assert
.
equal
(
ae
.
command
,
paths
.
join
(
extensionFolderPath
,
debuggerContribution
.
program
));
assert
.
deepEqual
(
ae
.
args
,
debuggerContribution
.
args
);
...
...
@@ -155,7 +155,7 @@ suite('Debug - Debugger', () => {
});
test
(
'
merge platform specific attributes
'
,
()
=>
{
const
ae
=
DebugAdapter
.
platformAdapterExecutable
([
extensionDescriptor1
,
extensionDescriptor2
],
'
mock
'
);
const
ae
=
Executable
DebugAdapter
.
platformAdapterExecutable
([
extensionDescriptor1
,
extensionDescriptor2
],
'
mock
'
);
assert
.
equal
(
ae
.
command
,
platform
.
isLinux
?
'
linuxRuntime
'
:
(
platform
.
isMacintosh
?
'
osxRuntime
'
:
'
winRuntime
'
));
const
xprogram
=
platform
.
isLinux
?
'
linuxProgram
'
:
(
platform
.
isMacintosh
?
'
osxProgram
'
:
'
winProgram
'
);
assert
.
deepEqual
(
ae
.
args
,
[
'
rarg
'
,
'
/e2/b/c/
'
+
xprogram
,
'
parg
'
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录