Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"onLanguageModelTool:get_python_environment_details",
"onLanguageModelTool:get_python_executable_details",
"onLanguageModelTool:install_python_packages",
"onLanguageModelTool:configure_python_environment"
"onLanguageModelTool:configure_python_environment",
"onLanguageModelTool:create_virtual_environment"
],
"main": "./out/client/extension",
"browser": "./dist/extension.browser.js",
Expand Down Expand Up @@ -1523,6 +1524,7 @@
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment. ALWAYS call configure_python_environment before using this tool.",
"toolReferenceName": "pythonInstallPackage",
"tags": [
"install python package",
"extension_installed_by_tool",
"enable_other_tool_configure_python_environment"
],
Expand Down Expand Up @@ -1576,9 +1578,7 @@
"name": "create_virtual_environment",
"displayName": "Create a Virtual Environment",
"modelDescription": "This tool will create a Virual Environment",
"tags": [
"extension_installed_by_tool"
],
"tags": [],
"canBeReferencedInPrompt": false,
"inputSchema": {
"type": "object",
Expand All @@ -1596,9 +1596,7 @@
"name": "selectEnvironment",
"displayName": "Select a Python Environment",
"modelDescription": "This tool will prompt the user to select an existing Python Environment",
"tags": [
"extension_installed_by_tool"
],
"tags": [],
"canBeReferencedInPrompt": false,
"inputSchema": {
"type": "object",
Expand Down
6 changes: 5 additions & 1 deletion src/client/chat/configurePythonEnvTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ITerminalHelper } from '../common/terminal/types';
import { IRecommendedEnvironmentService } from '../interpreter/configuration/types';
import { CreateVirtualEnvTool } from './createVirtualEnvTool';
import { ISelectPythonEnvToolArguments, SelectPythonEnvTool } from './selectEnvTool';
import { useEnvExtension } from '../envExt/api.internal';

export class ConfigurePythonEnvTool implements LanguageModelTool<IResourceReference> {
private readonly terminalExecutionService: TerminalCodeExecutionProvider;
Expand Down Expand Up @@ -77,7 +78,10 @@ export class ConfigurePythonEnvTool implements LanguageModelTool<IResourceRefere

if (await this.createEnvTool.shouldCreateNewVirtualEnv(resource, token)) {
try {
return await lm.invokeTool(CreateVirtualEnvTool.toolName, options, token);
// If the Python Env extension is available, then use that.
// create_quick_virtual_environment
const toolName = useEnvExtension() ? 'create_quick_virtual_environment' : CreateVirtualEnvTool.toolName;
return await lm.invokeTool(toolName, options, token);
} catch (ex) {
if (isCancellationError(ex)) {
const input: ISelectPythonEnvToolArguments = {
Expand Down
1 change: 1 addition & 0 deletions src/client/chat/createVirtualEnvTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class CreateVirtualEnvTool implements LanguageModelTool<IResourceReferenc
title: l10n.t('Create a Virtual Environment{0}?', version ? ` (${version})` : ''),
message: l10n.t(`Virtual Environments provide the benefit of package isolation and more.`),
},
invocationMessage: l10n.t('Creating a Virtual Environment'),
};
}
async hasAlreadyGotAWorkspaceSpecificEnvironment(resource: Uri | undefined) {
Expand Down