Skip to content
3 changes: 2 additions & 1 deletion src/debugSession/BrightScriptDebugSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ describe('BrightScriptDebugSession', () => {
await session.setBreakPointsRequest(<any>{}, args);
expect(response.body.breakpoints).to.be.lengthOf(0);

//add breakpoint during live debug session. one was there before, the other is new. Neither will be verified right now
//add breakpoint during live debug session. one was there before, the other is new.
//line 1 was already staged so it comes back verified; line 2 is new so it is not.
args.breakpoints = [{ line: 1 }, { line: 2 }];
await session.setBreakPointsRequest(<any>{}, args);
expect(
Expand Down
15 changes: 8 additions & 7 deletions src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,10 +1200,10 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
//add breakpoint lines to source files and then publish
util.log('Adding stop statements for active breakpoints');

//write the `stop` statements to every file that has breakpoints (do for telnet, skip for debug protocol)
if (!this.enableDebugProtocol) {

await this.breakpointManager.writeBreakpointsForProject(this.projectManager.mainProject);
if (this.enableDebugProtocol) {
await this.breakpointManager.resolveBreakpointsForProject(this.projectManager.mainProject);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's find different names for these.

"write" still feels good for when it actually is rewriting the code.

"resolve" is the ambiguous one, it feels like it's more like "scan the project and make sure that every breakpoint is allowed to be at this spot, or throw out the ones that aren't allowed or move them". So you know, a good function name for that. ;)

} else {
await this.breakpointManager.injectBreakpointsForProject(this.projectManager.mainProject);
Comment on lines +1204 to +1206
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this branching logic inside of a single call? Would prefer avoiding branchout out here if possible.

}

if (this.launchConfiguration.packageTask) {
Expand Down Expand Up @@ -1308,9 +1308,10 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
// Add breakpoint lines to the staging files and before publishing
util.log('Adding stop statements for active breakpoints in Component Libraries');

//write the `stop` statements to every file that has breakpoints (do for telnet, skip for debug protocol)
if (!this.enableDebugProtocol) {
await this.breakpointManager.writeBreakpointsForProject(compLibProject);
if (this.enableDebugProtocol) {
await this.breakpointManager.resolveBreakpointsForProject(compLibProject);
} else {
await this.breakpointManager.injectBreakpointsForProject(compLibProject);
}

await compLibProject.postfixFiles();
Expand Down
Loading