From 07e334af8ad631da01c21ce339366f907006520c Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Thu, 15 Dec 2022 06:19:18 -0800 Subject: [PATCH] Display user friendly path when displaying create environment notification (#20387) Closes https://github.com/microsoft/vscode-python/issues/19934 --- src/client/extensionActivation.ts | 4 +++- src/client/pythonEnvironments/creation/createEnvApi.ts | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/extensionActivation.ts b/src/client/extensionActivation.ts index b3ba9034433c..1f2e3e94cefe 100644 --- a/src/client/extensionActivation.ts +++ b/src/client/extensionActivation.ts @@ -26,6 +26,7 @@ import { IExtensions, IInterpreterPathService, IOutputChannel, + IPathUtils, } from './common/types'; import { noop } from './common/utils/misc'; import { DebuggerTypeName } from './debugger/constants'; @@ -102,7 +103,8 @@ export function activateFeatures(ext: ExtensionState, _components: Components): const interpreterPathService: IInterpreterPathService = ext.legacyIOC.serviceContainer.get( IInterpreterPathService, ); - registerCreateEnvironmentFeatures(ext.disposables, interpreterQuickPick, interpreterPathService); + const pathUtils = ext.legacyIOC.serviceContainer.get(IPathUtils); + registerCreateEnvironmentFeatures(ext.disposables, interpreterQuickPick, interpreterPathService, pathUtils); } /// ////////////////////////// diff --git a/src/client/pythonEnvironments/creation/createEnvApi.ts b/src/client/pythonEnvironments/creation/createEnvApi.ts index 76263dd9315a..b05670feae02 100644 --- a/src/client/pythonEnvironments/creation/createEnvApi.ts +++ b/src/client/pythonEnvironments/creation/createEnvApi.ts @@ -3,7 +3,7 @@ import { ConfigurationTarget, Disposable } from 'vscode'; import { Commands } from '../../common/constants'; -import { IDisposableRegistry, IInterpreterPathService } from '../../common/types'; +import { IDisposableRegistry, IInterpreterPathService, IPathUtils } from '../../common/types'; import { registerCommand } from '../../common/vscodeApis/commandApis'; import { IInterpreterQuickPick } from '../../interpreter/configuration/types'; import { getCreationEvents, handleCreateEnvironmentCommand } from './createEnvironment'; @@ -48,6 +48,7 @@ export function registerCreateEnvironmentFeatures( disposables: IDisposableRegistry, interpreterQuickPick: IInterpreterQuickPick, interpreterPathService: IInterpreterPathService, + pathUtils: IPathUtils, ): void { disposables.push( registerCommand( @@ -64,7 +65,7 @@ export function registerCreateEnvironmentFeatures( onCreateEnvironmentExited(async (e: CreateEnvironmentResult | undefined) => { if (e && e.path) { await interpreterPathService.update(e.uri, ConfigurationTarget.WorkspaceFolder, e.path); - showInformationMessage(`${CreateEnv.informEnvCreation} ${e.path}`); + showInformationMessage(`${CreateEnv.informEnvCreation} ${pathUtils.getDisplayName(e.path)}`); } }), );