Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
86f66d6c
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,发现更多精彩内容 >>
提交
86f66d6c
编写于
9月 23, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Breakpoint supported should live on SessionData in the breakpoint
fixes #81303
上级
944a1a58
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
89 addition
and
41 deletion
+89
-41
src/vs/workbench/contrib/debug/browser/breakpointsView.ts
src/vs/workbench/contrib/debug/browser/breakpointsView.ts
+7
-21
src/vs/workbench/contrib/debug/browser/debugSession.ts
src/vs/workbench/contrib/debug/browser/debugSession.ts
+7
-7
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+1
-0
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+64
-9
src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts
...s/workbench/contrib/debug/test/browser/debugModel.test.ts
+10
-4
未找到文件。
src/vs/workbench/contrib/debug/browser/breakpointsView.ts
浏览文件 @
86f66d6c
...
...
@@ -655,9 +655,8 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, br
};
}
const
session
=
debugService
.
getViewModel
().
focusedSession
;
if
(
breakpoint
instanceof
FunctionBreakpoint
)
{
if
(
session
&&
!
session
.
capabilities
.
supportsFunctionBreakpoints
)
{
if
(
!
breakpoint
.
supported
)
{
return
{
className
:
'
debug-function-breakpoint-unverified
'
,
message
:
nls
.
localize
(
'
functionBreakpointUnsupported
'
,
"
Function breakpoints not supported by this debug type
"
),
...
...
@@ -671,7 +670,7 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, br
}
if
(
breakpoint
instanceof
DataBreakpoint
)
{
if
(
session
&&
!
session
.
capabilities
.
supportsDataBreakpoints
)
{
if
(
!
breakpoint
.
supported
)
{
return
{
className
:
'
debug-data-breakpoint-unverified
'
,
message
:
nls
.
localize
(
'
dataBreakpointUnsupported
'
,
"
Data breakpoints not supported by this debug type
"
),
...
...
@@ -686,30 +685,17 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, br
if
(
breakpoint
.
logMessage
||
breakpoint
.
condition
||
breakpoint
.
hitCondition
)
{
const
messages
:
string
[]
=
[];
if
(
breakpoint
.
logMessage
)
{
if
(
session
&&
!
session
.
capabilities
.
supportsLogPoints
)
{
return
{
className
:
'
debug-breakpoint-unsupported
'
,
message
:
nls
.
localize
(
'
logBreakpointUnsupported
'
,
"
Logpoints not supported by this debug type
"
),
};
}
messages
.
push
(
nls
.
localize
(
'
logMessage
'
,
"
Log Message: {0}
"
,
breakpoint
.
logMessage
));
}
if
(
session
&&
breakpoint
.
condition
&&
!
session
.
capabilities
.
supportsConditionalBreakpoints
)
{
if
(
!
breakpoint
.
supported
)
{
return
{
className
:
'
debug-breakpoint-unsupported
'
,
message
:
nls
.
localize
(
'
conditionalBreakpointUnsupported
'
,
"
Conditional breakpoints not supported by this debug type
"
),
};
}
if
(
session
&&
breakpoint
.
hitCondition
&&
!
session
.
capabilities
.
supportsHitConditionalBreakpoints
)
{
return
{
className
:
'
debug-breakpoint-unsupported
'
,
message
:
nls
.
localize
(
'
hitBreakpointUnsupported
'
,
"
Hit conditional breakpoints not supported by this debug type
"
),
message
:
nls
.
localize
(
'
breakpointUnsupported
'
,
"
Breakpoints of this type are not supported by the debugger
"
),
};
}
if
(
breakpoint
.
logMessage
)
{
messages
.
push
(
nls
.
localize
(
'
logMessage
'
,
"
Log Message: {0}
"
,
breakpoint
.
logMessage
));
}
if
(
breakpoint
.
condition
)
{
messages
.
push
(
nls
.
localize
(
'
expression
'
,
"
Expression: {0}
"
,
breakpoint
.
condition
));
}
...
...
src/vs/workbench/contrib/debug/browser/debugSession.ts
浏览文件 @
86f66d6c
...
...
@@ -313,7 +313,7 @@ export class DebugSession implements IDebugSession {
data
.
set
(
breakpointsToSend
[
i
].
getId
(),
response
.
body
.
breakpoints
[
i
]);
}
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
});
}
...
...
@@ -327,7 +327,7 @@ export class DebugSession implements IDebugSession {
for
(
let
i
=
0
;
i
<
fbpts
.
length
;
i
++
)
{
data
.
set
(
fbpts
[
i
].
getId
(),
response
.
body
.
breakpoints
[
i
]);
}
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
});
}
...
...
@@ -367,7 +367,7 @@ export class DebugSession implements IDebugSession {
for
(
let
i
=
0
;
i
<
dataBreakpoints
.
length
;
i
++
)
{
data
.
set
(
dataBreakpoints
[
i
].
getId
(),
response
.
body
.
breakpoints
[
i
]);
}
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
});
}
...
...
@@ -844,7 +844,7 @@ export class DebugSession implements IDebugSession {
}],
false
);
if
(
bps
.
length
===
1
)
{
const
data
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
([[
bps
[
0
].
getId
(),
event
.
body
.
breakpoint
]]);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
}
...
...
@@ -863,11 +863,11 @@ export class DebugSession implements IDebugSession {
event
.
body
.
breakpoint
.
column
=
undefined
;
}
const
data
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
([[
breakpoint
.
getId
(),
event
.
body
.
breakpoint
]]);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
if
(
functionBreakpoint
)
{
const
data
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
([[
functionBreakpoint
.
getId
(),
event
.
body
.
breakpoint
]]);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
data
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
data
);
}
}
}));
...
...
@@ -885,7 +885,7 @@ export class DebugSession implements IDebugSession {
this
.
rawListeners
.
push
(
this
.
raw
.
onDidExitAdapter
(
event
=>
{
this
.
initialized
=
true
;
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
undefined
);
this
.
model
.
setBreakpointSessionData
(
this
.
getId
(),
this
.
capabilities
,
undefined
);
this
.
_onDidEndAdapter
.
fire
(
event
);
}));
}
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
86f66d6c
...
...
@@ -350,6 +350,7 @@ export interface IBaseBreakpoint extends IEnablement {
readonly
hitCondition
?:
string
;
readonly
logMessage
?:
string
;
readonly
verified
:
boolean
;
readonly
supported
:
boolean
;
getIdFromAdapter
(
sessionId
:
string
):
number
|
undefined
;
}
...
...
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
86f66d6c
...
...
@@ -23,6 +23,7 @@ import { posix } from 'vs/base/common/path';
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
mixin
}
from
'
vs/base/common/objects
'
;
export
class
ExpressionContainer
implements
IExpressionContainer
{
...
...
@@ -498,10 +499,28 @@ export class Enablement implements IEnablement {
}
}
export
class
BaseBreakpoint
extends
Enablement
implements
IBaseBreakpoint
{
interface
IBreakpointSessionData
extends
DebugProtocol
.
Breakpoint
{
supportsConditionalBreakpoints
:
boolean
;
supportsHitConditionalBreakpoints
:
boolean
;
supportsLogPoints
:
boolean
;
supportsFunctionBreakpoints
:
boolean
;
supportsDataBreakpoints
:
boolean
;
}
function
toBreakpointSessionData
(
data
:
DebugProtocol
.
Breakpoint
,
capabilities
:
DebugProtocol
.
Capabilities
):
IBreakpointSessionData
{
return
mixin
({
supportsConditionalBreakpoints
:
!!
capabilities
.
supportsConditionalBreakpoints
,
supportsHitConditionalBreakpoints
:
!!
capabilities
.
supportsHitConditionalBreakpoints
,
supportsLogPoints
:
!!
capabilities
.
supportsLogPoints
,
supportsFunctionBreakpoints
:
!!
capabilities
.
supportsFunctionBreakpoints
,
supportsDataBreakpoints
:
!!
capabilities
.
supportsDataBreakpoints
},
data
);
}
export
abstract
class
BaseBreakpoint
extends
Enablement
implements
IBaseBreakpoint
{
private
sessionData
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
();
protected
data
:
DebugProtocol
.
Breakpoint
|
undefined
;
private
sessionData
=
new
Map
<
string
,
IBreakpointSessionData
>
();
protected
data
:
IBreakpointSessionData
|
undefined
;
constructor
(
enabled
:
boolean
,
...
...
@@ -516,7 +535,7 @@ export class BaseBreakpoint extends Enablement implements IBaseBreakpoint {
}
}
setSessionData
(
sessionId
:
string
,
data
:
DebugProtocol
.
Breakpoint
|
undefined
):
void
{
setSessionData
(
sessionId
:
string
,
data
:
IBreakpointSessionData
|
undefined
):
void
{
if
(
!
data
)
{
this
.
sessionData
.
delete
(
sessionId
);
}
else
{
...
...
@@ -546,6 +565,8 @@ export class BaseBreakpoint extends Enablement implements IBaseBreakpoint {
return
this
.
data
?
this
.
data
.
verified
:
true
;
}
abstract
get
supported
():
boolean
;
getIdFromAdapter
(
sessionId
:
string
):
number
|
undefined
{
const
data
=
this
.
sessionData
.
get
(
sessionId
);
return
data
?
data
.
id
:
undefined
;
...
...
@@ -623,7 +644,25 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
};
}
setSessionData
(
sessionId
:
string
,
data
:
DebugProtocol
.
Breakpoint
|
undefined
):
void
{
get
supported
():
boolean
{
if
(
!
this
.
data
)
{
return
true
;
}
if
(
this
.
logMessage
&&
!
this
.
data
.
supportsLogPoints
)
{
return
false
;
}
if
(
this
.
condition
&&
!
this
.
data
.
supportsConditionalBreakpoints
)
{
return
false
;
}
if
(
this
.
hitCondition
&&
!
this
.
data
.
supportsHitConditionalBreakpoints
)
{
return
false
;
}
return
true
;
}
setSessionData
(
sessionId
:
string
,
data
:
IBreakpointSessionData
|
undefined
):
void
{
super
.
setSessionData
(
sessionId
,
data
);
if
(
!
this
.
_adapterData
)
{
this
.
_adapterData
=
this
.
adapterData
;
...
...
@@ -683,6 +722,14 @@ export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreak
return
result
;
}
get
supported
():
boolean
{
if
(
!
this
.
data
)
{
return
true
;
}
return
this
.
data
.
supportsFunctionBreakpoints
;
}
toString
():
string
{
return
this
.
name
;
}
...
...
@@ -711,6 +758,14 @@ export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint {
return
result
;
}
get
supported
():
boolean
{
if
(
!
this
.
data
)
{
return
true
;
}
return
this
.
data
.
supportsDataBreakpoints
;
}
toString
():
string
{
return
this
.
label
;
}
...
...
@@ -971,14 +1026,14 @@ export class DebugModel implements IDebugModel {
this
.
_onDidChangeBreakpoints
.
fire
({
changed
:
updated
});
}
setBreakpointSessionData
(
sessionId
:
string
,
data
:
Map
<
string
,
DebugProtocol
.
Breakpoint
>
|
undefined
):
void
{
setBreakpointSessionData
(
sessionId
:
string
,
capabilites
:
DebugProtocol
.
Capabilities
,
data
:
Map
<
string
,
DebugProtocol
.
Breakpoint
>
|
undefined
):
void
{
this
.
breakpoints
.
forEach
(
bp
=>
{
if
(
!
data
)
{
bp
.
setSessionData
(
sessionId
,
undefined
);
}
else
{
const
bpData
=
data
.
get
(
bp
.
getId
());
if
(
bpData
)
{
bp
.
setSessionData
(
sessionId
,
bpData
);
bp
.
setSessionData
(
sessionId
,
toBreakpointSessionData
(
bpData
,
capabilites
)
);
}
}
});
...
...
@@ -988,7 +1043,7 @@ export class DebugModel implements IDebugModel {
}
else
{
const
fbpData
=
data
.
get
(
fbp
.
getId
());
if
(
fbpData
)
{
fbp
.
setSessionData
(
sessionId
,
fbpData
);
fbp
.
setSessionData
(
sessionId
,
toBreakpointSessionData
(
fbpData
,
capabilites
)
);
}
}
});
...
...
@@ -998,7 +1053,7 @@ export class DebugModel implements IDebugModel {
}
else
{
const
dbpData
=
data
.
get
(
dbp
.
getId
());
if
(
dbpData
)
{
dbp
.
setSessionData
(
sessionId
,
dbpData
);
dbp
.
setSessionData
(
sessionId
,
toBreakpointSessionData
(
dbpData
,
capabilites
)
);
}
}
});
...
...
src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts
浏览文件 @
86f66d6c
...
...
@@ -112,7 +112,7 @@ suite('Debug - Model', () => {
test
(
'
breakpoints multiple sessions
'
,
()
=>
{
const
modelUri
=
uri
.
file
(
'
/myfolder/myfile.js
'
);
const
breakpoints
=
model
.
addBreakpoints
(
modelUri
,
[{
lineNumber
:
5
,
enabled
:
true
},
{
lineNumber
:
10
,
enabled
:
false
}]);
const
breakpoints
=
model
.
addBreakpoints
(
modelUri
,
[{
lineNumber
:
5
,
enabled
:
true
,
condition
:
'
x > 5
'
},
{
lineNumber
:
10
,
enabled
:
false
}]);
const
session
=
createMockSession
(
model
);
const
data
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
();
...
...
@@ -121,7 +121,7 @@ suite('Debug - Model', () => {
data
.
set
(
breakpoints
[
0
].
getId
(),
{
verified
:
false
,
line
:
10
});
data
.
set
(
breakpoints
[
1
].
getId
(),
{
verified
:
true
,
line
:
50
});
model
.
setBreakpointSessionData
(
session
.
getId
(),
data
);
model
.
setBreakpointSessionData
(
session
.
getId
(),
{},
data
);
assert
.
equal
(
breakpoints
[
0
].
lineNumber
,
5
);
assert
.
equal
(
breakpoints
[
1
].
lineNumber
,
50
);
...
...
@@ -129,17 +129,23 @@ suite('Debug - Model', () => {
const
data2
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
();
data2
.
set
(
breakpoints
[
0
].
getId
(),
{
verified
:
true
,
line
:
100
});
data2
.
set
(
breakpoints
[
1
].
getId
(),
{
verified
:
true
,
line
:
500
});
model
.
setBreakpointSessionData
(
session2
.
getId
(),
data2
);
model
.
setBreakpointSessionData
(
session2
.
getId
(),
{},
data2
);
// Breakpoint is verified only once, show that line
assert
.
equal
(
breakpoints
[
0
].
lineNumber
,
100
);
// Breakpoint is verified two times, show the original line
assert
.
equal
(
breakpoints
[
1
].
lineNumber
,
10
);
model
.
setBreakpointSessionData
(
session
.
getId
(),
undefined
);
model
.
setBreakpointSessionData
(
session
.
getId
(),
{},
undefined
);
// No more double session verification
assert
.
equal
(
breakpoints
[
0
].
lineNumber
,
100
);
assert
.
equal
(
breakpoints
[
1
].
lineNumber
,
500
);
assert
.
equal
(
breakpoints
[
0
].
supported
,
false
);
const
data3
=
new
Map
<
string
,
DebugProtocol
.
Breakpoint
>
();
data3
.
set
(
breakpoints
[
0
].
getId
(),
{
verified
:
true
,
line
:
500
});
model
.
setBreakpointSessionData
(
session2
.
getId
(),
{
supportsConditionalBreakpoints
:
true
},
data2
);
assert
.
equal
(
breakpoints
[
0
].
supported
,
true
);
});
// Threads
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录