microsoft / vscode-mock-debug

Starter sample for developing debug adapters for VSCode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

launchRequest doesn't wait for setBreakPointsRequest response.

paulo-fernando-silva opened this issue · comments

commented

Not sure if this is a new feature, but before launchRequest would not get called before the this.sendResponse(response); from setBreakPointsRequest(). Now it does, which breaks my code. I need to finish setting the breakpoints before I can call start. Is the plugin supposed to handle that now? If so what's the point of this.sendResponse(response);?

commented

Tried to set
response.body.supportsConfigurationDoneRequest = false;
but that doesn't seem to prevent start from being called even if the configuration is not done.
Did notice that the code did change 3 months back adding some sync, so I guess this might not be a bug but actually the desired behavior. Close if that's the case.

I worked around this issue with the following code:

private _runCallback: () => void;

protected configurationDoneRequest(
	response: DebugProtocol.ConfigurationDoneResponse,
	args: DebugProtocol.ConfigurationDoneArguments): void
{
	this._runCallback();
}

protected launchRequest(
	response: DebugProtocol.LaunchResponse,
	args: LaunchRequestArguments): void
{
	// make sure to 'Stop' the buffered logging if 'trace' is not set
	logger.setup(args.trace ? Logger.LogLevel.Verbose : Logger.LogLevel.Stop, false);

	// start the program in the runtime
	this._runCallback = () => {
		this._runtime.start(args.program, !!args.stopOnEntry);
		this.sendResponse(response);
	};
}

Please see the sequence diagrams in this doc: https://microsoft.github.io/debug-adapter-protocol/overview