Skip to content

Commit 5888901

Browse files
committed
(maint) Fix calling pdk when input is null
Prevent calling pdk new 'thing' when the user did not enter a value when prompted.
1 parent 6ddd9c6 commit 5888901

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/feature/PDKFeature.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ export class PDKFeature implements IFeature {
9292
matchOnDescription: true,
9393
matchOnDetail: true,
9494
};
95-
vscode.window.showInputBox(nameOpts).then((moduleName) => {
96-
this.terminal.sendText(`pdk new class ${moduleName}`);
95+
vscode.window.showInputBox(nameOpts).then((className) => {
96+
if (className === undefined) {
97+
vscode.window.showWarningMessage('No class name specifed. Exiting.');
98+
return;
99+
}
100+
this.terminal.sendText(`pdk new class ${className}`);
97101
this.terminal.show();
98102
if (reporter) {
99103
reporter.sendTelemetryEvent(PDKCommandStrings.PdkNewClassCommandId);
@@ -108,6 +112,10 @@ export class PDKFeature implements IFeature {
108112
matchOnDetail: true,
109113
};
110114
vscode.window.showInputBox(nameOpts).then((taskName) => {
115+
if (taskName === undefined) {
116+
vscode.window.showWarningMessage('No task name specifed. Exiting.');
117+
return;
118+
}
111119
this.terminal.sendText(`pdk new task ${taskName}`);
112120
this.terminal.show();
113121
if (reporter) {
@@ -123,6 +131,10 @@ export class PDKFeature implements IFeature {
123131
matchOnDetail: true,
124132
};
125133
vscode.window.showInputBox(nameOpts).then((typeName) => {
134+
if (typeName === undefined) {
135+
vscode.window.showWarningMessage('No defined type name specifed. Exiting.');
136+
return;
137+
}
126138
this.terminal.sendText(`pdk new defined_type ${typeName}`);
127139
this.terminal.show();
128140
if (reporter) {

0 commit comments

Comments
 (0)