Skip to content

Commit

Permalink
merge with upstream changes with maxListener on events
Browse files Browse the repository at this point in the history
Change-Id: I22313a01998bb965152db0385f6adcd96e3998ae
Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Jun 20, 2018
1 parent 83f47f5 commit d0f4dca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ export function createAPI(rpc: RPCProtocol): typeof theia {

const window: typeof theia.window = {
showQuickPick(items: any, options: theia.QuickPickOptions, token?: theia.CancellationToken): any {
return quickOpenExt.showQuickPick(items, options, token);
if (token) {
const coreEvent = Object.assign(token.onCancellationRequested, { maxListeners: 0 });
const coreCancellationToken = { isCancellationRequested: token.isCancellationRequested, onCancellationRequested: coreEvent };
return quickOpenExt.showQuickPick(items, options, coreCancellationToken);
} else {
return quickOpenExt.showQuickPick(items, options);
}
},
showInformationMessage(message: string,
optionsOrFirstItem: theia.MessageOptions | string | theia.MessageItem,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ declare module '@theia/plugin' {
* An event emitted when cancellation is requested
* @event
*/
readonly onCancellationRequested: Event<void>;
readonly onCancellationRequested: Event<any>;


}

/**
Expand Down

0 comments on commit d0f4dca

Please sign in to comment.