提交 f8b1e3d2 编写于 作者: I isidor

debug: make sure to send a breakpoints request when all bps have been removed

fixes #1985
上级 6561cfae
......@@ -36,13 +36,15 @@ export class Source {
}
public static toRawSource(uri: uri, model: IModel): DebugProtocol.Source {
// first try to find the raw source amongst the stack frames - since that represenation has more data (source reference),
const threads = model.getThreads();
for (let threadId in threads) {
if (threads.hasOwnProperty(threadId) && threads[threadId].callStack) {
const found = threads[threadId].callStack.filter(sf => sf.source.uri.toString() === uri.toString()).pop();
if (found) {
return found.source.raw;
if (model) {
// first try to find the raw source amongst the stack frames - since that represenation has more data (source reference),
const threads = model.getThreads();
for (let threadId in threads) {
if (threads.hasOwnProperty(threadId) && threads[threadId].callStack) {
const found = threads[threadId].callStack.filter(sf => sf.source.uri.toString() === uri.toString()).pop();
if (found) {
return found.source.raw;
}
}
}
}
......
......@@ -782,15 +782,17 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
private sendBreakpoints(modelUri: uri): Promise {
if (!this.session || !this.session.readyForBreakpoints) {
return Promise.as(null);
}
const breakpointsToSend = arrays.distinct(
this.model.getBreakpoints().filter(bp => this.model.areBreakpointsActivated() && bp.enabled && bp.source.uri.toString() === modelUri.toString()),
bp => `${ bp.desiredLineNumber }`
);
if (!this.session || !this.session.readyForBreakpoints || breakpointsToSend.length === 0) {
return Promise.as(null);
}
const rawSource = breakpointsToSend.length > 0 ? breakpointsToSend[0].source.raw : Source.toRawSource(modelUri, null);
return this.session.setBreakpoints({ source: breakpointsToSend[0].source.raw, lines: breakpointsToSend.map(bp => bp.desiredLineNumber),
return this.session.setBreakpoints({ source: rawSource, lines: breakpointsToSend.map(bp => bp.desiredLineNumber),
breakpoints: breakpointsToSend.map(bp => ({ line: bp.desiredLineNumber, condition: bp.condition })) }).then(response => {
const data: {[id: string]: { line: number, verified: boolean } } = { };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册