Skip to content

Commit cfaa193

Browse files
authored
Empty reason while switching profile (fix microsoft#183775) (microsoft#183904)
1 parent 4690a06 commit cfaa193

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/vs/workbench/services/extensions/common/abstractExtensionService.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { Barrier } from 'vs/base/common/async';
7+
import { toErrorMessage } from 'vs/base/common/errorMessage';
78
import { Emitter } from 'vs/base/common/event';
89
import { Disposable } from 'vs/base/common/lifecycle';
910
import { Schemas } from 'vs/base/common/network';
@@ -653,7 +654,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
653654

654655
private async _doStopExtensionHostsWithVeto(reason: string): Promise<boolean> {
655656
const vetos: (boolean | Promise<boolean>)[] = [];
656-
const vetoReasons: string[] = [];
657+
const vetoReasons = new Set<string>();
657658

658659
this._onWillStop.fire({
659660
reason,
@@ -662,13 +663,15 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
662663

663664
if (typeof value === 'boolean') {
664665
if (value === true) {
665-
vetoReasons.push(reason);
666+
vetoReasons.add(reason);
666667
}
667668
} else {
668669
value.then(value => {
669670
if (value) {
670-
vetoReasons.push(reason);
671+
vetoReasons.add(reason);
671672
}
673+
}).catch(error => {
674+
vetoReasons.add(nls.localize('extensionStopVetoError', "{0} (Error: {1})", reason, toErrorMessage(error)));
672675
});
673676
}
674677
}
@@ -678,13 +681,15 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
678681
if (!veto) {
679682
this._doStopExtensionHosts();
680683
} else {
681-
this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasons.join(', ')})`);
684+
const vetoReasonsArray = Array.from(vetoReasons);
685+
686+
this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasonsArray.join(', ')})`);
682687

683688
await this._dialogService.warn(
684689
nls.localize('extensionStopVetoMessage', "The following operation was blocked: {0}", reason),
685-
vetoReasons.length === 1 ?
686-
nls.localize('extensionStopVetoDetailsOne', "The reason for blocking the operation: {0}", vetoReasons[0]) :
687-
nls.localize('extensionStopVetoDetailsMany', "The reasons for blocking the operation:\n- {0}", vetoReasons.join('\n -')),
690+
vetoReasonsArray.length === 1 ?
691+
nls.localize('extensionStopVetoDetailsOne', "The reason for blocking the operation: {0}", vetoReasonsArray[0]) :
692+
nls.localize('extensionStopVetoDetailsMany', "The reasons for blocking the operation:\n- {0}", vetoReasonsArray.join('\n -')),
688693
);
689694
}
690695

0 commit comments

Comments
 (0)