diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index a45c93270c5f..e090435e0cf1 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -304,6 +304,12 @@ export namespace InterpreterQuickPickList { 'Use Python from `python.defaultInterpreterPath` setting', ), }; + export const tooltipMessages = { + notUsingVirtualEnv: localize( + 'InterpreterQuickPickList.tooltipMessages.notUsingVirtualEnv', + "It's recommended to create a virtual environment to keep the project's dependencies isolated from the system ones", + ), + }; export const browsePath = { label: localize('InterpreterQuickPickList.browsePath.label', 'Find...'), detail: localize( diff --git a/src/client/interpreter/display/index.ts b/src/client/interpreter/display/index.ts index 437418304bb9..97ad04673436 100644 --- a/src/client/interpreter/display/index.ts +++ b/src/client/interpreter/display/index.ts @@ -16,7 +16,7 @@ import { IDisposableRegistry, IPathUtils, Resource } from '../../common/types'; import { InterpreterQuickPickList } from '../../common/utils/localize'; import { IServiceContainer } from '../../ioc/types'; import { traceLog } from '../../logging'; -import { PythonEnvironment } from '../../pythonEnvironments/info'; +import { PythonEnvironment, virtualEnvTypes } from '../../pythonEnvironments/info'; import { IInterpreterDisplay, IInterpreterHelper, @@ -139,6 +139,12 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle this.statusBar.text = text ?? ''; this.statusBar.backgroundColor = undefined; this.currentlySelectedInterpreterDisplay = interpreter.detailedDisplayName; + if (!virtualEnvTypes.includes(interpreter.envType)) { + const application = this.serviceContainer.get(IApplicationShell); + application.showWarningMessage(InterpreterQuickPickList.tooltipMessages.notUsingVirtualEnv); + this.statusBar.tooltip = InterpreterQuickPickList.tooltipMessages.notUsingVirtualEnv; + this.statusBar.text = `$(alert) ${this.statusBar.text}`; + } } else { this.statusBar.tooltip = ''; this.statusBar.color = '';