Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ed193fcb
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,发现更多精彩内容 >>
提交
ed193fcb
编写于
10月 15, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: more async await
上级
3bbd6bfd
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
39 addition
and
41 deletion
+39
-41
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
...orkbench/contrib/debug/browser/debugEditorContribution.ts
+28
-28
src/vs/workbench/contrib/debug/browser/variablesView.ts
src/vs/workbench/contrib/debug/browser/variablesView.ts
+11
-13
未找到文件。
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
浏览文件 @
ed193fcb
...
...
@@ -98,7 +98,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
this
.
wordToLineNumbersMap
=
undefined
;
this
.
updateInlineValuesScheduler
.
schedule
();
}));
this
.
toDispose
.
push
(
this
.
editor
.
onDidChangeModel
(()
=>
{
this
.
toDispose
.
push
(
this
.
editor
.
onDidChangeModel
(
async
()
=>
{
const
stackFrame
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
const
model
=
this
.
editor
.
getModel
();
if
(
model
)
{
...
...
@@ -108,7 +108,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
this
.
hideHoverWidget
();
this
.
updateConfigurationWidgetVisibility
();
this
.
wordToLineNumbersMap
=
undefined
;
this
.
updateInlineValueDecorations
(
stackFrame
);
await
this
.
updateInlineValueDecorations
(
stackFrame
);
}));
this
.
toDispose
.
push
(
this
.
editor
.
onDidScrollChange
(()
=>
this
.
hideHoverWidget
));
this
.
toDispose
.
push
(
this
.
debugService
.
onDidChangeState
((
state
:
State
)
=>
{
...
...
@@ -155,18 +155,18 @@ class DebugEditorContribution implements IDebugEditorContribution {
return
Promise
.
resolve
();
}
private
onFocusStackFrame
(
sf
:
IStackFrame
|
undefined
):
void
{
private
async
onFocusStackFrame
(
sf
:
IStackFrame
|
undefined
):
Promise
<
void
>
{
const
model
=
this
.
editor
.
getModel
();
if
(
model
)
{
this
.
_applyHoverConfiguration
(
model
,
sf
);
if
(
sf
&&
sf
.
source
.
uri
.
toString
()
===
model
.
uri
.
toString
())
{
this
.
toggleExceptionWidget
();
await
this
.
toggleExceptionWidget
();
}
else
{
this
.
hideHoverWidget
();
}
}
this
.
updateInlineValueDecorations
(
sf
);
await
this
.
updateInlineValueDecorations
(
sf
);
}
@
memoize
...
...
@@ -261,7 +261,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
// end hover business
// exception widget
private
toggleExceptionWidget
():
void
{
private
async
toggleExceptionWidget
():
Promise
<
void
>
{
// Toggles exception widget based on the state of the current editor model and debug stack frame
const
model
=
this
.
editor
.
getModel
();
const
focusedSf
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
...
...
@@ -282,11 +282,10 @@ class DebugEditorContribution implements IDebugEditorContribution {
if
(
this
.
exceptionWidget
&&
!
sameUri
)
{
this
.
closeExceptionWidget
();
}
else
if
(
sameUri
)
{
focusedSf
.
thread
.
exceptionInfo
.
then
(
exceptionInfo
=>
{
const
exceptionInfo
=
await
focusedSf
.
thread
.
exceptionInfo
;
if
(
exceptionInfo
&&
exceptionSf
.
range
.
startLineNumber
&&
exceptionSf
.
range
.
startColumn
)
{
this
.
showExceptionWidget
(
exceptionInfo
,
this
.
debugService
.
getViewModel
().
focusedSession
,
exceptionSf
.
range
.
startLineNumber
,
exceptionSf
.
range
.
startColumn
);
}
});
}
}
...
...
@@ -320,7 +319,7 @@ class DebugEditorContribution implements IDebugEditorContribution {
}
}
addLaunchConfiguration
():
Promise
<
any
>
{
a
sync
a
ddLaunchConfiguration
():
Promise
<
any
>
{
/* __GDPR__
"debug/addLaunchConfiguration" : {}
*/
...
...
@@ -364,7 +363,8 @@ class DebugEditorContribution implements IDebugEditorContribution {
return
this
.
commandService
.
executeCommand
(
'
editor.action.insertLineAfter
'
);
};
return
insertLine
(
configurationsArrayPosition
).
then
(()
=>
this
.
commandService
.
executeCommand
(
'
editor.action.triggerSuggest
'
));
await
insertLine
(
configurationsArrayPosition
);
await
this
.
commandService
.
executeCommand
(
'
editor.action.triggerSuggest
'
);
}
// Inline Decorations
...
...
@@ -380,12 +380,12 @@ class DebugEditorContribution implements IDebugEditorContribution {
@
memoize
private
get
updateInlineValuesScheduler
():
RunOnceScheduler
{
return
new
RunOnceScheduler
(
()
=>
this
.
updateInlineValueDecorations
(
this
.
debugService
.
getViewModel
().
focusedStackFrame
),
async
()
=>
await
this
.
updateInlineValueDecorations
(
this
.
debugService
.
getViewModel
().
focusedStackFrame
),
200
);
}
private
updateInlineValueDecorations
(
stackFrame
:
IStackFrame
|
undefined
):
void
{
private
async
updateInlineValueDecorations
(
stackFrame
:
IStackFrame
|
undefined
):
Promise
<
void
>
{
const
model
=
this
.
editor
.
getModel
();
if
(
!
this
.
configurationService
.
getValue
<
IDebugConfiguration
>
(
'
debug
'
).
inlineValues
||
!
model
||
!
stackFrame
||
model
.
uri
.
toString
()
!==
stackFrame
.
source
.
uri
.
toString
())
{
...
...
@@ -397,20 +397,20 @@ class DebugEditorContribution implements IDebugEditorContribution {
this
.
removeInlineValuesScheduler
.
cancel
();
stackFrame
.
getMostSpecificScopes
(
stackFrame
.
range
)
const
scopes
=
await
stackFrame
.
getMostSpecificScopes
(
stackFrame
.
range
);
// Get all top level children in the scope chain
.
then
(
scopes
=>
Promise
.
all
(
scopes
.
map
(
scope
=>
scope
.
getChildren
()
.
then
(
children
=>
{
const
decorationsPerScope
=
await
Promise
.
all
(
scopes
.
map
(
async
scope
=>
{
const
children
=
await
scope
.
getChildren
();
let
range
=
new
Range
(
0
,
0
,
stackFrame
.
range
.
startLineNumber
,
stackFrame
.
range
.
startColumn
);
if
(
scope
.
range
)
{
range
=
range
.
setStartPosition
(
scope
.
range
.
startLineNumber
,
scope
.
range
.
startColumn
);
}
return
this
.
createInlineValueDecorationsInsideRange
(
children
,
range
,
model
);
}))).
then
(
decorationsPerScope
=>
{
}));
const
allDecorations
=
decorationsPerScope
.
reduce
((
previous
,
current
)
=>
previous
.
concat
(
current
),
[]);
this
.
editor
.
setDecorations
(
INLINE_VALUE_DECORATION_KEY
,
allDecorations
);
}));
}
private
createInlineValueDecorationsInsideRange
(
expressions
:
ReadonlyArray
<
IExpression
>
,
range
:
Range
,
model
:
ITextModel
):
IDecorationOptions
[]
{
...
...
src/vs/workbench/contrib/debug/browser/variablesView.ts
浏览文件 @
ed193fcb
...
...
@@ -25,7 +25,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
WorkbenchAsyncDataTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IAsyncDataTreeViewState
}
from
'
vs/base/browser/ui/tree/asyncDataTree
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
FuzzyScore
,
createMatches
}
from
'
vs/base/common/filters
'
;
import
{
HighlightedLabel
,
IHighlight
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
...
...
@@ -57,28 +56,27 @@ export class VariablesView extends ViewletPanel {
super
({
...(
options
as
IViewletPanelOptions
),
ariaHeaderLabel
:
nls
.
localize
(
'
variablesSection
'
,
"
Variables Section
"
)
},
keybindingService
,
contextMenuService
,
configurationService
,
contextKeyService
);
// Use scheduler to prevent unnecessary flashing
this
.
onFocusStackFrameScheduler
=
new
RunOnceScheduler
(()
=>
{
this
.
onFocusStackFrameScheduler
=
new
RunOnceScheduler
(
async
()
=>
{
const
stackFrame
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
this
.
needsRefresh
=
false
;
if
(
stackFrame
&&
this
.
savedViewState
)
{
this
.
tree
.
setInput
(
this
.
debugService
.
getViewModel
(),
this
.
savedViewState
).
then
(
null
,
onUnexpectedError
);
await
this
.
tree
.
setInput
(
this
.
debugService
.
getViewModel
(),
this
.
savedViewState
);
this
.
savedViewState
=
undefined
;
}
else
{
if
(
!
stackFrame
)
{
// We have no stackFrame, save tree state before it is cleared
this
.
savedViewState
=
this
.
tree
.
getViewState
();
}
this
.
tree
.
updateChildren
().
then
(()
=>
{
await
this
.
tree
.
updateChildren
();
if
(
stackFrame
)
{
stackFrame
.
getScopes
().
then
(
scopes
=>
{
const
scopes
=
await
stackFrame
.
getScopes
();
// Expand the first scope if it is not expensive and if there is no expansion state (all are collapsed)
if
(
scopes
.
every
(
s
=>
this
.
tree
.
getNode
(
s
).
collapsed
)
&&
scopes
.
length
>
0
&&
!
scopes
[
0
].
expensive
)
{
this
.
tree
.
expand
(
scopes
[
0
]).
then
(
undefined
,
onUnexpectedError
);
this
.
tree
.
expand
(
scopes
[
0
]
);
}
});
}
},
onUnexpectedError
);
}
},
400
);
}
...
...
@@ -96,7 +94,7 @@ export class VariablesView extends ViewletPanel {
keyboardNavigationLabelProvider
:
{
getKeyboardNavigationLabel
:
(
e
:
IExpression
|
IScope
)
=>
e
}
});
this
.
tree
.
setInput
(
this
.
debugService
.
getViewModel
())
.
then
(
null
,
onUnexpectedError
)
;
this
.
tree
.
setInput
(
this
.
debugService
.
getViewModel
());
CONTEXT_VARIABLES_FOCUSED
.
bindTo
(
this
.
tree
.
contextKeyService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录