keybindingsSync.ts ×7

Frontier kind: Code frontier

unlabeled · c_60be7a74b6cc

137 tests · 25203 LOC · 133 files · introduces 0 tests · 57 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges57 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3943 ranges25203 lines · 133 files · Browse complete extent
All tests (intent)
137 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 57 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/userDataSync/common/keybindingsSync.ts 57 introduced LOC · 7 ranges

Open complete file

90
91 protected async generateSyncPreview(remoteUserData: IRemoteUserData, lastSyncUserData: ILastSyncUserData | null, isRemoteDataFromCurrentMachine: boolean, userDataSyncConfiguration: IUserDataSyncConfiguration): Promise<IKeybindingsResourcePreview[]> {
92 > const remoteContent = remoteUserData.syncData ? getKeybindingsContentFromSyncContent(remoteUserData.syncData.content, userDataSyncConfiguration.keybindingsPerPlatform ?? this.syncKeybindingsPerPlatform(), this.logService) : null; keybindingsSync.ts
93 >
94 > // Use remote data as last sync data if last sync data does not exist and remote data is from same machine
95 > lastSyncUserData = lastSyncUserData === null && isRemoteDataFromCurrentMachine ? remoteUserData : lastSyncUserData;
96 > const lastSyncContent: string | null = lastSyncUserData ? this.getKeybindingsContentFromLastSyncUserData(lastSyncUserData) : null;
97 >
98 > // Get file content last to get the latest
99 > const fileContent = await this.getLocalFileContent();
100 > const formattingOptions = await this.getFormattingOptions();
101 >
102 > let mergedContent: string | null = null;
103 > let hasLocalChanged: boolean = false;
104 > let hasRemoteChanged: boolean = false;
105 > let hasConflicts: boolean = false;
106 >
107 > if (remoteContent) {
108 let localContent: string = fileContent ? fileContent.value.toString() : '[]';
109 localContent = localContent || '[]';
127 }
128 }
130 > // First time syncing to remote
131 > else if (fileContent) {
132 this.logService.trace(`${this.syncResourceLogLabel}: Remote keybindings does not exist. Synchronizing keybindings for the first time.`);
133 mergedContent = fileContent.value.toString();
134 hasRemoteChanged = true;
135 }
137 > const previewResult: IMergeResult = {
138 > content: hasConflicts ? lastSyncContent : mergedContent,
139 > localChange: hasLocalChanged ? fileContent ? Change.Modified : Change.Added : Change.None,
140 > remoteChange: hasRemoteChanged ? Change.Modified : Change.None,
141 > hasConflicts
142 > };
143 >
144 > const localContent = fileContent ? fileContent.value.toString() : null;
145 > return [{
146 > fileContent,
147 >
148 > baseResource: this.baseResource,
149 > baseContent: lastSyncContent,
150 >
151 > localResource: this.localResource,
152 > localContent,
153 > localChange: previewResult.localChange,
154 >
155 > remoteResource: this.remoteResource,
156 > remoteContent,
157 > remoteChange: previewResult.remoteChange,
158 >
159 > previewResource: this.previewResource,
160 > previewResult,
161 > acceptedResource: this.acceptedResource,
162 > }];
163 >
164 > }
165
166 protected async hasRemoteChanged(lastSyncUserData: IRemoteUserData): Promise<boolean> {
222
223 protected async applyResult(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, resourcePreviews: [IKeybindingsResourcePreview, IAcceptResult][], force: boolean): Promise<void> {
224 > const { fileContent } = resourcePreviews[0][0]; keybindingsSync.ts
225 > let { content, localChange, remoteChange } = resourcePreviews[0][1];
226 >
227 > if (localChange === Change.None && remoteChange === Change.None) {
228 this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing keybindings.`);
229 }
231 > if (content !== null) {
232 content = content.trim();
233 content = content || '[]';
258 } catch (e) { /* ignore */ }
259
260 > if (lastSyncUserData?.ref !== remoteUserData.ref) { keybindingsSync.ts
261 this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized keybindings...`);
262 await this.updateLastSyncUserData(remoteUserData, { platformSpecific: this.syncKeybindingsPerPlatform() });
263 this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized keybindings`);
264 }
266 > }
267
268 async hasLocalData(): Promise<boolean> {