diff --git a/package.json b/package.json index dd140138..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" + ] } } }, @@ -90,13 +100,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)" }, @@ -376,36 +386,36 @@ "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" } ] }, "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" } ] }, 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()); 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'));