Skip to content

Support setting data breakpoints on subsequent debug sessions (fix #1251) #1252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/debug/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,12 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
response: DebugProtocol.DataBreakpointInfoResponse,
args: DebugProtocol.DataBreakpointInfoArguments
): void {
if (args.variablesReference !== undefined && (args.variablesReference === 1 || args.variablesReference === 2)) {
// This is a private or public local variable
if (
args.variablesReference !== undefined &&
[0, 1].includes(this._contexts.get(args.variablesReference).id) &&
!args.name.includes("(")
) {
// This is an unsubscripted private or public local variable
response.body = {
dataId: args.name,
description: args.name,
Expand All @@ -494,7 +498,8 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
// This is an object property or array element, or args.variablesReference is undefined
response.body = {
dataId: null,
description: "Can only set a watchpoint on a local variable",
// This message isn't surfaced in VS Code, which simply doesn't offer the context menu option when dataId is null
description: "Can only set a watchpoint on an unsubscripted local variable",
};
}

Expand Down