Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5c191f36
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,发现更多精彩内容 >>
提交
5c191f36
编写于
3月 07, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
strictNullChecks: debugEditorActions
上级
0d9f226b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
40 deletion
+58
-40
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
+57
-40
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
5c191f36
...
...
@@ -242,6 +242,7 @@
"./vs/workbench/contrib/debug/browser/debugActions.ts"
,
"./vs/workbench/contrib/debug/browser/debugCommands.ts"
,
"./vs/workbench/contrib/debug/browser/debugContentProvider.ts"
,
"./vs/workbench/contrib/debug/browser/debugEditorActions.ts"
,
"./vs/workbench/contrib/debug/browser/debugStatus.ts"
,
"./vs/workbench/contrib/debug/browser/exceptionWidget.ts"
,
"./vs/workbench/contrib/debug/browser/linkDetector.ts"
,
...
...
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
浏览文件 @
5c191f36
...
...
@@ -39,14 +39,16 @@ class ToggleBreakpointAction extends EditorAction {
const
debugService
=
accessor
.
get
(
IDebugService
);
const
position
=
editor
.
getPosition
();
const
modelUri
=
editor
.
getModel
().
uri
;
const
bps
=
debugService
.
getModel
().
getBreakpoints
({
lineNumber
:
position
.
lineNumber
,
uri
:
modelUri
});
if
(
editor
.
hasModel
()
&&
position
)
{
const
modelUri
=
editor
.
getModel
().
uri
;
const
bps
=
debugService
.
getModel
().
getBreakpoints
({
lineNumber
:
position
.
lineNumber
,
uri
:
modelUri
});
if
(
bps
.
length
)
{
return
Promise
.
all
(
bps
.
map
(
bp
=>
debugService
.
removeBreakpoints
(
bp
.
getId
())));
}
if
(
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
return
debugService
.
addBreakpoints
(
modelUri
,
[{
lineNumber
:
position
.
lineNumber
}],
'
debugEditorActions.toggleBreakpointAction
'
);
if
(
bps
.
length
)
{
return
Promise
.
all
(
bps
.
map
(
bp
=>
debugService
.
removeBreakpoints
(
bp
.
getId
())));
}
if
(
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
return
debugService
.
addBreakpoints
(
modelUri
,
[{
lineNumber
:
position
.
lineNumber
}],
'
debugEditorActions.toggleBreakpointAction
'
);
}
}
return
Promise
.
resolve
();
...
...
@@ -68,9 +70,9 @@ class ConditionalBreakpointAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
{
lineNumber
,
column
}
=
editor
.
getPosition
();
if
(
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
editor
.
getContribution
<
IDebugEditorContribution
>
(
EDITOR_CONTRIBUTION_ID
).
showBreakpointWidget
(
lineNumber
,
column
);
const
position
=
editor
.
getPosition
();
if
(
position
&&
editor
.
hasModel
()
&&
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
editor
.
getContribution
<
IDebugEditorContribution
>
(
EDITOR_CONTRIBUTION_ID
).
showBreakpointWidget
(
position
.
lineNumber
,
position
.
column
);
}
}
}
...
...
@@ -90,9 +92,9 @@ class LogPointAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
{
lineNumber
,
column
}
=
editor
.
getPosition
();
if
(
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
editor
.
getContribution
<
IDebugEditorContribution
>
(
EDITOR_CONTRIBUTION_ID
).
showBreakpointWidget
(
lineNumber
,
column
,
BreakpointWidgetContext
.
LOG_MESSAGE
);
const
position
=
editor
.
getPosition
();
if
(
position
&&
editor
.
hasModel
()
&&
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
editor
.
getModel
()))
{
editor
.
getContribution
<
IDebugEditorContribution
>
(
EDITOR_CONTRIBUTION_ID
).
showBreakpointWidget
(
position
.
lineNumber
,
position
.
column
,
BreakpointWidgetContext
.
LOG_MESSAGE
);
}
}
}
...
...
@@ -134,13 +136,17 @@ class RunToCursorAction extends EditorAction {
});
const
position
=
editor
.
getPosition
();
if
(
!
editor
.
hasModel
()
||
!
position
)
{
return
Promise
.
resolve
();
}
const
uri
=
editor
.
getModel
().
uri
;
const
bpExists
=
!!
(
debugService
.
getModel
().
getBreakpoints
({
column
:
position
.
column
,
lineNumber
:
position
.
lineNumber
,
uri
}).
length
);
return
(
bpExists
?
Promise
.
resolve
(
null
)
:
<
Promise
<
any
>>
debugService
.
addBreakpoints
(
uri
,
[{
lineNumber
:
position
.
lineNumber
,
column
:
position
.
column
}],
'
debugEditorActions.runToCursorAction
'
)).
then
((
breakpoints
)
=>
{
if
(
breakpoints
&&
breakpoints
.
length
)
{
breakpointToRemove
=
breakpoints
[
0
];
}
debugService
.
getViewModel
().
focusedThread
.
continue
();
debugService
.
getViewModel
().
focusedThread
!
.
continue
();
});
}
}
...
...
@@ -163,11 +169,14 @@ class SelectionToReplAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
panelService
=
accessor
.
get
(
IPanelService
);
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
const
viewModel
=
debugService
.
getViewModel
();
const
session
=
viewModel
.
focusedSession
;
return
session
.
addReplExpression
(
viewModel
.
focusedStackFrame
,
text
)
if
(
!
editor
.
hasModel
()
||
!
session
)
{
return
Promise
.
resolve
();
}
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
return
session
.
addReplExpression
(
viewModel
.
focusedStackFrame
!
,
text
)
.
then
(()
=>
panelService
.
openPanel
(
REPL_ID
,
true
))
.
then
(
_
=>
undefined
);
}
...
...
@@ -191,6 +200,9 @@ class SelectionToWatchExpressionsAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
viewletService
=
accessor
.
get
(
IViewletService
);
if
(
!
editor
.
hasModel
())
{
return
Promise
.
resolve
();
}
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
return
viewletService
.
openViewlet
(
VIEWLET_ID
).
then
(()
=>
debugService
.
addWatchExpression
(
text
));
...
...
@@ -215,6 +227,9 @@ class ShowDebugHoverAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
const
position
=
editor
.
getPosition
();
if
(
!
position
||
!
editor
.
hasModel
())
{
return
Promise
.
resolve
();
}
const
word
=
editor
.
getModel
().
getWordAtPosition
(
position
);
if
(
!
word
)
{
return
Promise
.
resolve
();
...
...
@@ -233,32 +248,34 @@ class GoToBreakpointAction extends EditorAction {
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
,
args
:
any
):
Promise
<
any
>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
editorService
=
accessor
.
get
(
IEditorService
);
const
currentUri
=
editor
.
getModel
().
uri
;
const
currentLine
=
editor
.
getPosition
().
lineNumber
;
//Breakpoints returned from `getBreakpoints` are already sorted.
const
allEnabledBreakpoints
=
debugService
.
getModel
().
getBreakpoints
({
enabledOnly
:
true
});
//Try to find breakpoint in current file
let
moveBreakpoint
=
this
.
isNext
?
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
===
currentUri
.
toString
()
&&
bp
.
lineNumber
>
currentLine
).
shift
()
:
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
===
currentUri
.
toString
()
&&
bp
.
lineNumber
<
currentLine
).
pop
();
//Try to find breakpoints in following files
if
(
!
moveBreakpoint
)
{
moveBreakpoint
=
if
(
editor
.
hasModel
())
{
const
currentUri
=
editor
.
getModel
().
uri
;
const
currentLine
=
editor
.
getPosition
().
lineNumber
;
//Breakpoints returned from `getBreakpoints` are already sorted.
const
allEnabledBreakpoints
=
debugService
.
getModel
().
getBreakpoints
({
enabledOnly
:
true
});
//Try to find breakpoint in current file
let
moveBreakpoint
=
this
.
isNext
?
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
>
currentUri
.
toString
()).
shift
()
:
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
<
currentUri
.
toString
()).
pop
();
}
?
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
===
currentUri
.
toString
()
&&
bp
.
lineNumber
>
currentLine
).
shift
()
:
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
===
currentUri
.
toString
()
&&
bp
.
lineNumber
<
currentLine
).
pop
();
//Try to find breakpoints in following files
if
(
!
moveBreakpoint
)
{
moveBreakpoint
=
this
.
isNext
?
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
>
currentUri
.
toString
()).
shift
()
:
allEnabledBreakpoints
.
filter
(
bp
=>
bp
.
uri
.
toString
()
<
currentUri
.
toString
()).
pop
();
}
//Move to first or last possible breakpoint
if
(
!
moveBreakpoint
&&
allEnabledBreakpoints
.
length
)
{
moveBreakpoint
=
this
.
isNext
?
allEnabledBreakpoints
[
0
]
:
allEnabledBreakpoints
[
allEnabledBreakpoints
.
length
-
1
];
}
//Move to first or last possible breakpoint
if
(
!
moveBreakpoint
&&
allEnabledBreakpoints
.
length
)
{
moveBreakpoint
=
this
.
isNext
?
allEnabledBreakpoints
[
0
]
:
allEnabledBreakpoints
[
allEnabledBreakpoints
.
length
-
1
];
}
if
(
moveBreakpoint
)
{
return
openBreakpointSource
(
moveBreakpoint
,
false
,
true
,
debugService
,
editorService
);
if
(
moveBreakpoint
)
{
return
openBreakpointSource
(
moveBreakpoint
,
false
,
true
,
debugService
,
editorService
);
}
}
return
Promise
.
resolve
(
null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录