Skip to content

Commit c3b64e0

Browse files
authored
Properly return in all registerCommand when not doing implicit return (swiftlang#1155)
The callback param of registerCommand returns type any, and if we are not care with implicit return of arrow function expressions it's easy to miss this and as a result execute command will not be able to return the promise as expected. Issue: swiftlang#1154
1 parent 3912833 commit c3b64e0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/commands.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ export function register(ctx: WorkspaceContext): vscode.Disposable[] {
7979
vscode.commands.registerCommand("swift.cleanBuild", () => cleanBuild(ctx)),
8080
vscode.commands.registerCommand("swift.runTestsMultipleTimes", item => {
8181
if (ctx.currentFolder) {
82-
runTestMultipleTimes(ctx.currentFolder, item, false);
82+
return runTestMultipleTimes(ctx.currentFolder, item, false);
8383
}
8484
}),
8585
vscode.commands.registerCommand("swift.runTestsUntilFailure", item => {
8686
if (ctx.currentFolder) {
87-
runTestMultipleTimes(ctx.currentFolder, item, true);
87+
return runTestMultipleTimes(ctx.currentFolder, item, true);
8888
}
8989
}),
9090
// Note: This is only available on macOS (gated in `package.json`) because its the only OS that has the iOS SDK available.
@@ -93,7 +93,7 @@ export function register(ctx: WorkspaceContext): vscode.Disposable[] {
9393
vscode.commands.registerCommand("swift.runScript", () => runSwiftScript(ctx)),
9494
vscode.commands.registerCommand("swift.openPackage", () => {
9595
if (ctx.currentFolder) {
96-
openPackage(ctx.toolchain.swiftVersion, ctx.currentFolder.folder);
96+
return openPackage(ctx.toolchain.swiftVersion, ctx.currentFolder.folder);
9797
}
9898
}),
9999
vscode.commands.registerCommand("swift.runSnippet", () => runSnippet(ctx)),
@@ -108,27 +108,27 @@ export function register(ctx: WorkspaceContext): vscode.Disposable[] {
108108
),
109109
vscode.commands.registerCommand("swift.useLocalDependency", item => {
110110
if (item instanceof PackageNode) {
111-
useLocalDependency(item.name, ctx);
111+
return useLocalDependency(item.name, ctx);
112112
}
113113
}),
114114
vscode.commands.registerCommand("swift.editDependency", item => {
115115
if (item instanceof PackageNode) {
116-
editDependency(item.name, ctx);
116+
return editDependency(item.name, ctx);
117117
}
118118
}),
119119
vscode.commands.registerCommand("swift.uneditDependency", item => {
120120
if (item instanceof PackageNode) {
121-
uneditDependency(item.name, ctx);
121+
return uneditDependency(item.name, ctx);
122122
}
123123
}),
124124
vscode.commands.registerCommand("swift.openInWorkspace", item => {
125125
if (item instanceof PackageNode) {
126-
openInWorkspace(item);
126+
return openInWorkspace(item);
127127
}
128128
}),
129129
vscode.commands.registerCommand("swift.openExternal", item => {
130130
if (item instanceof PackageNode) {
131-
openInExternalEditor(item);
131+
return openInExternalEditor(item);
132132
}
133133
}),
134134
vscode.commands.registerCommand("swift.attachDebugger", () => attachDebugger(ctx)),

0 commit comments

Comments
 (0)