-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure all callbacks in registerCommand return objects properly #1154
Labels
bug
Something isn't working
Comments
github-project-automation
bot
moved this to Unscreened
in Swift Extension for Visual Studio Code
Oct 21, 2024
michael-weng
added a commit
to michael-weng/vscode-swift
that referenced
this issue
Oct 21, 2024
- If the exist function return void, just return true in the end after the function complete execution. - Otherwise explicitly return the object. Issue: swiftlang#1154
michael-weng
added a commit
to michael-weng/vscode-swift
that referenced
this issue
Oct 21, 2024
michael-weng
added a commit
to michael-weng/vscode-swift
that referenced
this issue
Oct 21, 2024
plemarquand
changed the title
Make sure all callbacks in registrerCommand return objects properly
Make sure all callbacks in registerCommand return objects properly
Oct 21, 2024
michael-weng
added a commit
to michael-weng/vscode-swift
that referenced
this issue
Oct 22, 2024
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
This will be verified by #1144 passing. |
To resister command callbacks return is propagated but the callback itself may not return anything |
award999
moved this from Needs Verification
to Unscreened
in Swift Extension for Visual Studio Code
Oct 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Found this when implementing (#1144)
function commands.registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): vscode.Disposable
As show the callback param can return 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.
example:
vscode.commands.registerCommand(COMMANDS.UseLocalDependency, item => {
if (item instanceof PackageNode) {
useLocalDependency(item.name, ctx);
}
}),
the above should return the promise returned by useLocalDependency
Expected behavior
All executeCommand of registered command properly return the right objects.
Environment
The text was updated successfully, but these errors were encountered: