mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-25 12:16:07 +00:00
Git - comment out GitIncomingChangesFileDecorationProvider (#205583)
This commit is contained in:
@@ -3198,46 +3198,6 @@
|
||||
"highContrast": "#8db9e2",
|
||||
"highContrastLight": "#1258a7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.incomingAddedForegroundColor",
|
||||
"description": "%colors.incomingAdded%",
|
||||
"defaults": {
|
||||
"light": "#587c0c",
|
||||
"dark": "#81b88b",
|
||||
"highContrast": "#1b5225",
|
||||
"highContrastLight": "#374e06"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.incomingDeletedForegroundColor",
|
||||
"description": "%colors.incomingDeleted%",
|
||||
"defaults": {
|
||||
"light": "#ad0707",
|
||||
"dark": "#c74e39",
|
||||
"highContrast": "#c74e39",
|
||||
"highContrastLight": "#ad0707"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.incomingRenamedForegroundColor",
|
||||
"description": "%colors.incomingRenamed%",
|
||||
"defaults": {
|
||||
"light": "#007100",
|
||||
"dark": "#73C991",
|
||||
"highContrast": "#73C991",
|
||||
"highContrastLight": "#007100"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.incomingModifiedForegroundColor",
|
||||
"description": "%colors.incomingModified%",
|
||||
"defaults": {
|
||||
"light": "#895503",
|
||||
"dark": "#E2C08D",
|
||||
"highContrast": "#E2C08D",
|
||||
"highContrastLight": "#895503"
|
||||
}
|
||||
}
|
||||
],
|
||||
"configurationDefaults": {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor, l10n } from 'vscode';
|
||||
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor } from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { Repository, GitResourceGroup } from './repository';
|
||||
import { Model } from './model';
|
||||
import { debounce } from './decorators';
|
||||
import { filterEvent, dispose, anyEvent, fireEvent, PromiseSource, combinedDisposable } from './util';
|
||||
import { Change, GitErrorCodes, Status } from './api/git';
|
||||
import { GitErrorCodes, Status } from './api/git';
|
||||
|
||||
class GitIgnoreDecorationProvider implements FileDecorationProvider {
|
||||
|
||||
@@ -153,100 +153,100 @@ class GitDecorationProvider implements FileDecorationProvider {
|
||||
}
|
||||
}
|
||||
|
||||
class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider {
|
||||
// class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider {
|
||||
|
||||
private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
|
||||
readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
|
||||
// private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
|
||||
// readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
|
||||
|
||||
private decorations = new Map<string, FileDecoration>();
|
||||
private readonly disposables: Disposable[] = [];
|
||||
// private decorations = new Map<string, FileDecoration>();
|
||||
// private readonly disposables: Disposable[] = [];
|
||||
|
||||
constructor(private readonly repository: Repository) {
|
||||
this.disposables.push(window.registerFileDecorationProvider(this));
|
||||
repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables);
|
||||
}
|
||||
// constructor(private readonly repository: Repository) {
|
||||
// this.disposables.push(window.registerFileDecorationProvider(this));
|
||||
// repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables);
|
||||
// }
|
||||
|
||||
private async onDidChangeCurrentHistoryItemGroup(): Promise<void> {
|
||||
const newDecorations = new Map<string, FileDecoration>();
|
||||
await this.collectIncomingChangesFileDecorations(newDecorations);
|
||||
const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));
|
||||
// private async onDidChangeCurrentHistoryItemGroup(): Promise<void> {
|
||||
// const newDecorations = new Map<string, FileDecoration>();
|
||||
// await this.collectIncomingChangesFileDecorations(newDecorations);
|
||||
// const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));
|
||||
|
||||
this.decorations = newDecorations;
|
||||
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
|
||||
}
|
||||
// this.decorations = newDecorations;
|
||||
// this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
|
||||
// }
|
||||
|
||||
private async collectIncomingChangesFileDecorations(bucket: Map<string, FileDecoration>): Promise<void> {
|
||||
for (const change of await this.getIncomingChanges()) {
|
||||
switch (change.status) {
|
||||
case Status.INDEX_ADDED:
|
||||
bucket.set(change.uri.toString(), {
|
||||
badge: '↓A',
|
||||
color: new ThemeColor('gitDecoration.incomingAddedForegroundColor'),
|
||||
tooltip: l10n.t('Incoming Changes (added)'),
|
||||
});
|
||||
break;
|
||||
case Status.DELETED:
|
||||
bucket.set(change.uri.toString(), {
|
||||
badge: '↓D',
|
||||
color: new ThemeColor('gitDecoration.incomingDeletedForegroundColor'),
|
||||
tooltip: l10n.t('Incoming Changes (deleted)'),
|
||||
});
|
||||
break;
|
||||
case Status.INDEX_RENAMED:
|
||||
bucket.set(change.originalUri.toString(), {
|
||||
badge: '↓R',
|
||||
color: new ThemeColor('gitDecoration.incomingRenamedForegroundColor'),
|
||||
tooltip: l10n.t('Incoming Changes (renamed)'),
|
||||
});
|
||||
break;
|
||||
case Status.MODIFIED:
|
||||
bucket.set(change.uri.toString(), {
|
||||
badge: '↓M',
|
||||
color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
|
||||
tooltip: l10n.t('Incoming Changes (modified)'),
|
||||
});
|
||||
break;
|
||||
default: {
|
||||
bucket.set(change.uri.toString(), {
|
||||
badge: '↓~',
|
||||
color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
|
||||
tooltip: l10n.t('Incoming Changes'),
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// private async collectIncomingChangesFileDecorations(bucket: Map<string, FileDecoration>): Promise<void> {
|
||||
// for (const change of await this.getIncomingChanges()) {
|
||||
// switch (change.status) {
|
||||
// case Status.INDEX_ADDED:
|
||||
// bucket.set(change.uri.toString(), {
|
||||
// badge: '↓A',
|
||||
// color: new ThemeColor('gitDecoration.incomingAddedForegroundColor'),
|
||||
// tooltip: l10n.t('Incoming Changes (added)'),
|
||||
// });
|
||||
// break;
|
||||
// case Status.DELETED:
|
||||
// bucket.set(change.uri.toString(), {
|
||||
// badge: '↓D',
|
||||
// color: new ThemeColor('gitDecoration.incomingDeletedForegroundColor'),
|
||||
// tooltip: l10n.t('Incoming Changes (deleted)'),
|
||||
// });
|
||||
// break;
|
||||
// case Status.INDEX_RENAMED:
|
||||
// bucket.set(change.originalUri.toString(), {
|
||||
// badge: '↓R',
|
||||
// color: new ThemeColor('gitDecoration.incomingRenamedForegroundColor'),
|
||||
// tooltip: l10n.t('Incoming Changes (renamed)'),
|
||||
// });
|
||||
// break;
|
||||
// case Status.MODIFIED:
|
||||
// bucket.set(change.uri.toString(), {
|
||||
// badge: '↓M',
|
||||
// color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
|
||||
// tooltip: l10n.t('Incoming Changes (modified)'),
|
||||
// });
|
||||
// break;
|
||||
// default: {
|
||||
// bucket.set(change.uri.toString(), {
|
||||
// badge: '↓~',
|
||||
// color: new ThemeColor('gitDecoration.incomingModifiedForegroundColor'),
|
||||
// tooltip: l10n.t('Incoming Changes'),
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private async getIncomingChanges(): Promise<Change[]> {
|
||||
try {
|
||||
const historyProvider = this.repository.historyProvider;
|
||||
const currentHistoryItemGroup = historyProvider.currentHistoryItemGroup;
|
||||
// private async getIncomingChanges(): Promise<Change[]> {
|
||||
// try {
|
||||
// const historyProvider = this.repository.historyProvider;
|
||||
// const currentHistoryItemGroup = historyProvider.currentHistoryItemGroup;
|
||||
|
||||
if (!currentHistoryItemGroup?.base) {
|
||||
return [];
|
||||
}
|
||||
// if (!currentHistoryItemGroup?.base) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base.id);
|
||||
if (!ancestor) {
|
||||
return [];
|
||||
}
|
||||
// const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base.id);
|
||||
// if (!ancestor) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
const changes = await this.repository.diffBetween(ancestor.id, currentHistoryItemGroup.base.id);
|
||||
return changes;
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
// const changes = await this.repository.diffBetween(ancestor.id, currentHistoryItemGroup.base.id);
|
||||
// return changes;
|
||||
// } catch (err) {
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
provideFileDecoration(uri: Uri): FileDecoration | undefined {
|
||||
return this.decorations.get(uri.toString());
|
||||
}
|
||||
// provideFileDecoration(uri: Uri): FileDecoration | undefined {
|
||||
// return this.decorations.get(uri.toString());
|
||||
// }
|
||||
|
||||
dispose(): void {
|
||||
dispose(this.disposables);
|
||||
}
|
||||
}
|
||||
// dispose(): void {
|
||||
// dispose(this.disposables);
|
||||
// }
|
||||
// }
|
||||
|
||||
export class GitDecorations {
|
||||
|
||||
@@ -287,7 +287,7 @@ export class GitDecorations {
|
||||
private onDidOpenRepository(repository: Repository): void {
|
||||
const providers = combinedDisposable([
|
||||
new GitDecorationProvider(repository),
|
||||
new GitIncomingChangesFileDecorationProvider(repository)
|
||||
// new GitIncomingChangesFileDecorationProvider(repository)
|
||||
]);
|
||||
|
||||
this.providers.set(repository, providers);
|
||||
|
||||
Reference in New Issue
Block a user