Skip to content

Commit effd50d

Browse files
committed
adding menu items for ux
1 parent 01eda1e commit effd50d

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { commands, ExtensionContext, LogOutputChannel, Terminal, Uri } from 'vsc
33
import { PythonEnvironmentManagers } from './features/envManagers';
44
import { registerLogger, traceInfo } from './common/logging';
55
import { EnvManagerView } from './features/views/envManagersView';
6+
import { NewPackageProject } from './features/creators/newPackageProject';
7+
import { NewScriptProject } from './features/creators/newScriptProject';
68
import {
79
addPythonProject,
810
createEnvironmentCommand,
@@ -90,6 +92,8 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
9092
projectCreators,
9193
projectCreators.registerPythonProjectCreator(new ExistingProjects()),
9294
projectCreators.registerPythonProjectCreator(new AutoFindProjects(projectManager)),
95+
projectCreators.registerPythonProjectCreator(new NewPackageProject(projectManager)),
96+
projectCreators.registerPythonProjectCreator(new NewScriptProject(projectManager)),
9397
);
9498

9599
setPythonApi(envManagers, projectManager, projectCreators, terminalManager, envVarManager);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { LogOutputChannel, MarkdownString, window } from 'vscode';
2+
import { PythonProject, PythonProjectCreator, PythonProjectCreatorOptions } from '../../api';
3+
import { PythonProjectManager } from '../../internal.api';
4+
// import { runInBackground } from '../execution/runInBackground';
5+
6+
export class NewPackageProject implements PythonProjectCreator {
7+
public readonly name = 'newPackage';
8+
public readonly displayName = 'New Python Package';
9+
public readonly description = 'Create a new Python package project';
10+
public readonly tooltip = new MarkdownString('Create a new Python package with proper structure');
11+
12+
constructor(private readonly pm: PythonProjectManager, private log: LogOutputChannel) {}
13+
14+
async create(_options?: PythonProjectCreatorOptions): Promise<PythonProject | undefined> {
15+
// show notification that the pkg creation was selected than return undefined
16+
window.showInformationMessage('Creating a new Python package project...');
17+
return undefined;
18+
}
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { MarkdownString, window } from 'vscode';
2+
import { PythonProject, PythonProjectCreator, PythonProjectCreatorOptions } from '../../api';
3+
import { PythonProjectManager } from '../../internal.api';
4+
5+
export class NewScriptProject implements PythonProjectCreator {
6+
public readonly name = 'newScript';
7+
public readonly displayName = 'New Python Script';
8+
public readonly description = 'Create a new Python script project';
9+
public readonly tooltip = new MarkdownString('Create a new Python script with basic structure');
10+
11+
constructor(private readonly pm: PythonProjectManager) {}
12+
13+
async create(_options?: PythonProjectCreatorOptions): Promise<PythonProject | undefined> {
14+
// show notification that the script creation was selected than return undefined
15+
window.showInformationMessage('Creating a new Python script project...');
16+
return undefined;
17+
}
18+
}

0 commit comments

Comments
 (0)