Skip to content

Commit 8422a7f

Browse files
committed
support windows path placeholder
1 parent b3667a3 commit 8422a7f

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

src/extension.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { EventNames } from './common/telemetry/constants';
99
import { sendManagerSelectionTelemetry } from './common/telemetry/helpers';
1010
import { sendTelemetryEvent } from './common/telemetry/sender';
1111
import { createDeferred } from './common/utils/deferred';
12+
import { isWindows } from './common/utils/platformUtils';
1213
import {
1314
activeTerminal,
1415
createLogOutputChannel,
@@ -57,8 +58,8 @@ import {
5758
import { ShellStartupActivationVariablesManagerImpl } from './features/terminal/shellStartupActivationVariablesManager';
5859
import { cleanupStartupScripts } from './features/terminal/shellStartupSetupHandlers';
5960
import { TerminalActivationImpl } from './features/terminal/terminalActivationState';
60-
import { TerminalManager, TerminalManagerImpl } from './features/terminal/terminalManager';
6161
import { TerminalEnvVarInjector } from './features/terminal/terminalEnvVarInjector';
62+
import { TerminalManager, TerminalManagerImpl } from './features/terminal/terminalManager';
6263
import { getAutoActivationType, getEnvironmentForTerminal } from './features/terminal/utils';
6364
import { EnvManagerView } from './features/views/envManagersView';
6465
import { ProjectView } from './features/views/projectView';
@@ -241,10 +242,7 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
241242
);
242243

243244
// Initialize terminal environment variable injection
244-
const terminalEnvVarInjector = new TerminalEnvVarInjector(
245-
context.environmentVariableCollection,
246-
envVarManager,
247-
);
245+
const terminalEnvVarInjector = new TerminalEnvVarInjector(context.environmentVariableCollection, envVarManager);
248246
context.subscriptions.push(terminalEnvVarInjector);
249247

250248
context.subscriptions.push(
@@ -450,23 +448,26 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
450448
commands.registerCommand('python-envs.runPetInTerminal', async () => {
451449
try {
452450
const petPath = await getNativePythonToolsPath();
453-
451+
454452
// Show quick pick menu for PET operation selection
455-
const selectedOption = await window.showQuickPick([
453+
const selectedOption = await window.showQuickPick(
454+
[
455+
{
456+
label: 'Find All Environments',
457+
description: 'Finds all environments and reports them to the standard output',
458+
detail: 'Runs: pet find --verbose',
459+
},
460+
{
461+
label: 'Resolve Environment...',
462+
description: 'Resolves & reports the details of the environment to the standard output',
463+
detail: 'Runs: pet resolve <path>',
464+
},
465+
],
456466
{
457-
label: 'Find All Environments',
458-
description: 'Finds all environments and reports them to the standard output',
459-
detail: 'Runs: pet find --verbose'
467+
placeHolder: 'Select a Python Environment Tool (PET) operation',
468+
ignoreFocusOut: true,
460469
},
461-
{
462-
label: 'Resolve Environment...',
463-
description: 'Resolves & reports the details of the environment to the standard output',
464-
detail: 'Runs: pet resolve <path>'
465-
}
466-
], {
467-
placeHolder: 'Select a Python Environment Tool (PET) operation',
468-
ignoreFocusOut: true
469-
});
470+
);
470471

471472
if (!selectedOption) {
472473
return; // User cancelled
@@ -483,16 +484,17 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
483484
traceInfo(`Running PET find command: ${petPath} find --verbose`);
484485
} else if (selectedOption.label === 'Resolve Environment...') {
485486
// Show input box for path
487+
const placeholder = isWindows() ? 'C:\\path\\to\\python\\executable' : '/path/to/python/executable';
486488
const inputPath = await window.showInputBox({
487489
prompt: 'Enter the path to the Python executable to resolve',
488-
placeHolder: '/path/to/python/executable',
490+
placeHolder: placeholder,
489491
ignoreFocusOut: true,
490492
validateInput: (value) => {
491493
if (!value || value.trim().length === 0) {
492494
return 'Please enter a valid path';
493495
}
494496
return null;
495-
}
497+
},
496498
});
497499

498500
if (!inputPath) {

0 commit comments

Comments
 (0)