Skip to content

Commit 232e9a2

Browse files
authored
Git - comment out GitIncomingChangesFileDecorationProvider (microsoft#205583)
1 parent ea9f1da commit 232e9a2

File tree

2 files changed

+97
-137
lines changed

2 files changed

+97
-137
lines changed

extensions/git/package.json

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,46 +3198,6 @@
31983198
"highContrast": "#8db9e2",
31993199
"highContrastLight": "#1258a7"
32003200
}
3201-
},
3202-
{
3203-
"id": "gitDecoration.incomingAddedForegroundColor",
3204-
"description": "%colors.incomingAdded%",
3205-
"defaults": {
3206-
"light": "#587c0c",
3207-
"dark": "#81b88b",
3208-
"highContrast": "#1b5225",
3209-
"highContrastLight": "#374e06"
3210-
}
3211-
},
3212-
{
3213-
"id": "gitDecoration.incomingDeletedForegroundColor",
3214-
"description": "%colors.incomingDeleted%",
3215-
"defaults": {
3216-
"light": "#ad0707",
3217-
"dark": "#c74e39",
3218-
"highContrast": "#c74e39",
3219-
"highContrastLight": "#ad0707"
3220-
}
3221-
},
3222-
{
3223-
"id": "gitDecoration.incomingRenamedForegroundColor",
3224-
"description": "%colors.incomingRenamed%",
3225-
"defaults": {
3226-
"light": "#007100",
3227-
"dark": "#73C991",
3228-
"highContrast": "#73C991",
3229-
"highContrastLight": "#007100"
3230-
}
3231-
},
3232-
{
3233-
"id": "gitDecoration.incomingModifiedForegroundColor",
3234-
"description": "%colors.incomingModified%",
3235-
"defaults": {
3236-
"light": "#895503",
3237-
"dark": "#E2C08D",
3238-
"highContrast": "#E2C08D",
3239-
"highContrastLight": "#895503"
3240-
}
32413201
}
32423202
],
32433203
"configurationDefaults": {

extensions/git/src/decorationProvider.ts

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor, l10n } from 'vscode';
6+
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor } from 'vscode';
77
import * as path from 'path';
88
import { Repository, GitResourceGroup } from './repository';
99
import { Model } from './model';
1010
import { debounce } from './decorators';
1111
import { filterEvent, dispose, anyEvent, fireEvent, PromiseSource, combinedDisposable } from './util';
12-
import { Change, GitErrorCodes, Status } from './api/git';
12+
import { GitErrorCodes, Status } from './api/git';
1313

1414
class GitIgnoreDecorationProvider implements FileDecorationProvider {
1515

@@ -153,100 +153,100 @@ class GitDecorationProvider implements FileDecorationProvider {
153153
}
154154
}
155155

156-
class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider {
157-
158-
private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
159-
readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
160-
161-
private decorations = new Map<string, FileDecoration>();
162-
private readonly disposables: Disposable[] = [];
163-
164-
constructor(private readonly repository: Repository) {
165-
this.disposables.push(window.registerFileDecorationProvider(this));
166-
repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables);
167-
}
168-
169-
private async onDidChangeCurrentHistoryItemGroup(): Promise<void> {
170-
const newDecorations = new Map<string, FileDecoration>();
171-
await this.collectIncomingChangesFileDecorations(newDecorations);
172-
const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));
173-
174-
this.decorations = newDecorations;
175-
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
176-
}
177-
178-
private async collectIncomingChangesFileDecorations(bucket: Map<string, FileDecoration>): Promise<void> {
179-
for (const change of await this.getIncomingChanges()) {
180-
switch (change.status) {
181-
case Status.INDEX_ADDED:
182-
bucket.set(change.uri.toString(), {
183-
badge: '↓A',
184-
color: new ThemeColor('gitDecoration.incomingAddedForegroundColor'),
185-
tooltip: l10n.t('Incoming Changes (added)'),
186-
});
187-
break;
188-
case Status.DELETED:
189-
bucket.set(change.uri.toString(), {
190-
badge: '↓D',
191-
color: new ThemeColor('gitDecoration.incomingDeletedForegroundColor'),
192-
tooltip: l10n.t('Incoming Changes (deleted)'),
193-
});
194-
break;
195-
case Status.INDEX_RENAMED:
196-
bucket.set(change.originalUri.toString(), {
197-
badge: '↓R',
198-
color: new ThemeColor('gitDecoration.incomingRenamedForegroundColor'),
199-
tooltip: l10n.t('Incoming Changes (renamed)'),
200-
});
201-
break;
202-
case Status.MODIFIED:
203-
bucket.set(change.uri.toString(), {
204-
badge: '↓M',
205-
color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
206-
tooltip: l10n.t('Incoming Changes (modified)'),
207-
});
208-
break;
209-
default: {
210-
bucket.set(change.uri.toString(), {
211-
badge: '↓~',
212-
color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
213-
tooltip: l10n.t('Incoming Changes'),
214-
});
215-
break;
216-
}
217-
}
218-
}
219-
}
220-
221-
private async getIncomingChanges(): Promise<Change[]> {
222-
try {
223-
const historyProvider = this.repository.historyProvider;
224-
const currentHistoryItemGroup = historyProvider.currentHistoryItemGroup;
225-
226-
if (!currentHistoryItemGroup?.base) {
227-
return [];
228-
}
229-
230-
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base.id);
231-
if (!ancestor) {
232-
return [];
233-
}
234-
235-
const changes = await this.repository.diffBetween(ancestor.id, currentHistoryItemGroup.base.id);
236-
return changes;
237-
} catch (err) {
238-
return [];
239-
}
240-
}
241-
242-
provideFileDecoration(uri: Uri): FileDecoration | undefined {
243-
return this.decorations.get(uri.toString());
244-
}
245-
246-
dispose(): void {
247-
dispose(this.disposables);
248-
}
249-
}
156+
// class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider {
157+
158+
// private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
159+
// readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
160+
161+
// private decorations = new Map<string, FileDecoration>();
162+
// private readonly disposables: Disposable[] = [];
163+
164+
// constructor(private readonly repository: Repository) {
165+
// this.disposables.push(window.registerFileDecorationProvider(this));
166+
// repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables);
167+
// }
168+
169+
// private async onDidChangeCurrentHistoryItemGroup(): Promise<void> {
170+
// const newDecorations = new Map<string, FileDecoration>();
171+
// await this.collectIncomingChangesFileDecorations(newDecorations);
172+
// const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));
173+
174+
// this.decorations = newDecorations;
175+
// this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
176+
// }
177+
178+
// private async collectIncomingChangesFileDecorations(bucket: Map<string, FileDecoration>): Promise<void> {
179+
// for (const change of await this.getIncomingChanges()) {
180+
// switch (change.status) {
181+
// case Status.INDEX_ADDED:
182+
// bucket.set(change.uri.toString(), {
183+
// badge: '↓A',
184+
// color: new ThemeColor('gitDecoration.incomingAddedForegroundColor'),
185+
// tooltip: l10n.t('Incoming Changes (added)'),
186+
// });
187+
// break;
188+
// case Status.DELETED:
189+
// bucket.set(change.uri.toString(), {
190+
// badge: '↓D',
191+
// color: new ThemeColor('gitDecoration.incomingDeletedForegroundColor'),
192+
// tooltip: l10n.t('Incoming Changes (deleted)'),
193+
// });
194+
// break;
195+
// case Status.INDEX_RENAMED:
196+
// bucket.set(change.originalUri.toString(), {
197+
// badge: '↓R',
198+
// color: new ThemeColor('gitDecoration.incomingRenamedForegroundColor'),
199+
// tooltip: l10n.t('Incoming Changes (renamed)'),
200+
// });
201+
// break;
202+
// case Status.MODIFIED:
203+
// bucket.set(change.uri.toString(), {
204+
// badge: '↓M',
205+
// color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
206+
// tooltip: l10n.t('Incoming Changes (modified)'),
207+
// });
208+
// break;
209+
// default: {
210+
// bucket.set(change.uri.toString(), {
211+
// badge: '↓~',
212+
// color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
213+
// tooltip: l10n.t('Incoming Changes'),
214+
// });
215+
// break;
216+
// }
217+
// }
218+
// }
219+
// }
220+
221+
// private async getIncomingChanges(): Promise<Change[]> {
222+
// try {
223+
// const historyProvider = this.repository.historyProvider;
224+
// const currentHistoryItemGroup = historyProvider.currentHistoryItemGroup;
225+
226+
// if (!currentHistoryItemGroup?.base) {
227+
// return [];
228+
// }
229+
230+
// const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base.id);
231+
// if (!ancestor) {
232+
// return [];
233+
// }
234+
235+
// const changes = await this.repository.diffBetween(ancestor.id, currentHistoryItemGroup.base.id);
236+
// return changes;
237+
// } catch (err) {
238+
// return [];
239+
// }
240+
// }
241+
242+
// provideFileDecoration(uri: Uri): FileDecoration | undefined {
243+
// return this.decorations.get(uri.toString());
244+
// }
245+
246+
// dispose(): void {
247+
// dispose(this.disposables);
248+
// }
249+
// }
250250

251251
export class GitDecorations {
252252

@@ -287,7 +287,7 @@ export class GitDecorations {
287287
private onDidOpenRepository(repository: Repository): void {
288288
const providers = combinedDisposable([
289289
new GitDecorationProvider(repository),
290-
new GitIncomingChangesFileDecorationProvider(repository)
290+
// new GitIncomingChangesFileDecorationProvider(repository)
291291
]);
292292

293293
this.providers.set(repository, providers);

0 commit comments

Comments
 (0)