This commit is contained in:
Sandeep Somavarapu 2023-05-31 14:26:37 +02:00 committed by GitHub
parent 68e4866b30
commit 2a3475bb37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -365,7 +365,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
const application = await this.reloadApplicationConfiguration(true);
const { local, remote } = await this.reloadUserConfiguration();
await this.reloadWorkspaceConfiguration();
await this.loadConfiguration(application, local, remote);
await this.loadConfiguration(application, local, remote, true);
return;
}
@ -381,7 +381,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
case ConfigurationTarget.USER: {
const { local, remote } = await this.reloadUserConfiguration();
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote);
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote, true);
return;
}
case ConfigurationTarget.USER_LOCAL:
@ -436,8 +436,10 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
async initialize(arg: IAnyWorkspaceIdentifier): Promise<void> {
mark('code/willInitWorkspaceService');
const trigger = this.initialized;
this.initialized = false;
const workspace = await this.createWorkspace(arg);
await this.updateWorkspaceAndInitializeConfiguration(workspace);
await this.updateWorkspaceAndInitializeConfiguration(workspace, trigger);
this.checkAndMarkWorkspaceComplete(false);
mark('code/didInitWorkspaceService');
@ -529,7 +531,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
}
}
private async updateWorkspaceAndInitializeConfiguration(workspace: Workspace): Promise<void> {
private async updateWorkspaceAndInitializeConfiguration(workspace: Workspace, trigger: boolean): Promise<void> {
const hasWorkspaceBefore = !!this.workspace;
let previousState: WorkbenchState | undefined;
let previousWorkspacePath: string | undefined;
@ -544,7 +546,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
this.workspace = workspace;
}
await this.initializeConfiguration();
await this.initializeConfiguration(trigger);
// Trigger changes after configuration initialization so that configuration is up to date.
if (hasWorkspaceBefore) {
@ -589,7 +591,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
return result;
}
private async initializeConfiguration(): Promise<void> {
private async initializeConfiguration(trigger: boolean): Promise<void> {
await this.defaultConfiguration.initialize();
const [, application, user] = await Promise.all([
@ -604,7 +606,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
]);
mark('code/willInitWorkspaceConfiguration');
await this.loadConfiguration(application, user.local, user.remote);
await this.loadConfiguration(application, user.local, user.remote, trigger);
mark('code/didInitWorkspaceConfiguration');
}
@ -670,7 +672,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
return this.onWorkspaceFolderConfigurationChanged(folder);
}
private async loadConfiguration(applicationConfigurationModel: ConfigurationModel, userConfigurationModel: ConfigurationModel, remoteUserConfigurationModel: ConfigurationModel): Promise<void> {
private async loadConfiguration(applicationConfigurationModel: ConfigurationModel, userConfigurationModel: ConfigurationModel, remoteUserConfigurationModel: ConfigurationModel, trigger: boolean): Promise<void> {
// reset caches
this.cachedFolderConfigs = new ResourceMap<FolderConfiguration>();
@ -684,11 +686,11 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
const currentConfiguration = this._configuration;
this._configuration = new Configuration(this.defaultConfiguration.configurationModel, this.policyConfiguration.configurationModel, applicationConfigurationModel, userConfigurationModel, remoteUserConfigurationModel, workspaceConfiguration, folderConfigurationModels, new ConfigurationModel(), new ResourceMap<ConfigurationModel>(), this.workspace);
if (this.initialized) {
this.initialized = true;
if (trigger) {
const change = this._configuration.compare(currentConfiguration);
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
} else {
this.initialized = true;
}
this.updateRestrictedSettings();
@ -722,7 +724,7 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
}
}
const [localUser, application] = await Promise.all(promises);
await this.loadConfiguration(application ?? this._configuration.applicationConfiguration, localUser, this._configuration.remoteUserConfiguration);
await this.loadConfiguration(application ?? this._configuration.applicationConfiguration, localUser, this._configuration.remoteUserConfiguration, true);
})());
}