diff --git a/package.json b/package.json index 387964d4..828dde96 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,12 @@ "category": "Python", "icon": "$(new-folder)" }, + { + "command": "python-envs.addPythonProjectGivenResource", + "title": "%python-envs.addPythonProjectGivenResource.title%", + "category": "Python", + "icon": "$(new-folder)" + }, { "command": "python-envs.removePythonProject", "title": "%python-envs.removePythonProject.title%", @@ -292,6 +298,10 @@ "command": "python-envs.addPythonProject", "when": "false" }, + { + "command": "python-envs.addPythonProjectGivenResource", + "when": "false" + }, { "command": "python-envs.removePythonProject", "when": "false" @@ -455,12 +465,12 @@ ], "explorer/context": [ { - "command": "python-envs.addPythonProject", + "command": "python-envs.addPythonProjectGivenResource", "group": "inline", "when": "explorerViewletVisible && explorerResourceIsFolder && !python-envs:isExistingProject" }, { - "command": "python-envs.addPythonProject", + "command": "python-envs.addPythonProjectGivenResource", "group": "inline", "when": "explorerViewletVisible && resourceExtname == .py && !python-envs:isExistingProject" } @@ -560,4 +570,4 @@ "vscode-jsonrpc": "^9.0.0-next.5", "which": "^4.0.0" } -} \ No newline at end of file +} diff --git a/package.nls.json b/package.nls.json index 2199961b..5c740518 100644 --- a/package.nls.json +++ b/package.nls.json @@ -13,7 +13,8 @@ "python-envs.terminal.revertStartupScriptChanges.title": "Revert Shell Startup Script Changes", "python-envs.setEnvManager.title": "Set Environment Manager", "python-envs.setPkgManager.title": "Set Package Manager", - "python-envs.addPythonProject.title": "Add as Python Project", + "python-envs.addPythonProject.title": "Add Python Project", + "python-envs.addPythonProjectGivenResource.title": "Add as Python Project", "python-envs.removePythonProject.title": "Remove Python Project", "python-envs.copyEnvPath.title": "Copy Environment Path", "python-envs.copyProjectPath.title": "Copy Project Path", @@ -35,4 +36,4 @@ "python-envs.terminal.activate.title": "Activate Environment in Current Terminal", "python-envs.terminal.deactivate.title": "Deactivate Environment in Current Terminal", "python-envs.uninstallPackage.title": "Uninstall Package" -} \ No newline at end of file +} diff --git a/src/extension.ts b/src/extension.ts index 31e6477b..1ab8e7b9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -199,7 +199,10 @@ export async function activate(context: ExtensionContext): Promise { await setPackageManagerCommand(envManagers, projectManager); }), - commands.registerCommand('python-envs.addPythonProject', async (resource) => { + commands.registerCommand('python-envs.addPythonProject', async () => { + await addPythonProjectCommand(undefined, projectManager, envManagers, projectCreators); + }), + commands.registerCommand('python-envs.addPythonProjectGivenResource', async (resource) => { // Set context to show/hide menu item depending on whether the resource is already a Python project if (resource instanceof Uri) { commands.executeCommand('setContext', 'python-envs:isExistingProject', isExistingProject(resource));