in src/extension/extension.ts [175:216]
async function bazelBuildTargetWithDebugging(
adapter: IBazelCommandAdapter | undefined,
) {
if (adapter === undefined) {
// If the command adapter was unspecified, it means this command is being
// invoked via the command palatte. Provide quickpick build targets for
// the user to choose from.
const quickPick = await vscode.window.showQuickPick(
queryQuickPickTargets("kind('.* rule', ...)"),
{
canPickMany: false,
},
);
// If the result was undefined, the user cancelled the quick pick, so don't
// try again.
if (quickPick) {
await bazelBuildTargetWithDebugging(quickPick);
}
return;
}
const bazelConfigCmdLine =
vscode.workspace.getConfiguration("bazel.commandLine");
const startupOptions = bazelConfigCmdLine.get<string[]>("startupOptions");
const commandArgs = bazelConfigCmdLine.get<string[]>("commandArgs");
const commandOptions = adapter.getBazelCommandOptions();
const fullArgs = commandArgs
.concat(commandOptions.targets)
.concat(commandOptions.options);
vscode.debug.startDebugging(undefined, {
args: fullArgs,
bazelCommand: "build",
bazelExecutablePath: getDefaultBazelExecutablePath(),
bazelStartupOptions: startupOptions,
cwd: commandOptions.workspaceInfo.bazelWorkspacePath,
name: "On-demand Bazel Build Debug",
request: "launch",
type: "bazel-launch-build",
});
}