Skip to content

Commit 2a3475b

Browse files
authored
1 parent 68e4866 commit 2a3475b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/vs/workbench/services/configuration/browser/configurationService.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
365365
const application = await this.reloadApplicationConfiguration(true);
366366
const { local, remote } = await this.reloadUserConfiguration();
367367
await this.reloadWorkspaceConfiguration();
368-
await this.loadConfiguration(application, local, remote);
368+
await this.loadConfiguration(application, local, remote, true);
369369
return;
370370
}
371371

@@ -381,7 +381,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
381381

382382
case ConfigurationTarget.USER: {
383383
const { local, remote } = await this.reloadUserConfiguration();
384-
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote);
384+
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote, true);
385385
return;
386386
}
387387
case ConfigurationTarget.USER_LOCAL:
@@ -436,8 +436,10 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
436436
async initialize(arg: IAnyWorkspaceIdentifier): Promise<void> {
437437
mark('code/willInitWorkspaceService');
438438

439+
const trigger = this.initialized;
440+
this.initialized = false;
439441
const workspace = await this.createWorkspace(arg);
440-
await this.updateWorkspaceAndInitializeConfiguration(workspace);
442+
await this.updateWorkspaceAndInitializeConfiguration(workspace, trigger);
441443
this.checkAndMarkWorkspaceComplete(false);
442444

443445
mark('code/didInitWorkspaceService');
@@ -529,7 +531,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
529531
}
530532
}
531533

532-
private async updateWorkspaceAndInitializeConfiguration(workspace: Workspace): Promise<void> {
534+
private async updateWorkspaceAndInitializeConfiguration(workspace: Workspace, trigger: boolean): Promise<void> {
533535
const hasWorkspaceBefore = !!this.workspace;
534536
let previousState: WorkbenchState | undefined;
535537
let previousWorkspacePath: string | undefined;
@@ -544,7 +546,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
544546
this.workspace = workspace;
545547
}
546548

547-
await this.initializeConfiguration();
549+
await this.initializeConfiguration(trigger);
548550

549551
// Trigger changes after configuration initialization so that configuration is up to date.
550552
if (hasWorkspaceBefore) {
@@ -589,7 +591,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
589591
return result;
590592
}
591593

592-
private async initializeConfiguration(): Promise<void> {
594+
private async initializeConfiguration(trigger: boolean): Promise<void> {
593595
await this.defaultConfiguration.initialize();
594596

595597
const [, application, user] = await Promise.all([
@@ -604,7 +606,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
604606
]);
605607

606608
mark('code/willInitWorkspaceConfiguration');
607-
await this.loadConfiguration(application, user.local, user.remote);
609+
await this.loadConfiguration(application, user.local, user.remote, trigger);
608610
mark('code/didInitWorkspaceConfiguration');
609611
}
610612

@@ -670,7 +672,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
670672
return this.onWorkspaceFolderConfigurationChanged(folder);
671673
}
672674

673-
private async loadConfiguration(applicationConfigurationModel: ConfigurationModel, userConfigurationModel: ConfigurationModel, remoteUserConfigurationModel: ConfigurationModel): Promise<void> {
675+
private async loadConfiguration(applicationConfigurationModel: ConfigurationModel, userConfigurationModel: ConfigurationModel, remoteUserConfigurationModel: ConfigurationModel, trigger: boolean): Promise<void> {
674676
// reset caches
675677
this.cachedFolderConfigs = new ResourceMap<FolderConfiguration>();
676678

@@ -684,11 +686,11 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
684686
const currentConfiguration = this._configuration;
685687
this._configuration = new Configuration(this.defaultConfiguration.configurationModel, this.policyConfiguration.configurationModel, applicationConfigurationModel, userConfigurationModel, remoteUserConfigurationModel, workspaceConfiguration, folderConfigurationModels, new ConfigurationModel(), new ResourceMap<ConfigurationModel>(), this.workspace);
686688

687-
if (this.initialized) {
689+
this.initialized = true;
690+
691+
if (trigger) {
688692
const change = this._configuration.compare(currentConfiguration);
689693
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
690-
} else {
691-
this.initialized = true;
692694
}
693695

694696
this.updateRestrictedSettings();
@@ -722,7 +724,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
722724
}
723725
}
724726
const [localUser, application] = await Promise.all(promises);
725-
await this.loadConfiguration(application ?? this._configuration.applicationConfiguration, localUser, this._configuration.remoteUserConfiguration);
727+
await this.loadConfiguration(application ?? this._configuration.applicationConfiguration, localUser, this._configuration.remoteUserConfiguration, true);
726728
})());
727729
}
728730

0 commit comments

Comments
 (0)