Skip to content

ShowQuickPick does not fulfil the promises #11754

Closed

Description

  • VSCode Version: 1.5.1
  • OS Version: OSX 10.11.6

I developed an extension for VSCode and since the newest update (this morning) I've got a serious problem:

public addImportPick(activeDocument: TextEditor): Thenable<ResolveQuickPickItem> {
    return window.showQuickPick(this.buildQuickPickList(activeDocument));
}

buildQuickPickList does produce a Promise

When I call showQuickPick in such a manner, the following error occurs:

TypeError: e.done is not a function
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:6:23142
    at new n.Class.derive._oncancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:5:26897)
    at f (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:6:23109)
    at Object.h [as wireCancellationToken] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:6:23050)
    at t.showQuickPick (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:12:14157)
    at Object.I.window.showQuickPick (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:12:30588)
    at ResolveQuickPickProvider.addImportPick (/Users/christoph/Documents/Development/typescript-hero/out/src/provider/ResolveQuickPickProvider.js:29:32)
    at ResolveExtension.addImport (/Users/christoph/Documents/Development/typescript-hero/out/src/extensions/ResolveExtension.js:117:27)
    at /Users/christoph/Documents/Development/typescript-hero/out/src/extensions/ResolveExtension.js:74:143
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:12:29049

Is this caused by the update ?

Activity

  1. buehler commented on Sep 9, 2016

    @buehler
    Author

    Update: just investigated..
    when I resolve the promise myself, it works.

     return this.buildQuickPickList(activeDocument)
                .then(resolveItems => {
                    return window.showQuickPick(resolveItems);
                });
  2. added
    bug
    on Sep 9, 2016
  3. jrieken commented on Sep 9, 2016

    @jrieken
    Contributor

    Christoph Bühler (@buehler) Just to confirm my theory - this.buildQuickPickList returns a native promise, correct?

  4. buehler commented on Sep 9, 2016

    @buehler
    Author

    Johannes Rieken (@jrieken) exactly :-)

    As a bonus question: why don't you guys use native promises? (Why the Thenable<>)
    Edit: I'm actually curious

  5. jrieken commented on Sep 9, 2016

    @jrieken
    Contributor

    Yeah - that can only be answered with the history of the project. When we started some time ago there was no native promise yet. We then went with WinJS-promises. Since WinJS.Promise and native promise have incompatibilities (like done, cancel, progress-callback etc) the migration isn't easy (which is the same for everyone using another promise implementation).

  6. added
    important
    on Sep 9, 2016
  7. added 2 commits that reference this issue on Sep 9, 2016
    55b4ba7
    8ba61cd
  8. jrieken commented on Sep 9, 2016

    @jrieken
    Contributor

    to verify

    have an extension that runs the below code (for instance as part of a command) and make sure no errors are thrown

     vscode.window.showQuickPick(Promise.resolve(['abc', 'def', 'ghi'])).then(p => console.log(p));
    
  9. locked and limited conversation to collaborators on Nov 18, 2017
  10. added a commit that references this issue on Sep 6, 2026
    f670563
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apibugimportantverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions