Skip to content

Commit b759a83

Browse files
Support setting data breakpoints on subsequent debug sessions (fix #1251) (#1252)
* Support setting data breakpoints on subsequent debug sessions (fix #1251) * Proper fix for data breakpoint option not appearing on variable context menu
1 parent 8695a45 commit b759a83

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/debug/debugSession.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,12 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
484484
response: DebugProtocol.DataBreakpointInfoResponse,
485485
args: DebugProtocol.DataBreakpointInfoArguments
486486
): void {
487-
if (args.variablesReference !== undefined && (args.variablesReference === 1 || args.variablesReference === 2)) {
488-
// This is a private or public local variable
487+
if (
488+
args.variablesReference !== undefined &&
489+
[0, 1].includes(this._contexts.get(args.variablesReference).id) &&
490+
!args.name.includes("(")
491+
) {
492+
// This is an unsubscripted private or public local variable
489493
response.body = {
490494
dataId: args.name,
491495
description: args.name,
@@ -494,7 +498,8 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
494498
// This is an object property or array element, or args.variablesReference is undefined
495499
response.body = {
496500
dataId: null,
497-
description: "Can only set a watchpoint on a local variable",
501+
// This message isn't surfaced in VS Code, which simply doesn't offer the context menu option when dataId is null
502+
description: "Can only set a watchpoint on an unsubscripted local variable",
498503
};
499504
}
500505

0 commit comments

Comments
 (0)