Skip to content

Commit 193c2f5

Browse files
authored
Transfer SCM view mode and sort key in Continue On transition (microsoft#183127)
1 parent 8625a00 commit 193c2f5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ class ViewModel {
11481148
this._onDidChangeMode.fire(mode);
11491149
this.modeContextKey.set(mode);
11501150

1151-
this.storageService.store(`scm.viewMode`, mode, StorageScope.WORKSPACE, StorageTarget.MACHINE);
1151+
this.storageService.store(`scm.viewMode`, mode, StorageScope.WORKSPACE, StorageTarget.USER);
11521152
}
11531153

11541154
get sortKey(): ViewModelSortKey { return this._sortKey; }
@@ -1164,7 +1164,7 @@ class ViewModel {
11641164
this.sortKeyContextKey.set(sortKey);
11651165

11661166
if (this._mode === ViewModelMode.List) {
1167-
this.storageService.store(`scm.viewSortKey`, sortKey, StorageScope.WORKSPACE, StorageTarget.MACHINE);
1167+
this.storageService.store(`scm.viewSortKey`, sortKey, StorageScope.WORKSPACE, StorageTarget.USER);
11681168
}
11691169
}
11701170

@@ -1243,6 +1243,20 @@ class ViewModel {
12431243
if (e.reason === WillSaveStateReason.SHUTDOWN) {
12441244
this.storageService.store(`scm.viewState`, JSON.stringify(this.treeViewState), StorageScope.WORKSPACE, StorageTarget.MACHINE);
12451245
}
1246+
1247+
this.mode = this.getViewModelMode();
1248+
this.sortKey = this.getViewModelSortKey();
1249+
});
1250+
1251+
this.storageService.onDidChangeValue(e => {
1252+
switch (e.key) {
1253+
case 'scm.viewMode':
1254+
this.mode = this.getViewModelMode();
1255+
break;
1256+
case 'scm.viewSortKey':
1257+
this.sortKey = this.getViewModelSortKey();
1258+
break;
1259+
}
12461260
});
12471261
}
12481262

0 commit comments

Comments
 (0)