From d6a72b9dbf6599040d26325f64840bebe721ddb6 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 4 Dec 2024 08:49:00 -0800 Subject: [PATCH 1/4] Fix naming --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index dd140138..f534f428 100644 --- a/package.json +++ b/package.json @@ -90,13 +90,13 @@ }, { "command": "python-envs.addPythonProject", - "title": "Add Python Workspace", + "title": "Add Python Project", "category": "Python", "icon": "$(new-folder)" }, { "command": "python-envs.removePythonProject", - "title": "Remove Python Workspace", + "title": "Remove Python Project", "category": "Python", "icon": "$(remove)" }, @@ -387,25 +387,25 @@ "viewsContainers": { "activitybar": [ { - "id": "python-environments", - "title": "Python Environments", + "id": "python", + "title": "Python", "icon": "files/logo.svg" } ] }, "views": { - "python-environments": [ + "python": [ { "id": "python-projects", "name": "Python Projects", "icon": "files/logo.svg", - "contextualTitle": "Workspace Environment" + "contextualTitle": "Python Projects" }, { "id": "env-managers", "name": "Environment Managers", "icon": "files/logo.svg", - "contextualTitle": "Environment Manager" + "contextualTitle": "Environment Managers" } ] }, From 0ec2e03f53b3d665bb4e67e3ed9171dcbe3d6161 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 4 Dec 2024 08:49:21 -0800 Subject: [PATCH 2/4] Fix terminal for global envs --- src/features/envCommands.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/features/envCommands.ts b/src/features/envCommands.ts index 22450dc1..0bd7bfbc 100644 --- a/src/features/envCommands.ts +++ b/src/features/envCommands.ts @@ -479,6 +479,13 @@ export async function createTerminalCommand( terminal.show(); return terminal; } + } else if (context instanceof GlobalProjectItem) { + const env = await api.getEnvironment(undefined); + if (env) { + const terminal = await tm.create(env, { cwd: undefined }); + terminal.show(); + return terminal; + } } else if (context instanceof PythonEnvTreeItem) { const view = context as PythonEnvTreeItem; const pw = await pickProject(api.getPythonProjects()); From 3b4949123ad00d979eec3f81f02c6e51dbbff39f Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 4 Dec 2024 08:49:35 -0800 Subject: [PATCH 3/4] Fix packages for global envs --- src/features/views/projectView.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/features/views/projectView.ts b/src/features/views/projectView.ts index 5da92977..dfd976bd 100644 --- a/src/features/views/projectView.ts +++ b/src/features/views/projectView.ts @@ -188,14 +188,15 @@ export class WorkspaceView implements TreeDataProvider { if (element.kind === ProjectTreeItemKind.environment) { const environmentItem = element as ProjectEnvironment; const parent = environmentItem.parent; - const pkgManager = this.envManagers.getPackageManager(parent.project.uri); + const uri = parent.id === 'global' ? undefined : parent.project.uri; + const pkgManager = this.envManagers.getPackageManager(uri); const environment = environmentItem.environment; const views: ProjectTreeItem[] = []; if (pkgManager) { const item = new ProjectPackageRootTreeItem(environmentItem, pkgManager, environment); - this.packageRoots.set(environmentItem.parent.project.uri.fsPath, item); + this.packageRoots.set(uri ? uri.fsPath : 'global', item); views.push(item); } else { views.push(new ProjectEnvironmentInfo(environmentItem, 'No package manager found')); From 42130b40284d55f8536992941db841a77adedb05 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 4 Dec 2024 08:54:49 -0800 Subject: [PATCH 4/4] Activate button is hidden by default --- package.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f534f428..bc67a7ee 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,16 @@ } } } + }, + "python-envs.showActivateButton": { + "type": "boolean", + "description": "Show the activate button in the terminal", + "default": false, + "scope": "machine", + "tags": [ + "onExP", + "preview" + ] } } }, @@ -376,11 +386,11 @@ "terminal/title/context": [ { "command": "python-envs.terminal.activate", - "when": "pythonTerminalActivation && !pythonTerminalActivated" + "when": "config.python-envs.showActivateButton && pythonTerminalActivation && !pythonTerminalActivated" }, { "command": "python-envs.terminal.deactivate", - "when": "pythonTerminalActivation && pythonTerminalActivated" + "when": "config.python-envs.showActivateButton && pythonTerminalActivation && pythonTerminalActivated" } ] },