Skip to content

Commit d87a8cd

Browse files
committed
Add some defensive strategy to command urls in remote help
Fixes microsoft/vscode-remote-release#3612
1 parent 8d25a72 commit d87a8cd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • src/vs/workbench/contrib/remote/browser

src/vs/workbench/contrib/remote/browser/remote.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ class HelpItemValue {
281281
if (url.authority) {
282282
this._url = this.urlOrCommand;
283283
} else {
284-
this._url = await this.commandService.executeCommand(this.urlOrCommand);
284+
const urlCommand: Promise<string | undefined> = this.commandService.executeCommand(this.urlOrCommand);
285+
// We must be defensive. The command may never return, meaning that no help at all is ever shown!
286+
const emptyString: Promise<string> = new Promise(resolve => setTimeout(() => resolve(''), 500));
287+
this._url = await Promise.race([urlCommand, emptyString]);
285288
}
286289
} else {
287290
this._url = '';
@@ -326,13 +329,13 @@ abstract class HelpItemBase implements IHelpItem {
326329
}
327330

328331
if (this.values.length > 1) {
329-
let actions = await Promise.all(this.values.map(async (value) => {
332+
let actions = (await Promise.all(this.values.map(async (value) => {
330333
return {
331334
label: value.extensionDescription.displayName || value.extensionDescription.identifier.value,
332335
description: await value.url,
333336
extensionDescription: value.extensionDescription
334337
};
335-
}));
338+
}))).filter(item => item.description);
336339

337340
const action = await this.quickInputService.pick(actions, { placeHolder: nls.localize('pickRemoteExtension', "Select url to open") });
338341

0 commit comments

Comments
 (0)