Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a9f66e01
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,发现更多精彩内容 >>
提交
a9f66e01
编写于
10月 15, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug more asyn await
上级
017e7dfb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
49 deletion
+38
-49
src/vs/workbench/contrib/debug/browser/debugActions.ts
src/vs/workbench/contrib/debug/browser/debugActions.ts
+6
-11
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
+8
-12
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
...orkbench/contrib/debug/browser/debugEditorContribution.ts
+3
-5
src/vs/workbench/contrib/debug/browser/repl.ts
src/vs/workbench/contrib/debug/browser/repl.ts
+14
-15
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+7
-5
src/vs/workbench/contrib/debug/node/debugAdapter.ts
src/vs/workbench/contrib/debug/node/debugAdapter.ts
+0
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debugActions.ts
浏览文件 @
a9f66e01
...
...
@@ -83,10 +83,10 @@ export class ConfigureAction extends AbstractDebugAction {
this
.
class
=
configurationCount
>
0
?
'
debug-action configure
'
:
'
debug-action configure notification
'
;
}
run
(
event
?:
any
):
Promise
<
any
>
{
async
run
(
event
?:
any
):
Promise
<
any
>
{
if
(
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
)
{
this
.
notificationService
.
info
(
nls
.
localize
(
'
noFolderDebugConfig
'
,
"
Please first open a folder in order to do advanced debug configuration.
"
));
return
Promise
.
resolve
()
;
return
;
}
const
sideBySide
=
!!
(
event
&&
(
event
.
ctrlKey
||
event
.
metaKey
));
...
...
@@ -295,9 +295,8 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction {
this
.
_register
(
this
.
debugService
.
getModel
().
onDidChangeBreakpoints
(()
=>
this
.
updateEnablement
()));
}
run
():
Promise
<
any
>
{
async
run
():
Promise
<
any
>
{
this
.
debugService
.
addFunctionBreakpoint
();
return
Promise
.
resolve
();
}
protected
isEnabled
(
_
:
State
):
boolean
{
...
...
@@ -316,9 +315,8 @@ export class AddWatchExpressionAction extends AbstractDebugAction {
this
.
_register
(
this
.
debugService
.
getViewModel
().
onDidSelectExpression
(()
=>
this
.
updateEnablement
()));
}
run
():
Promise
<
any
>
{
async
run
():
Promise
<
any
>
{
this
.
debugService
.
addWatchExpression
();
return
Promise
.
resolve
(
undefined
);
}
protected
isEnabled
(
_
:
State
):
boolean
{
...
...
@@ -336,9 +334,8 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
this
.
_register
(
this
.
debugService
.
getModel
().
onDidChangeWatchExpressions
(()
=>
this
.
updateEnablement
()));
}
run
():
Promise
<
any
>
{
async
run
():
Promise
<
any
>
{
this
.
debugService
.
removeWatchExpressions
();
return
Promise
.
resolve
();
}
protected
isEnabled
(
_
:
State
):
boolean
{
...
...
@@ -362,10 +359,8 @@ export class FocusSessionAction extends AbstractDebugAction {
await
this
.
debugService
.
focusStackFrame
(
undefined
,
undefined
,
session
,
true
);
const
stackFrame
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
if
(
stackFrame
)
{
return
stackFrame
.
openInEditor
(
this
.
editorService
,
true
);
await
stackFrame
.
openInEditor
(
this
.
editorService
,
true
);
}
return
Promise
.
resolve
(
undefined
);
}
}
...
...
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
浏览文件 @
a9f66e01
...
...
@@ -34,7 +34,7 @@ class ToggleBreakpointAction extends EditorAction {
});
}
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
any
>
{
async
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
any
>
{
if
(
editor
.
hasModel
())
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
modelUri
=
editor
.
getModel
().
uri
;
...
...
@@ -49,12 +49,10 @@ class ToggleBreakpointAction extends EditorAction {
}
else
if
(
canSet
)
{
return
(
debugService
.
addBreakpoints
(
modelUri
,
[{
lineNumber
:
line
}],
'
debugEditorActions.toggleBreakpointAction
'
));
}
else
{
return
Promise
.
resolve
([])
;
return
[]
;
}
}));
}
return
Promise
.
resolve
();
}
}
...
...
@@ -175,7 +173,7 @@ class SelectionToReplAction extends EditorAction {
const
viewModel
=
debugService
.
getViewModel
();
const
session
=
viewModel
.
focusedSession
;
if
(
!
editor
.
hasModel
()
||
!
session
)
{
return
Promise
.
resolve
()
;
return
;
}
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
...
...
@@ -203,7 +201,7 @@ class SelectionToWatchExpressionsAction extends EditorAction {
const
debugService
=
accessor
.
get
(
IDebugService
);
const
viewletService
=
accessor
.
get
(
IViewletService
);
if
(
!
editor
.
hasModel
())
{
return
Promise
.
resolve
()
;
return
;
}
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
...
...
@@ -228,14 +226,14 @@ class ShowDebugHoverAction extends EditorAction {
});
}
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
async
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
const
position
=
editor
.
getPosition
();
if
(
!
position
||
!
editor
.
hasModel
())
{
return
Promise
.
resolve
()
;
return
;
}
const
word
=
editor
.
getModel
().
getWordAtPosition
(
position
);
if
(
!
word
)
{
return
Promise
.
resolve
()
;
return
;
}
const
range
=
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
word
.
endColumn
);
...
...
@@ -248,7 +246,7 @@ class GoToBreakpointAction extends EditorAction {
super
(
opts
);
}
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
,
args
:
any
):
Promise
<
any
>
{
async
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
any
>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
if
(
editor
.
hasModel
())
{
...
...
@@ -280,8 +278,6 @@ class GoToBreakpointAction extends EditorAction {
return
openBreakpointSource
(
moveBreakpoint
,
false
,
true
,
debugService
,
editorService
);
}
}
return
Promise
.
resolve
(
null
);
}
}
...
...
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
浏览文件 @
a9f66e01
...
...
@@ -145,14 +145,12 @@ class DebugEditorContribution implements IDebugEditorContribution {
return
EDITOR_CONTRIBUTION_ID
;
}
showHover
(
range
:
Range
,
focus
:
boolean
):
Promise
<
void
>
{
async
showHover
(
range
:
Range
,
focus
:
boolean
):
Promise
<
void
>
{
const
sf
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
const
model
=
this
.
editor
.
getModel
();
if
(
sf
&&
model
&&
sf
.
source
.
uri
.
toString
()
===
model
.
uri
.
toString
())
{
return
this
.
hoverWidget
.
showAt
(
range
,
focus
);
}
return
Promise
.
resolve
();
}
private
async
onFocusStackFrame
(
sf
:
IStackFrame
|
undefined
):
Promise
<
void
>
{
...
...
@@ -327,7 +325,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
let
configurationsArrayPosition
:
Position
|
undefined
;
const
model
=
this
.
editor
.
getModel
();
if
(
!
model
)
{
return
Promise
.
resolve
()
;
return
;
}
let
depthInArray
=
0
;
...
...
@@ -350,7 +348,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
this
.
editor
.
focus
();
if
(
!
configurationsArrayPosition
)
{
return
Promise
.
resolve
()
;
return
;
}
const
insertLine
=
(
position
:
Position
):
Promise
<
any
>
=>
{
...
...
src/vs/workbench/contrib/debug/browser/repl.ts
浏览文件 @
a9f66e01
...
...
@@ -74,8 +74,8 @@ interface IPrivateReplService {
_serviceBrand
:
undefined
;
acceptReplInput
():
void
;
getVisibleContent
():
string
;
selectSession
(
session
?:
IDebugSession
):
void
;
clearRepl
():
void
;
selectSession
(
session
?:
IDebugSession
):
Promise
<
void
>
;
clearRepl
():
Promise
<
void
>
;
focusRepl
():
void
;
}
...
...
@@ -129,7 +129,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
}
private
registerListeners
():
void
{
this
.
_register
(
this
.
debugService
.
getViewModel
().
onDidFocusSession
(
session
=>
{
this
.
_register
(
this
.
debugService
.
getViewModel
().
onDidFocusSession
(
async
session
=>
{
if
(
session
)
{
sessionsToIgnore
.
delete
(
session
);
if
(
this
.
completionItemProvider
)
{
...
...
@@ -159,13 +159,13 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
}
}
this
.
selectSession
();
await
this
.
selectSession
();
}));
this
.
_register
(
this
.
debugService
.
onWillNewSession
(
newSession
=>
{
this
.
_register
(
this
.
debugService
.
onWillNewSession
(
async
newSession
=>
{
// Need to listen to output events for sessions which are not yet fully initialised
const
input
=
this
.
tree
.
getInput
();
if
(
!
input
||
input
.
state
===
State
.
Inactive
)
{
this
.
selectSession
(
newSession
);
await
this
.
selectSession
(
newSession
);
}
this
.
updateTitleArea
();
}));
...
...
@@ -252,7 +252,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
}
}
selectSession
(
session
?:
IDebugSession
):
void
{
async
selectSession
(
session
?:
IDebugSession
):
Promise
<
void
>
{
const
treeInput
=
this
.
tree
.
getInput
();
if
(
!
session
)
{
const
focusedSession
=
this
.
debugService
.
getViewModel
().
focusedSession
;
...
...
@@ -272,7 +272,8 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
});
if
(
this
.
tree
&&
treeInput
!==
session
)
{
this
.
tree
.
setInput
(
session
).
then
(()
=>
revealLastElement
(
this
.
tree
)).
then
(
undefined
,
errors
.
onUnexpectedError
);
await
this
.
tree
.
setInput
(
session
);
revealLastElement
(
this
.
tree
);
}
}
...
...
@@ -280,14 +281,14 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this
.
updateInputDecoration
();
}
clearRepl
():
void
{
async
clearRepl
():
Promise
<
void
>
{
const
session
=
this
.
tree
.
getInput
();
if
(
session
)
{
session
.
removeReplExpressions
();
if
(
session
.
state
===
State
.
Inactive
)
{
// Ignore inactive sessions which got cleared - so they are not shown any more
sessionsToIgnore
.
add
(
session
);
this
.
selectSession
();
await
this
.
selectSession
();
this
.
updateTitleArea
();
}
}
...
...
@@ -998,7 +999,7 @@ class SelectReplAction extends Action {
if
(
session
&&
session
.
state
!==
State
.
Inactive
&&
session
!==
this
.
debugService
.
getViewModel
().
focusedSession
)
{
await
this
.
debugService
.
focusStackFrame
(
undefined
,
undefined
,
session
,
true
);
}
else
{
this
.
replService
.
selectSession
(
session
);
await
this
.
replService
.
selectSession
(
session
);
}
return
Promise
.
resolve
(
undefined
);
...
...
@@ -1015,11 +1016,9 @@ export class ClearReplAction extends Action {
super
(
id
,
label
,
'
debug-action codicon-clear-all
'
);
}
run
():
Promise
<
any
>
{
async
run
():
Promise
<
any
>
{
const
repl
=
<
Repl
>
this
.
panelService
.
openPanel
(
REPL_ID
);
repl
.
clearRepl
();
await
repl
.
clearRepl
();
aria
.
status
(
nls
.
localize
(
'
debugConsoleCleared
'
,
"
Debug console was cleared
"
));
return
Promise
.
resolve
(
undefined
);
}
}
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
a9f66e01
...
...
@@ -65,7 +65,7 @@ export class ExpressionContainer implements IExpressionContainer {
private
async
doGetChildren
():
Promise
<
IExpression
[]
>
{
if
(
!
this
.
hasChildren
)
{
return
Promise
.
resolve
([])
;
return
[]
;
}
if
(
!
this
.
getChildrenInChunks
)
{
...
...
@@ -224,7 +224,7 @@ export class Variable extends ExpressionContainer implements IExpression {
async
setVariable
(
value
:
string
):
Promise
<
any
>
{
if
(
!
this
.
session
)
{
return
Promise
.
resolve
(
undefined
)
;
return
;
}
try
{
...
...
@@ -345,9 +345,11 @@ export class StackFrame implements IStackFrame {
return
sourceToString
===
UNKNOWN_SOURCE_LABEL
?
this
.
name
:
`
${
this
.
name
}
(
${
sourceToString
}
)`
;
}
openInEditor
(
editorService
:
IEditorService
,
preserveFocus
?:
boolean
,
sideBySide
?:
boolean
,
pinned
?:
boolean
):
Promise
<
ITextEditor
|
undefined
>
{
return
!
this
.
source
.
available
?
Promise
.
resolve
(
undefined
)
:
this
.
source
.
openInEditor
(
editorService
,
this
.
range
,
preserveFocus
,
sideBySide
,
pinned
);
async
openInEditor
(
editorService
:
IEditorService
,
preserveFocus
?:
boolean
,
sideBySide
?:
boolean
,
pinned
?:
boolean
):
Promise
<
ITextEditor
|
undefined
>
{
if
(
this
.
source
.
available
)
{
return
this
.
source
.
openInEditor
(
editorService
,
this
.
range
,
preserveFocus
,
sideBySide
,
pinned
);
}
return
undefined
;
}
equals
(
other
:
IStackFrame
):
boolean
{
...
...
src/vs/workbench/contrib/debug/node/debugAdapter.ts
浏览文件 @
a9f66e01
...
...
@@ -133,7 +133,6 @@ export class SocketDebugAdapter extends StreamDebugAdapter {
this
.
socket
.
end
();
this
.
socket
=
undefined
;
}
return
Promise
.
resolve
(
undefined
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录