Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
57db1cf6
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,发现更多精彩内容 >>
提交
57db1cf6
编写于
4月 19, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug polish: addBreakpoints instead of toggle
上级
7a0b01b2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
42 deletion
+43
-42
src/vs/workbench/parts/debug/browser/breakpointWidget.ts
src/vs/workbench/parts/debug/browser/breakpointWidget.ts
+5
-3
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
.../workbench/parts/debug/browser/debugEditorContribution.ts
+9
-2
src/vs/workbench/parts/debug/browser/debugViewer.ts
src/vs/workbench/parts/debug/browser/debugViewer.ts
+1
-3
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/debugActions.ts
...vs/workbench/parts/debug/electron-browser/debugActions.ts
+18
-20
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+7
-11
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
+1
-1
未找到文件。
src/vs/workbench/parts/debug/browser/breakpointWidget.ts
浏览文件 @
57db1cf6
...
...
@@ -88,11 +88,13 @@ export class BreakpointWidget extends ZoneWidget {
};
// if there is already a breakpoint on this location - remove it.
if
(
this
.
debugService
.
getModel
().
getBreakpoints
().
some
(
bp
=>
bp
.
lineNumber
===
this
.
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
uri
.
toString
()))
{
this
.
debugService
.
toggleBreakpoint
(
raw
).
done
(
null
,
errors
.
onUnexpectedError
);
const
oldBreakpoint
=
this
.
debugService
.
getModel
().
getBreakpoints
()
.
filter
(
bp
=>
bp
.
lineNumber
===
this
.
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
uri
.
toString
()).
pop
();
if
(
oldBreakpoint
)
{
this
.
debugService
.
removeBreakpoints
(
oldBreakpoint
.
getId
()).
done
(
null
,
errors
.
onUnexpectedError
);
}
this
.
debugService
.
toggleBreakpoint
(
raw
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
debugService
.
addBreakpoints
([
raw
]
).
done
(
null
,
errors
.
onUnexpectedError
);
}
this
.
dispose
();
...
...
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
浏览文件 @
57db1cf6
...
...
@@ -64,7 +64,7 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
nls
.
localize
(
'
addBreakpoint
'
,
"
Add Breakpoint
"
),
null
,
true
,
()
=>
this
.
debugService
.
toggleBreakpoint
({
uri
,
lineNumber
}
)
()
=>
this
.
debugService
.
addBreakpoints
([{
uri
,
lineNumber
}]
)
));
actions
.
push
(
this
.
instantiationService
.
createInstance
(
debugactions
.
AddConditionalBreakpointAction
,
debugactions
.
AddConditionalBreakpointAction
.
ID
,
debugactions
.
AddConditionalBreakpointAction
.
LABEL
,
this
.
editor
,
lineNumber
));
}
...
...
@@ -94,7 +94,14 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
getActionsContext
:
()
=>
breakpoint
});
}
else
{
this
.
debugService
.
toggleBreakpoint
({
uri
,
lineNumber
});
const
breakpoint
=
this
.
debugService
.
getModel
().
getBreakpoints
()
.
filter
(
bp
=>
bp
.
source
.
uri
.
toString
()
===
uri
.
toString
()
&&
bp
.
lineNumber
===
lineNumber
).
pop
();
if
(
breakpoint
)
{
this
.
debugService
.
removeBreakpoints
(
breakpoint
.
getId
());
}
else
{
this
.
debugService
.
addBreakpoints
([{
uri
,
lineNumber
}]);
}
}
}));
...
...
src/vs/workbench/parts/debug/browser/debugViewer.ts
浏览文件 @
57db1cf6
...
...
@@ -998,9 +998,7 @@ export class BreakpointsController extends BaseDebugController {
protected
onDelete
(
tree
:
tree
.
ITree
,
event
:
IKeyboardEvent
):
boolean
{
const
element
=
tree
.
getFocus
();
if
(
element
instanceof
model
.
Breakpoint
)
{
const
bp
=
<
model
.
Breakpoint
>
element
;
this
.
debugService
.
toggleBreakpoint
({
uri
:
bp
.
source
.
uri
,
lineNumber
:
bp
.
lineNumber
}).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
debugService
.
removeBreakpoints
((
<
model
.
Breakpoint
>
element
).
getId
()).
done
(
null
,
errors
.
onUnexpectedError
);
return
true
;
}
else
if
(
element
instanceof
model
.
FunctionBreakpoint
)
{
const
fbp
=
<
model
.
FunctionBreakpoint
>
element
;
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
57db1cf6
...
...
@@ -119,7 +119,7 @@ export interface IEnablement extends ITreeElement {
export
interface
IRawBreakpoint
{
uri
:
uri
;
lineNumber
:
number
;
enabled
:
boolean
;
enabled
?
:
boolean
;
condition
?:
string
;
}
...
...
@@ -305,7 +305,7 @@ export interface IDebugService {
* General breakpoints manipulation.
*/
setBreakpointsForModel
(
modelUri
:
uri
,
rawData
:
IRawBreakpoint
[]):
void
;
toggleBreakpoint
(
IRawBreakpoint
):
TPromise
<
void
>
;
addBreakpoints
(
rawBreakpoints
:
IRawBreakpoint
[]):
TPromise
<
void
[]
>
;
enableOrDisableAllBreakpoints
(
enabled
:
boolean
):
TPromise
<
void
>
;
toggleEnablement
(
element
:
IEnablement
):
TPromise
<
void
>
;
setBreakpointsActivated
(
activated
:
boolean
):
TPromise
<
void
>
;
...
...
src/vs/workbench/parts/debug/electron-browser/debugActions.ts
浏览文件 @
57db1cf6
...
...
@@ -270,7 +270,7 @@ export class RemoveBreakpointAction extends AbstractDebugAction {
}
public
run
(
breakpoint
:
debug
.
IBreakpoint
):
TPromise
<
any
>
{
return
breakpoint
instanceof
model
.
Breakpoint
?
this
.
debugService
.
toggleBreakpoint
({
uri
:
breakpoint
.
source
.
uri
,
lineNumber
:
breakpoint
.
lineNumber
}
)
return
breakpoint
instanceof
model
.
Breakpoint
?
this
.
debugService
.
removeBreakpoints
(
breakpoint
.
getId
()
)
:
this
.
debugService
.
removeFunctionBreakpoints
(
breakpoint
.
getId
());
}
}
...
...
@@ -465,15 +465,15 @@ export class ToggleBreakpointAction extends EditorAction {
}
public
run
():
TPromise
<
any
>
{
if
(
this
.
debugService
.
state
!==
debug
.
State
.
Disabled
)
{
const
lineNumber
=
this
.
editor
.
getPosition
().
lineNumber
;
const
modelUrl
=
this
.
editor
.
getModel
().
getAssociatedResource
();
if
(
this
.
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
this
.
editor
.
getModel
()))
{
return
this
.
debugService
.
toggleBreakpoint
({
uri
:
modelUrl
,
lineNumber
:
lineNumber
});
}
}
const
lineNumber
=
this
.
editor
.
getPosition
().
lineNumber
;
const
modelUrl
=
this
.
editor
.
getModel
().
getAssociatedResource
();
if
(
this
.
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
this
.
editor
.
getModel
()))
{
const
bp
=
this
.
debugService
.
getModel
().
getBreakpoints
()
.
filter
(
bp
=>
bp
.
lineNumber
===
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
modelUrl
.
toString
()).
pop
();
return
TPromise
.
as
(
null
);
return
bp
?
this
.
debugService
.
removeBreakpoints
(
bp
.
getId
())
:
this
.
debugService
.
addBreakpoints
([{
uri
:
modelUrl
,
lineNumber
:
lineNumber
}]);
}
}
}
...
...
@@ -490,11 +490,9 @@ export class EditorConditionalBreakpointAction extends EditorAction {
}
public
run
():
TPromise
<
any
>
{
if
(
this
.
debugService
.
state
!==
debug
.
State
.
Disabled
)
{
const
lineNumber
=
this
.
editor
.
getPosition
().
lineNumber
;
if
(
this
.
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
this
.
editor
.
getModel
()))
{
BreakpointWidget
.
createInstance
(
<
editorbrowser
.
ICodeEditor
>
this
.
editor
,
lineNumber
,
this
.
instantiationService
);
}
const
lineNumber
=
this
.
editor
.
getPosition
().
lineNumber
;
if
(
this
.
debugService
.
getConfigurationManager
().
canSetBreakpointsIn
(
this
.
editor
.
getModel
()))
{
BreakpointWidget
.
createInstance
(
<
editorbrowser
.
ICodeEditor
>
this
.
editor
,
lineNumber
,
this
.
instantiationService
);
}
return
TPromise
.
as
(
null
);
...
...
@@ -533,18 +531,18 @@ export class RunToCursorAction extends EditorAction {
this
.
debugService
=
debugService
;
}
public
run
():
TPromise
<
boolean
>
{
public
run
():
TPromise
<
void
>
{
const
lineNumber
=
this
.
editor
.
getPosition
().
lineNumber
;
const
uri
=
this
.
editor
.
getModel
().
getAssociatedResource
();
this
.
debugService
.
getActiveSession
().
addOneTimeListener
(
debug
.
SessionEvents
.
STOPPED
,
()
=>
{
this
.
debugService
.
toggleBreakpoint
({
uri
,
lineNumber
});
const
toRemove
=
this
.
debugService
.
getModel
().
getBreakpoints
()
.
filter
(
bp
=>
bp
.
lineNumber
===
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
uri
.
toString
()).
pop
();
this
.
debugService
.
removeBreakpoints
(
toRemove
.
getId
());
});
return
this
.
debugService
.
toggleBreakpoint
({
uri
,
lineNumber
}).
then
(()
=>
{
return
this
.
debugService
.
getActiveSession
().
continue
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
}).
then
(
response
=>
{
return
response
.
success
;
});
return
this
.
debugService
.
addBreakpoints
([{
uri
,
lineNumber
}]).
then
(()
=>
{
this
.
debugService
.
getActiveSession
().
continue
({
threadId
:
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()
});
});
}
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
57db1cf6
...
...
@@ -432,17 +432,6 @@ export class DebugService implements debug.IDebugService {
this
.
model
.
addBreakpoints
(
rawData
);
}
public
toggleBreakpoint
(
rawBreakpoint
:
debug
.
IRawBreakpoint
):
TPromise
<
void
>
{
const
breakpoint
=
this
.
model
.
getBreakpoints
().
filter
(
bp
=>
bp
.
lineNumber
===
rawBreakpoint
.
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
rawBreakpoint
.
uri
.
toString
()).
pop
();
if
(
breakpoint
)
{
this
.
model
.
removeBreakpoints
([
breakpoint
]);
}
else
{
this
.
model
.
addBreakpoints
([
rawBreakpoint
]);
}
return
this
.
sendBreakpoints
(
rawBreakpoint
.
uri
);
}
public
enableOrDisableAllBreakpoints
(
enabled
:
boolean
):
TPromise
<
void
>
{
this
.
model
.
enableOrDisableAllBreakpoints
(
enabled
);
return
this
.
sendAllBreakpoints
();
...
...
@@ -460,6 +449,13 @@ export class DebugService implements debug.IDebugService {
return
this
.
sendExceptionBreakpoints
();
}
public
addBreakpoints
(
rawBreakpoints
:
debug
.
IRawBreakpoint
[]):
TPromise
<
void
[]
>
{
this
.
model
.
addBreakpoints
(
rawBreakpoints
);
const
uris
=
arrays
.
distinct
(
rawBreakpoints
,
raw
=>
raw
.
uri
.
toString
()).
map
(
raw
=>
raw
.
uri
);
return
TPromise
.
join
(
uris
.
map
(
uri
=>
this
.
sendBreakpoints
(
uri
)));
}
public
removeBreakpoints
(
id
?:
string
):
TPromise
<
any
>
{
const
toRemove
=
this
.
model
.
getBreakpoints
().
filter
(
bp
=>
!
id
||
bp
.
getId
()
===
id
);
const
urisToClear
=
arrays
.
distinct
(
toRemove
,
bp
=>
bp
.
source
.
uri
.
toString
()).
map
(
bp
=>
bp
.
source
.
uri
);
...
...
src/vs/workbench/parts/debug/test/common/mockDebugService.ts
浏览文件 @
57db1cf6
...
...
@@ -39,7 +39,7 @@ export class MockDebugService implements debug.IDebugService {
public
setBreakpointsForModel
(
modelUri
:
uri
,
rawData
:
debug
.
IRawBreakpoint
[]):
void
{}
public
toggleBreakpoint
(
IRawBreakpoint
):
TPromise
<
void
>
{
public
addBreakpoints
(
rawBreakpoints
:
debug
.
IRawBreakpoint
[]):
TPromise
<
void
[]
>
{
return
TPromise
.
as
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录