Skip to content

Restructuring DebugService.startDebugging and DebugService.createSession #58822

@weinand

Description

@weinand

DebugService.createSession is only called from a single location in VS Code.

I wonder:

  • why is only the body of createSession bracketed with this.startInitializingState()/this.endInitializingState() and not startDebugging instead?
  • why are there two subsequent saveAll calls, one in startDebugging and one in createSession? What can happen in between?
  • wouldn't it make sense to bring the this.configurationManager.guessDebugger() and the this.configurationManager.getDebugger(resolvedConfig.type) closer together without the intervening "SaveAll"?

In addition I see that startDebugging calls itself recursively. Here I wonder whether it is really needed to call this sequence again on every level?

I think this code structure would avoid the repetition of the run-once code:

startDebugging() {

   // do some heavy preparation stuff

   internalStart();

   // do some error stuff at end
}

internalStart() {
   if (composite) { 
      forAll() {
         internalStart();   // the recursive call is here
      }
   } else {
      createSession();
   } 
}

createSession() {
   // start one session without repeating the heavy preparation stuff
}

Metadata

Metadata

Assignees

Labels

debtCode quality issuesdebugDebug viewlet, configurations, breakpoints, adapter issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions