Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5bb74015
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,发现更多精彩内容 >>
提交
5bb74015
编写于
9月 05, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt: cleanup DebugService and DebugSession
上级
8da82215
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
41 deletion
+31
-41
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/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+2
-6
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
...workbench/parts/debug/electron-browser/rawDebugSession.ts
+26
-28
src/vs/workbench/parts/debug/test/common/mockDebug.ts
src/vs/workbench/parts/debug/test/common/mockDebug.ts
+1
-5
未找到文件。
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
5bb74015
...
...
@@ -112,12 +112,12 @@ export interface IRawDebugSession {
capabilities
:
DebugProtocol
.
Capabilities
;
disconnected
:
boolean
;
readyForBreakpoints
:
boolean
;
emittedStopped
:
boolean
;
sessionLengthInSeconds
:
number
;
launch
(
args
:
DebugProtocol
.
LaunchRequestArguments
):
TPromise
<
DebugProtocol
.
LaunchResponse
>
;
attach
(
args
:
DebugProtocol
.
AttachRequestArguments
):
TPromise
<
DebugProtocol
.
AttachResponse
>
;
launchOrAttach
(
args
:
IConfig
):
TPromise
<
DebugProtocol
.
Response
>
;
terminate
(
restart
?:
boolean
):
TPromise
<
DebugProtocol
.
TerminateResponse
>
;
disconnect
(
restart
?:
boolean
):
TPromise
<
any
>
;
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
5bb74015
...
...
@@ -410,7 +410,7 @@ export class DebugService implements IDebugService {
const
dbgr
=
this
.
configurationManager
.
getDebugger
(
session
.
configuration
.
type
);
return
session
.
initialize
(
dbgr
).
then
(()
=>
{
session
.
raw
.
a
ttach
(
session
.
configuration
).
then
(
result
=>
{
session
.
raw
.
launchOrA
ttach
(
session
.
configuration
).
then
(
result
=>
{
this
.
focusStackFrame
(
undefined
,
undefined
,
session
);
});
});
...
...
@@ -440,11 +440,7 @@ export class DebugService implements IDebugService {
resolved
.
__sessionId
=
session
.
getId
();
}
return
(
resolved
.
request
===
'
attach
'
?
raw
.
attach
(
resolved
)
:
raw
.
launch
(
resolved
)).
then
(
result
=>
{
if
(
raw
.
disconnected
)
{
return
TPromise
.
as
(
null
);
}
return
raw
.
launchOrAttach
(
resolved
).
then
(
result
=>
{
this
.
focusStackFrame
(
undefined
,
undefined
,
session
);
...
...
src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts
浏览文件 @
5bb74015
...
...
@@ -15,7 +15,7 @@ import { IOutputService } from 'vs/workbench/parts/output/common/output';
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
formatPII
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
SocketDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
IRawDebugSession
,
IDebugAdapter
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IRawDebugSession
,
IDebugAdapter
,
IConfig
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
CancellationToken
,
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
export
class
RawDebugSession
implements
IRawDebugSession
{
...
...
@@ -150,35 +150,37 @@ export class RawDebugSession implements IRawDebugSession {
//---- DAP requests
public
initialize
(
args
:
DebugProtocol
.
InitializeRequestArguments
):
TPromise
<
DebugProtocol
.
InitializeResponse
>
{
return
this
.
send
(
'
initialize
'
,
args
).
then
(
response
=>
this
.
readCapabilities
(
response
));
}
public
launch
(
args
:
DebugProtocol
.
LaunchRequestArguments
):
TPromise
<
DebugProtocol
.
LaunchResponse
>
{
return
this
.
send
(
'
launch
'
,
args
).
then
(
response
=>
this
.
readCapabilities
(
response
));
return
this
.
send
(
'
initialize
'
,
args
).
then
(
response
=>
{
this
.
readCapabilities
(
response
);
return
response
;
});
}
public
attach
(
args
:
DebugProtocol
.
AttachRequestArguments
):
TPromise
<
DebugProtocol
.
AttachResponse
>
{
this
.
isAttached
=
true
;
return
this
.
send
(
'
attach
'
,
args
).
then
(
response
=>
this
.
readCapabilities
(
response
));
public
launchOrAttach
(
config
:
IConfig
):
TPromise
<
DebugProtocol
.
Response
>
{
this
.
isAttached
=
config
.
request
===
'
attach
'
;
return
this
.
send
(
this
.
isAttached
?
'
attach
'
:
'
launch
'
,
config
).
then
(
response
=>
{
this
.
readCapabilities
(
response
);
return
response
;
});
}
public
next
(
args
:
DebugProtocol
.
NextArguments
):
TPromise
<
DebugProtocol
.
NextResponse
>
{
return
this
.
send
(
'
next
'
,
args
).
then
(
response
=>
{
this
.
fire
FakeContinued
(
args
.
threadId
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
}
public
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
TPromise
<
DebugProtocol
.
StepInResponse
>
{
return
this
.
send
(
'
stepIn
'
,
args
).
then
(
response
=>
{
this
.
fire
FakeContinued
(
args
.
threadId
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
}
public
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
TPromise
<
DebugProtocol
.
StepOutResponse
>
{
return
this
.
send
(
'
stepOut
'
,
args
).
then
(
response
=>
{
this
.
fire
FakeContinued
(
args
.
threadId
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
}
...
...
@@ -188,7 +190,7 @@ export class RawDebugSession implements IRawDebugSession {
if
(
response
&&
response
.
body
&&
response
.
body
.
allThreadsContinued
!==
undefined
)
{
this
.
allThreadsContinued
=
response
.
body
.
allThreadsContinued
;
}
this
.
fire
FakeContinued
(
args
.
threadId
,
this
.
allThreadsContinued
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
,
this
.
allThreadsContinued
);
return
response
;
});
}
...
...
@@ -207,7 +209,7 @@ export class RawDebugSession implements IRawDebugSession {
public
restartFrame
(
args
:
DebugProtocol
.
RestartFrameArguments
,
threadId
:
number
):
TPromise
<
DebugProtocol
.
RestartFrameResponse
>
{
return
this
.
send
(
'
restartFrame
'
,
args
).
then
(
response
=>
{
this
.
fire
FakeContinued
(
threadId
);
this
.
fire
SimulatedContinuedEvent
(
threadId
);
return
response
;
});
}
...
...
@@ -276,7 +278,7 @@ export class RawDebugSession implements IRawDebugSession {
public
stepBack
(
args
:
DebugProtocol
.
StepBackArguments
):
TPromise
<
DebugProtocol
.
StepBackResponse
>
{
return
this
.
send
(
'
stepBack
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
this
.
fire
FakeContinued
(
args
.
threadId
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
});
...
...
@@ -285,7 +287,7 @@ export class RawDebugSession implements IRawDebugSession {
public
reverseContinue
(
args
:
DebugProtocol
.
ReverseContinueArguments
):
TPromise
<
DebugProtocol
.
ReverseContinueResponse
>
{
return
this
.
send
(
'
reverseContinue
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
this
.
fire
FakeContinued
(
args
.
threadId
);
this
.
fire
SimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
});
...
...
@@ -340,7 +342,6 @@ export class RawDebugSession implements IRawDebugSession {
this
.
cachedInitDebugAdapterP
=
startSessionP
.
then
(()
=>
{
this
.
startTime
=
new
Date
().
getTime
();
},
err
=>
{
this
.
cachedInitDebugAdapterP
=
null
;
return
TPromise
.
wrapError
(
err
);
});
}
...
...
@@ -396,7 +397,6 @@ export class RawDebugSession implements IRawDebugSession {
private
onDebugAdapterExit
(
code
:
number
):
void
{
this
.
debugAdapter
=
null
;
this
.
cachedInitDebugAdapterP
=
null
;
if
(
!
this
.
disconnected
&&
code
!==
0
)
{
this
.
_onDidExitAdapter
.
fire
(
new
Error
(
`exit code:
${
code
}
`
));
}
else
{
...
...
@@ -415,17 +415,17 @@ export class RawDebugSession implements IRawDebugSession {
success
:
true
};
const
sendResponse
=
(
response
)
=>
this
.
debugAdapter
&&
this
.
debugAdapter
.
sendResponse
(
response
);
const
s
afeS
endResponse
=
(
response
)
=>
this
.
debugAdapter
&&
this
.
debugAdapter
.
sendResponse
(
response
);
switch
(
request
.
command
)
{
case
'
runInTerminal
'
:
this
.
_debugger
.
runInTerminal
(
<
DebugProtocol
.
RunInTerminalRequestArguments
>
request
.
arguments
).
then
(
_
=>
{
response
.
body
=
{};
sendResponse
(
response
);
s
afeS
endResponse
(
response
);
},
err
=>
{
response
.
success
=
false
;
response
.
message
=
err
.
message
;
sendResponse
(
response
);
s
afeS
endResponse
(
response
);
});
break
;
case
'
handshake
'
:
...
...
@@ -436,17 +436,17 @@ export class RawDebugSession implements IRawDebugSession {
response
.
body
=
{
signature
:
sig
};
sendResponse
(
response
);
s
afeS
endResponse
(
response
);
}
catch
(
e
)
{
response
.
success
=
false
;
response
.
message
=
e
.
message
;
sendResponse
(
response
);
s
afeS
endResponse
(
response
);
}
break
;
default
:
response
.
success
=
false
;
response
.
message
=
`unknown request '
${
request
.
command
}
'`
;
sendResponse
(
response
);
s
afeS
endResponse
(
response
);
break
;
}
}
...
...
@@ -510,14 +510,13 @@ export class RawDebugSession implements IRawDebugSession {
});
}
private
readCapabilities
(
response
:
DebugProtocol
.
Response
):
DebugProtocol
.
Response
{
private
readCapabilities
(
response
:
DebugProtocol
.
Response
):
void
{
if
(
response
)
{
this
.
_capabilities
=
objects
.
mixin
(
this
.
_capabilities
,
response
.
body
);
}
return
response
;
}
private
fire
FakeContinued
(
threadId
:
number
,
allThreadsContinued
=
false
):
void
{
private
fire
SimulatedContinuedEvent
(
threadId
:
number
,
allThreadsContinued
=
false
):
void
{
this
.
_onDidContinued
.
fire
({
type
:
'
event
'
,
event
:
'
continued
'
,
...
...
@@ -533,7 +532,6 @@ export class RawDebugSession implements IRawDebugSession {
if
(
/* this.socket !== null */
this
.
debugAdapter
instanceof
SocketDebugAdapter
)
{
this
.
debugAdapter
.
stopSession
();
this
.
cachedInitDebugAdapterP
=
null
;
}
this
.
_onDidExitAdapter
.
fire
(
error
);
...
...
src/vs/workbench/parts/debug/test/common/mockDebug.ts
浏览文件 @
5bb74015
...
...
@@ -223,11 +223,7 @@ export class MockRawSession implements IRawDebugSession {
return
TPromise
.
as
(
null
);
}
public
launch
(
args
:
DebugProtocol
.
LaunchRequestArguments
):
TPromise
<
DebugProtocol
.
LaunchResponse
>
{
return
TPromise
.
as
(
null
);
}
public
attach
(
args
:
DebugProtocol
.
AttachRequestArguments
):
TPromise
<
DebugProtocol
.
AttachResponse
>
{
public
launchOrAttach
(
args
:
IConfig
):
TPromise
<
DebugProtocol
.
Response
>
{
return
TPromise
.
as
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录