diff --git a/extension/debug/debug.ts b/extension/debug/debug.ts index 95bd7f6..9e02146 100644 --- a/extension/debug/debug.ts +++ b/extension/debug/debug.ts @@ -126,12 +126,15 @@ class MojoDebugAdapterDescriptorFactory } this.logger.info(`Using the SDK ${sdk.version} for the debug session`); - return new vscode.DebugAdapterExecutable(sdk.dapPath, [ - '--repl-mode', - 'variable', - '--pre-init-command', - `?!plugin load '${sdk.lldbPluginPath}'`, - ]); + this.logger.debug('env', sdk.getProcessEnv()); + + return new vscode.DebugAdapterExecutable( + sdk.dapPath, + ['--repl-mode', 'variable'], + { + env: sdk.getProcessEnv(), + }, + ); } } @@ -264,6 +267,7 @@ class MojoDebugConfigurationResolver // This setting shortens the length of address strings. const initCommands = [ + `?!plugin load '${sdk.lldbPluginPath}'`, '?settings set target.show-hex-variable-values-with-leading-zeroes false', // FIXME(#23274): remove this when we properly emit the opt flag. '?settings set target.process.optimization-warnings false', diff --git a/extension/pyenv.ts b/extension/pyenv.ts index 5f8ffb2..8690826 100644 --- a/extension/pyenv.ts +++ b/extension/pyenv.ts @@ -115,6 +115,7 @@ class HomeSDK extends SDK { mojoPath: string, visualizersPath: string, lldbPath: string, + private prefixPath?: string, ) { super( logger, @@ -132,8 +133,10 @@ class HomeSDK extends SDK { public override getProcessEnv(withTelemetry: boolean = true) { return { + ...super.getProcessEnv(withTelemetry), MODULAR_HOME: this.homePath, - MODULAR_TELEMETRY_ENABLED: withTelemetry ? 'true' : 'false', + // HACK: Set CONDA_PREFIX to allow debugger wrappers to work + CONDA_PREFIX: this.prefixPath, }; } } @@ -214,6 +217,7 @@ export class PythonEnvironmentManager extends DisposableContext { return this.createSDKFromHomePath( SDKKind.Environment, path.join(env.executable.sysPrefix, 'share', 'max'), + env.executable.sysPrefix, ); } else { this.logger.info( @@ -315,6 +319,7 @@ export class PythonEnvironmentManager extends DisposableContext { public async createSDKFromHomePath( kind: SDKKind, homePath: string, + prefixPath?: string, ): Promise { const modularCfgPath = path.join(homePath, 'modular.cfg'); const decoder = new TextDecoder(); @@ -372,6 +377,7 @@ export class PythonEnvironmentManager extends DisposableContext { config['mojo-max']['driver_path'], config['mojo-max']['lldb_visualizers_path'], config['mojo-max']['lldb_path'], + prefixPath, ); } catch (e) { await this.displaySDKError(