Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3cc2460c
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3cc2460c
编写于
10月 14, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: more async await
上级
460ef3a4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
82 addition
and
92 deletion
+82
-92
src/vs/workbench/contrib/debug/browser/debugSession.ts
src/vs/workbench/contrib/debug/browser/debugSession.ts
+1
-2
src/vs/workbench/contrib/debug/browser/rawDebugSession.ts
src/vs/workbench/contrib/debug/browser/rawDebugSession.ts
+74
-85
src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts
...s/workbench/contrib/debug/browser/watchExpressionsView.ts
+1
-2
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+6
-3
未找到文件。
src/vs/workbench/contrib/debug/browser/debugSession.ts
浏览文件 @
3cc2460c
...
...
@@ -718,8 +718,7 @@ export class DebugSession implements IDebugSession {
// Send all breakpoints
try
{
await
this
.
debugService
.
sendAllBreakpoints
(
this
);
await
sendConfigurationDone
();
}
catch
{
}
finally
{
await
sendConfigurationDone
();
}
await
this
.
fetchThreads
();
...
...
src/vs/workbench/contrib/debug/browser/rawDebugSession.ts
浏览文件 @
3cc2460c
...
...
@@ -228,25 +228,23 @@ export class RawDebugSession implements IDisposable {
/**
* Starts the underlying debug adapter and tracks the session time for telemetry.
*/
start
():
Promise
<
void
>
{
async
start
():
Promise
<
void
>
{
if
(
!
this
.
debugAdapter
)
{
return
Promise
.
reject
(
new
Error
(
'
no debug adapter
'
));
}
return
this
.
debugAdapter
.
startSession
().
then
(()
=>
{
this
.
startTime
=
new
Date
().
getTime
();
},
err
=>
{
return
Promise
.
reject
(
err
);
});
await
this
.
debugAdapter
.
startSession
();
this
.
startTime
=
new
Date
().
getTime
();
}
/**
* Send client capabilities to the debug adapter and receive DA capabilities in return.
*/
initialize
(
args
:
DebugProtocol
.
InitializeRequestArguments
):
Promise
<
DebugProtocol
.
InitializeResponse
>
{
return
this
.
send
(
'
initialize
'
,
args
).
then
((
response
:
DebugProtocol
.
InitializeResponse
)
=>
{
this
.
mergeCapabilities
(
response
.
body
);
return
response
;
})
;
async
initialize
(
args
:
DebugProtocol
.
InitializeRequestArguments
):
Promise
<
DebugProtocol
.
InitializeResponse
>
{
const
response
=
await
this
.
send
(
'
initialize
'
,
args
);
this
.
mergeCapabilities
(
response
.
body
);
return
response
;
}
/**
...
...
@@ -258,11 +256,11 @@ export class RawDebugSession implements IDisposable {
//---- DAP requests
launchOrAttach
(
config
:
IConfig
):
Promise
<
DebugProtocol
.
Response
>
{
return
this
.
send
(
config
.
request
,
config
).
then
(
response
=>
{
this
.
mergeCapabilities
(
response
.
body
);
return
response
;
})
;
async
launchOrAttach
(
config
:
IConfig
):
Promise
<
DebugProtocol
.
Response
>
{
const
response
=
await
this
.
send
(
config
.
request
,
config
);
this
.
mergeCapabilities
(
response
.
body
);
return
response
;
}
/**
...
...
@@ -286,35 +284,32 @@ export class RawDebugSession implements IDisposable {
return
Promise
.
reject
(
new
Error
(
'
restart not supported
'
));
}
next
(
args
:
DebugProtocol
.
NextArguments
):
Promise
<
DebugProtocol
.
NextResponse
>
{
return
this
.
send
(
'
next
'
,
args
).
then
(
response
=>
{
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
async
next
(
args
:
DebugProtocol
.
NextArguments
):
Promise
<
DebugProtocol
.
NextResponse
>
{
const
response
=
await
this
.
send
(
'
next
'
,
args
);
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
}
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
Promise
<
DebugProtocol
.
StepInResponse
>
{
return
this
.
send
(
'
stepIn
'
,
args
).
then
(
response
=>
{
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
async
stepIn
(
args
:
DebugProtocol
.
StepInArguments
):
Promise
<
DebugProtocol
.
StepInResponse
>
{
const
response
=
await
this
.
send
(
'
stepIn
'
,
args
);
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
}
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
Promise
<
DebugProtocol
.
StepOutResponse
>
{
return
this
.
send
(
'
stepOut
'
,
args
).
then
(
response
=>
{
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
});
async
stepOut
(
args
:
DebugProtocol
.
StepOutArguments
):
Promise
<
DebugProtocol
.
StepOutResponse
>
{
const
response
=
await
this
.
send
(
'
stepOut
'
,
args
);
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
}
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
Promise
<
DebugProtocol
.
ContinueResponse
>
{
return
this
.
send
<
DebugProtocol
.
ContinueResponse
>
(
'
continue
'
,
args
).
then
(
response
=>
{
if
(
response
&&
response
.
body
&&
response
.
body
.
allThreadsContinued
!==
undefined
)
{
this
.
allThreadsContinued
=
response
.
body
.
allThreadsContinued
;
}
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
,
this
.
allThreadsContinued
);
return
response
;
})
;
async
continue
(
args
:
DebugProtocol
.
ContinueArguments
):
Promise
<
DebugProtocol
.
ContinueResponse
>
{
const
response
=
await
this
.
send
<
DebugProtocol
.
ContinueResponse
>
(
'
continue
'
,
args
);
if
(
response
&&
response
.
body
&&
response
.
body
.
allThreadsContinued
!==
undefined
)
{
this
.
allThreadsContinued
=
response
.
body
.
allThreadsContinued
;
}
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
,
this
.
allThreadsContinued
);
return
response
;
}
pause
(
args
:
DebugProtocol
.
PauseArguments
):
Promise
<
DebugProtocol
.
PauseResponse
>
{
...
...
@@ -335,12 +330,11 @@ export class RawDebugSession implements IDisposable {
return
Promise
.
reject
(
new
Error
(
'
setVariable not supported
'
));
}
restartFrame
(
args
:
DebugProtocol
.
RestartFrameArguments
,
threadId
:
number
):
Promise
<
DebugProtocol
.
RestartFrameResponse
>
{
async
restartFrame
(
args
:
DebugProtocol
.
RestartFrameArguments
,
threadId
:
number
):
Promise
<
DebugProtocol
.
RestartFrameResponse
>
{
if
(
this
.
capabilities
.
supportsRestartFrame
)
{
return
this
.
send
(
'
restartFrame
'
,
args
).
then
(
response
=>
{
this
.
fireSimulatedContinuedEvent
(
threadId
);
return
response
;
});
const
response
=
await
this
.
send
(
'
restartFrame
'
,
args
);
this
.
fireSimulatedContinuedEvent
(
threadId
);
return
response
;
}
return
Promise
.
reject
(
new
Error
(
'
restartFrame not supported
'
));
}
...
...
@@ -433,26 +427,24 @@ export class RawDebugSession implements IDisposable {
return
this
.
send
<
DebugProtocol
.
EvaluateResponse
>
(
'
evaluate
'
,
args
);
}
stepBack
(
args
:
DebugProtocol
.
StepBackArguments
):
Promise
<
DebugProtocol
.
StepBackResponse
>
{
async
stepBack
(
args
:
DebugProtocol
.
StepBackArguments
):
Promise
<
DebugProtocol
.
StepBackResponse
>
{
if
(
this
.
capabilities
.
supportsStepBack
)
{
return
this
.
send
(
'
stepBack
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
// TODO@AW why this check?
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
});
const
response
=
await
this
.
send
(
'
stepBack
'
,
args
);
if
(
response
.
body
===
undefined
)
{
// TODO@AW why this check?
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
}
return
Promise
.
reject
(
new
Error
(
'
stepBack not supported
'
));
}
reverseContinue
(
args
:
DebugProtocol
.
ReverseContinueArguments
):
Promise
<
DebugProtocol
.
ReverseContinueResponse
>
{
async
reverseContinue
(
args
:
DebugProtocol
.
ReverseContinueArguments
):
Promise
<
DebugProtocol
.
ReverseContinueResponse
>
{
if
(
this
.
capabilities
.
supportsStepBack
)
{
return
this
.
send
(
'
reverseContinue
'
,
args
).
then
(
response
=>
{
if
(
response
.
body
===
undefined
)
{
// TODO@AW why this check?
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
});
const
response
=
await
this
.
send
(
'
reverseContinue
'
,
args
);
if
(
response
.
body
===
undefined
)
{
// TODO@AW why this check?
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
}
return
response
;
}
return
Promise
.
reject
(
new
Error
(
'
reverseContinue not supported
'
));
}
...
...
@@ -464,13 +456,13 @@ export class RawDebugSession implements IDisposable {
return
Promise
.
reject
(
new
Error
(
'
gotoTargets is not supported
'
));
}
goto
(
args
:
DebugProtocol
.
GotoArguments
):
Promise
<
DebugProtocol
.
GotoResponse
>
{
async
goto
(
args
:
DebugProtocol
.
GotoArguments
):
Promise
<
DebugProtocol
.
GotoResponse
>
{
if
(
this
.
capabilities
.
supportsGotoTargetsRequest
)
{
return
this
.
send
(
'
goto
'
,
args
).
then
(
res
=>
{
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
res
;
});
const
response
=
await
this
.
send
(
'
goto
'
,
args
);
this
.
fireSimulatedContinuedEvent
(
args
.
threadId
);
return
response
;
}
return
Promise
.
reject
(
new
Error
(
'
goto is not supported
'
));
}
...
...
@@ -484,36 +476,32 @@ export class RawDebugSession implements IDisposable {
//---- private
private
shutdown
(
error
?:
Error
,
restart
=
false
):
Promise
<
any
>
{
private
async
shutdown
(
error
?:
Error
,
restart
=
false
):
Promise
<
any
>
{
if
(
!
this
.
inShutdown
)
{
this
.
inShutdown
=
true
;
if
(
this
.
debugAdapter
)
{
return
this
.
send
(
'
disconnect
'
,
{
restart
},
undefined
,
500
).
then
(()
=>
{
this
.
stopAdapter
(
error
);
},
()
=>
{
// ignore error
try
{
await
this
.
send
(
'
disconnect
'
,
{
restart
},
undefined
,
500
);
}
finally
{
this
.
stopAdapter
(
error
);
});
}
}
else
{
return
this
.
stopAdapter
(
error
);
}
return
this
.
stopAdapter
(
error
);
}
return
Promise
.
resolve
(
undefined
);
}
private
stopAdapter
(
error
?:
Error
):
Promise
<
any
>
{
if
(
this
.
debugAdapter
)
{
const
da
=
this
.
debugAdapter
;
this
.
debugAdapter
=
null
;
return
da
.
stopSession
().
then
(
_
=>
{
private
async
stopAdapter
(
error
?:
Error
):
Promise
<
any
>
{
try
{
if
(
this
.
debugAdapter
)
{
const
da
=
this
.
debugAdapter
;
this
.
debugAdapter
=
null
;
await
da
.
stopSession
();
this
.
debugAdapterStopped
=
true
;
this
.
fireAdapterExitEvent
(
error
);
},
err
=>
{
this
.
fireAdapterExitEvent
(
error
);
});
}
else
{
}
}
finally
{
this
.
fireAdapterExitEvent
(
error
);
}
return
Promise
.
resolve
(
undefined
);
}
private
fireAdapterExitEvent
(
error
?:
Error
):
void
{
...
...
@@ -557,18 +545,19 @@ export class RawDebugSession implements IDisposable {
});
break
;
case
'
runInTerminal
'
:
dbgr
.
runInTerminal
(
request
.
arguments
as
DebugProtocol
.
RunInTerminalRequestArguments
).
then
(
shellProcessId
=>
{
try
{
const
shellProcessId
=
await
dbgr
.
runInTerminal
(
request
.
arguments
as
DebugProtocol
.
RunInTerminalRequestArguments
);
const
resp
=
response
as
DebugProtocol
.
RunInTerminalResponse
;
resp
.
body
=
{};
if
(
typeof
shellProcessId
===
'
number
'
)
{
resp
.
body
.
shellProcessId
=
shellProcessId
;
}
safeSendResponse
(
resp
);
}
,
err
=>
{
}
catch
(
err
)
{
response
.
success
=
false
;
response
.
message
=
err
.
message
;
safeSendResponse
(
response
);
}
);
}
break
;
default
:
response
.
success
=
false
;
...
...
src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts
浏览文件 @
3cc2460c
...
...
@@ -24,7 +24,6 @@ import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import
{
WorkbenchAsyncDataTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IAsyncDataSource
,
ITreeMouseEvent
,
ITreeContextMenuEvent
,
ITreeDragAndDrop
,
ITreeDragOverReaction
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
IDragAndDropData
}
from
'
vs/base/browser/dnd
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
ElementsDragAndDropData
}
from
'
vs/base/browser/ui/list/listView
'
;
import
{
FuzzyScore
}
from
'
vs/base/common/filters
'
;
import
{
IHighlight
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
...
...
@@ -71,7 +70,7 @@ export class WatchExpressionsView extends ViewletPanel {
dnd
:
new
WatchExpressionsDragAndDrop
(
this
.
debugService
),
});
this
.
tree
.
setInput
(
this
.
debugService
)
.
then
(
undefined
,
onUnexpectedError
)
;
this
.
tree
.
setInput
(
this
.
debugService
);
CONTEXT_WATCH_EXPRESSIONS_FOCUSED
.
bindTo
(
this
.
tree
.
contextKeyService
);
if
(
this
.
toolbar
)
{
...
...
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
3cc2460c
...
...
@@ -114,13 +114,16 @@ export class ExpressionContainer implements IExpressionContainer {
return
!!
this
.
reference
&&
this
.
reference
>
0
;
}
private
fetchVariables
(
start
:
number
|
undefined
,
count
:
number
|
undefined
,
filter
:
'
indexed
'
|
'
named
'
|
undefined
):
Promise
<
Variable
[]
>
{
return
this
.
session
!
.
variables
(
this
.
reference
||
0
,
this
.
threadId
,
filter
,
start
,
count
).
then
(
response
=>
{
private
async
fetchVariables
(
start
:
number
|
undefined
,
count
:
number
|
undefined
,
filter
:
'
indexed
'
|
'
named
'
|
undefined
):
Promise
<
Variable
[]
>
{
try
{
const
response
=
await
this
.
session
!
.
variables
(
this
.
reference
||
0
,
this
.
threadId
,
filter
,
start
,
count
);
return
response
&&
response
.
body
&&
response
.
body
.
variables
?
distinct
(
response
.
body
.
variables
.
filter
(
v
=>
!!
v
&&
isString
(
v
.
name
)),
(
v
:
DebugProtocol
.
Variable
)
=>
v
.
name
).
map
((
v
:
DebugProtocol
.
Variable
)
=>
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
v
.
variablesReference
,
v
.
name
,
v
.
evaluateName
,
v
.
value
,
v
.
namedVariables
,
v
.
indexedVariables
,
v
.
presentationHint
,
v
.
type
))
:
[];
},
(
e
:
Error
)
=>
[
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
e
.
message
,
e
.
message
,
''
,
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
false
)]);
}
catch
(
e
)
{
return
[
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
e
.
message
,
e
.
message
,
''
,
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
false
)];
}
}
// The adapter explicitly sents the children count of an expression only if there are lots of children which should be chunked.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录