in src/test-runner/run-tracker.ts [315:375]
private prepareDebugInfo() {
if (this.getRunProfileKind() !== vscode.TestRunProfileKind.Debug) {
return
}
// Determine configured launch configuration name.
const configName = getExtensionSetting(SettingName.LAUNCH_CONFIG_NAME)
if (!configName) {
this.run.appendOutput(
'No launch configuration name is configured. Debugger will not connect automatically for this run.\r\n'
)
this.run.appendOutput(
'Check the `bazelbsp.debug.profileName` VS Code setting to ensure it corresponds to a valid launch configuration.\r\n'
)
return
}
// Store the selected launch configuration.
const launchConfigurations = vscode.workspace.getConfiguration('launch')
const configurations =
launchConfigurations.get<any[]>('configurations') || []
const selectedConfig = configurations.find(
config => config.name !== undefined && config.name === configName
)
if (!selectedConfig) {
this.run.appendOutput(
`Unable to find debug profile ${configName}. Debugger will not connect automatically for this run.\r\n`
)
this.run.appendOutput(
'Check the `bazelbsp.debug.profileName` VS Code setting to ensure it corresponds to a valid launch configuration.\r\n'
)
}
// Ensure that matcher pattern is set for the output.
const readyPattern = getExtensionSetting(SettingName.DEBUG_READY_PATTERN)
if (!readyPattern) {
this.run.appendOutput(
'No matcher pattern is set. Debugger will not connect automatically for this run.\r\n'
)
this.run.appendOutput(
'Check the `bazelbsp.debug.readyPattern` VS Code setting to ensure that a pattern is set.\r\n'
)
}
// Ensure that matcher pattern is set for the output.
let debugFlags = getExtensionSetting(SettingName.DEBUG_BAZEL_FLAGS)
if (!debugFlags) {
this.run.appendOutput(
'No additional debug-specific Bazel flags have been found for this run.\r\n'
)
this.run.appendOutput(
'Check the `bazelbsp.debug.bazelFlags` VS Code setting to ensure that necessary flags are set.\r\n'
)
}
this.debugInfo = {
debugFlags: debugFlags,
launchConfig: selectedConfig,
readyPattern: readyPattern ? new RegExp(readyPattern) : undefined,
}
}