Skip to content

Commit 6abedab

Browse files
committed
1 parent a2b259c commit 6abedab

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/vs/platform/userDataSync/common/keybindingsSync.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ export class KeybindingsSynchroniser extends AbstractJsonFileSynchroniser implem
236236
}
237237

238238
async getAssociatedResources({ uri }: ISyncResourceHandle): Promise<{ resource: URI, comparableResource?: URI }[]> {
239-
return [{ resource: joinPath(uri, 'keybindings.json'), comparableResource: this.file }];
239+
const comparableResource = (await this.fileService.exists(this.file)) ? this.file : undefined;
240+
return [{ resource: joinPath(uri, 'keybindings.json'), comparableResource }];
240241
}
241242

242243
async resolveContent(uri: URI): Promise<string | null> {

src/vs/platform/userDataSync/common/settingsSync.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ export class SettingsSynchroniser extends AbstractJsonFileSynchroniser implement
236236
}
237237

238238
async getAssociatedResources({ uri }: ISyncResourceHandle): Promise<{ resource: URI, comparableResource?: URI }[]> {
239-
return [{ resource: joinPath(uri, 'settings.json'), comparableResource: this.file }];
239+
const comparableResource = (await this.fileService.exists(this.file)) ? this.file : undefined;
240+
return [{ resource: joinPath(uri, 'settings.json'), comparableResource }];
240241
}
241242

242243
async resolveContent(uri: URI): Promise<string | null> {

src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
3737
import { TreeView } from 'vs/workbench/contrib/views/browser/treeView';
3838
import { flatten } from 'vs/base/common/arrays';
3939
import { UserDataSyncMergesViewPane } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncMergesView';
40+
import { basename } from 'vs/base/common/resources';
4041

4142
export class UserDataSyncViewPaneContainer extends ViewPaneContainer {
4243

@@ -271,9 +272,14 @@ export class UserDataSyncDataViews extends Disposable {
271272
const editorService = accessor.get(IEditorService);
272273
const { resource, comparableResource } = <{ resource: string, comparableResource?: string }>JSON.parse(handle.$treeItemHandle);
273274
if (comparableResource) {
275+
const leftResource = URI.parse(resource);
276+
const leftResourceName = localize({ key: 'leftResourceName', comment: ['remote as in file in cloud'] }, "{0} (Remote)", basename(leftResource));
277+
const rightResource = URI.parse(comparableResource);
278+
const rightResourceName = localize({ key: 'rightResourceName', comment: ['local as in file in disk'] }, "{0} (Local)", basename(rightResource));
274279
await editorService.openEditor({
275-
leftResource: URI.parse(resource),
276-
rightResource: URI.parse(comparableResource),
280+
leftResource,
281+
rightResource,
282+
label: localize('sideBySideLabels', "{0} ↔ {1}", leftResourceName, rightResourceName),
277283
options: {
278284
preserveFocus: true,
279285
revealIfVisible: true,

0 commit comments

Comments
 (0)