|
| 1 | +'use strict'; |
| 2 | + |
1 | 3 | import * as fs from 'fs'; |
2 | 4 | import * as path from 'path'; |
3 | 5 | import * as vscode from 'vscode'; |
@@ -47,25 +49,21 @@ export class PDKFeature implements IFeature { |
47 | 49 | { id: 'extension.pdkNewDefinedType', request: 'pdk new defined_type', type: 'Puppet defined_type' }, |
48 | 50 | ].forEach((command) => { |
49 | 51 | context.subscriptions.push( |
50 | | - vscode.commands.registerCommand(command.id, () => { |
51 | | - const nameOpts: vscode.QuickPickOptions = { |
52 | | - placeHolder: `Enter a name for the new ${command.type}`, |
53 | | - matchOnDescription: true, |
54 | | - matchOnDetail: true, |
55 | | - }; |
56 | | - |
57 | | - vscode.window.showInputBox(nameOpts).then((name) => { |
58 | | - if (name === undefined) { |
59 | | - vscode.window.showWarningMessage(`No ${command.type} value specifed. Exiting.`); |
60 | | - return; |
61 | | - } |
62 | | - const request = `${command.request} ${name}`; |
63 | | - this.terminal.sendText(request); |
64 | | - this.terminal.show(); |
65 | | - if (reporter) { |
66 | | - reporter.sendTelemetryEvent(command.id); |
67 | | - } |
| 52 | + vscode.commands.registerCommand(command.id, async () => { |
| 53 | + const name = await vscode.window.showInputBox({ |
| 54 | + prompt: `Enter a name for the new ${command.type}`, |
68 | 55 | }); |
| 56 | + if (name === undefined) { |
| 57 | + vscode.window.showWarningMessage('No module name specifed. Exiting.'); |
| 58 | + return; |
| 59 | + } |
| 60 | + |
| 61 | + const request = `${command.request} ${name}`; |
| 62 | + this.terminal.sendText(request); |
| 63 | + this.terminal.show(); |
| 64 | + if (reporter) { |
| 65 | + reporter.sendTelemetryEvent(command.id); |
| 66 | + } |
69 | 67 | }), |
70 | 68 | ); |
71 | 69 | logger.debug(`Registered ${command.id} command`); |
|
0 commit comments