Skip to content

Commit 0637622

Browse files
Merge pull request #157 from augustocdias/issue_151
Fix dismissing the popup without selecting anything
2 parents e8ec668 + 6236015 commit 0637622

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [1.19.1] 2025-07-02
4+
5+
- Fix empty string perceived when dismissing the popup (#151)
6+
37
## [1.19.0] 2025-07-02
48

59
- Allow not filtering empty results (#155)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Tasks Shell Input",
44
"description": "Use shell commands as input for your tasks",
55
"icon": "icon.png",
6-
"version": "1.19.0",
6+
"version": "1.19.1",
77
"publisher": "augustocdias",
88
"repository": {
99
"url": "https://github.com/augustocdias/vscode-shell-command"

src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ import { ShellCommandException } from './util/exceptions';
99
export function activate(this: any, context: vscode.ExtensionContext) {
1010
const userInputContext = new UserInputContext(context);
1111

12-
const handleExecute = (args: { [key: string]: unknown }) => {
12+
const handleExecute = async (args: { [key: string]: unknown }) => {
1313
try {
1414
const handler = new CommandHandler(args, userInputContext, context, subprocess);
15-
return handler.handle();
15+
const result = await handler.handle();
16+
return result;
1617
} catch (error) {
1718
const message = (error instanceof ShellCommandException)
1819
? error.message
1920
: 'Error executing shell command: ' + error;
2021

2122
console.error(error);
22-
vscode.window.showErrorMessage(message);
23+
throw message;
2324
}
2425
};
2526

src/lib/CommandHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export class CommandHandler {
285285
const defaultValues = this.getDefault();
286286
let disposable: vscode.Disposable;
287287

288-
return new Promise<string[] | undefined>((resolve) => {
288+
return new Promise<string[] | undefined>((resolve, reject) => {
289289
const picker = vscode.window.createQuickPick();
290290
picker.canSelectMany = this.args.multiselect!;
291291
picker.matchOnDescription = true;
@@ -323,7 +323,7 @@ export class CommandHandler {
323323
const result = CommandHandler.transformSelection(picker);
324324

325325
if (didCancelQuickPickSession) {
326-
resolve(undefined);
326+
reject(new ShellCommandException("Cancelled"));
327327
} else if (this.input.id && (undefined !== result)) {
328328
resolve(result);
329329
} else {

0 commit comments

Comments
 (0)