Skip to content

Commit

Permalink
Resolve command URL eventually (microsoft#178061)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl authored Mar 23, 2023
1 parent b89e5e0 commit 46d7e02
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/vs/workbench/contrib/remote/browser/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ class HelpItemValue {
if (url.authority) {
this._url = this.urlOrCommand;
} else {
const urlCommand: Promise<string | undefined> = this.commandService.executeCommand(this.urlOrCommand);
const urlCommand: Promise<string | undefined> = this.commandService.executeCommand(this.urlOrCommand).then((result) => {
// if executing this command times out, cache its value whenever it eventually resolves
this._url = result;
return this._url;
});
// We must be defensive. The command may never return, meaning that no help at all is ever shown!
const emptyString: Promise<string> = new Promise(resolve => setTimeout(() => resolve(''), 500));
this._url = await Promise.race([urlCommand, emptyString]);
Expand Down

0 comments on commit 46d7e02

Please sign in to comment.