Skip to content

Commit 3f4baf4

Browse files
committed
move focus check while converting
1 parent d95f6de commit 3f4baf4

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/vs/workbench/services/editor/browser/editorOverrideService.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
6666
// Read in the cache on statup
6767
this.cache = new Set<string>(JSON.parse(this.storageService.get(EditorOverrideService.overrideCacheStorageID, StorageScope.GLOBAL, JSON.stringify([]))));
6868
this.storageService.remove(EditorOverrideService.overrideCacheStorageID, StorageScope.GLOBAL);
69-
this.hostService.hadLastFocus().then(hadLastFocus => {
70-
if (!hadLastFocus) {
71-
return;
72-
}
73-
this.convertOldAssociationFormat();
74-
});
69+
this.convertOldAssociationFormat();
7570

7671
this._register(this.storageService.onWillSaveState(() => {
7772
// We want to store the glob patterns we would activate on, this allows us to know if we need to await the ext host on startup for opening a resource
@@ -188,20 +183,25 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
188183
}
189184

190185
private convertOldAssociationFormat(): void {
191-
const rawAssociations = this.configurationService.getValue<EditorAssociations | { [fileNamePattern: string]: string }>(editorsAssociationsSettingId) || {};
192-
// If it's not an array, then it's the new format
193-
if (!Array.isArray(rawAssociations)) {
194-
return;
195-
}
196-
let newSettingObject = Object.create(null);
197-
// Make the correctly formatted object from the array and then set that object
198-
for (const association of rawAssociations) {
199-
if (association.filenamePattern) {
200-
newSettingObject[association.filenamePattern] = association.viewType;
186+
this.hostService.hadLastFocus().then(hadLastFocus => {
187+
if (!hadLastFocus) {
188+
return;
201189
}
202-
}
203-
this.logService.info(`Migrating ${editorsAssociationsSettingId}`);
204-
this.configurationService.updateValue(editorsAssociationsSettingId, newSettingObject);
190+
const rawAssociations = this.configurationService.getValue<EditorAssociations | { [fileNamePattern: string]: string }>(editorsAssociationsSettingId) || {};
191+
// If it's not an array, then it's the new format
192+
if (!Array.isArray(rawAssociations)) {
193+
return;
194+
}
195+
let newSettingObject = Object.create(null);
196+
// Make the correctly formatted object from the array and then set that object
197+
for (const association of rawAssociations) {
198+
if (association.filenamePattern) {
199+
newSettingObject[association.filenamePattern] = association.viewType;
200+
}
201+
}
202+
this.logService.info(`Migrating ${editorsAssociationsSettingId}`);
203+
this.configurationService.updateValue(editorsAssociationsSettingId, newSettingObject);
204+
});
205205
}
206206

207207
private getAllUserAssociations(): EditorAssociations {

0 commit comments

Comments
 (0)