Skip to content

Fix bugs found during TPI #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 4, 2024
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
28 changes: 19 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@
}
}
}
},
"python-envs.showActivateButton": {
"type": "boolean",
"description": "Show the activate button in the terminal",
"default": false,
"scope": "machine",
"tags": [
"onExP",
"preview"
]
}
}
},
Expand All @@ -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)"
},
Expand Down Expand Up @@ -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"
}
]
},
Expand Down
7 changes: 7 additions & 0 deletions src/features/envCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 3 additions & 2 deletions src/features/views/projectView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,15 @@ export class WorkspaceView implements TreeDataProvider<ProjectTreeItem> {
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'));
Expand Down
Loading