Skip to content

Commit df57b8c

Browse files
Copiloteleanorjboyd
andcommitted
Fix: Remove global context that caused menu disappearance after single use
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent 5c34078 commit df57b8c

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,12 @@
489489
{
490490
"command": "python-envs.addPythonProjectGivenResource",
491491
"group": "inline",
492-
"when": "explorerViewletVisible && explorerResourceIsFolder && !python-envs:isExistingProject"
492+
"when": "explorerViewletVisible && explorerResourceIsFolder"
493493
},
494494
{
495495
"command": "python-envs.addPythonProjectGivenResource",
496496
"group": "inline",
497-
"when": "explorerViewletVisible && resourceExtname == .py && !python-envs:isExistingProject"
497+
"when": "explorerViewletVisible && resourceExtname == .py"
498498
}
499499
],
500500
"editor/title/run": [

src/extension.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,6 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
189189
const projectManager: PythonProjectManager = new PythonProjectManagerImpl();
190190
context.subscriptions.push(projectManager);
191191

192-
// Helper function to check if a resource is an existing Python project
193-
const isExistingProject = (uri: Uri | undefined): boolean => {
194-
if (!uri) {
195-
return false;
196-
}
197-
return projectManager.get(uri) !== undefined;
198-
};
199-
200192
const envVarManager: EnvVarManager = new PythonEnvVariableManager(projectManager);
201193
context.subscriptions.push(envVarManager);
202194

@@ -323,11 +315,6 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
323315
});
324316
}),
325317
commands.registerCommand('python-envs.addPythonProjectGivenResource', async (resource) => {
326-
// Set context to show/hide menu item depending on whether the resource is already a Python project
327-
if (resource instanceof Uri) {
328-
commands.executeCommand('setContext', 'python-envs:isExistingProject', isExistingProject(resource));
329-
}
330-
331318
await addPythonProjectCommand(resource, projectManager, envManagers, projectCreators);
332319
const totalProjectCount = projectManager.getProjects().length + 1;
333320
sendTelemetryEvent(EventNames.ADD_PROJECT, undefined, {

0 commit comments

Comments
 (0)