mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
timeline - add setting to bring back "Uncommitted Changes" (#147372)
This commit is contained in:
@@ -169,6 +169,8 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
|
||||
const dateType = config.get<'committed' | 'authored'>('date');
|
||||
const showAuthor = config.get<boolean>('showAuthor');
|
||||
const showUncommitted = config.get<boolean>('showUncommitted');
|
||||
|
||||
const openComparison = localize('git.timeline.openComparison', "Open Comparison");
|
||||
|
||||
const items = commits.map<GitTimelineItem>((c, i) => {
|
||||
@@ -220,6 +222,30 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
|
||||
items.splice(0, 0, item);
|
||||
}
|
||||
|
||||
if (showUncommitted) {
|
||||
const working = repo.workingTreeGroup.resourceStates.find(r => r.resourceUri.fsPath === uri.fsPath);
|
||||
if (working) {
|
||||
const date = new Date();
|
||||
|
||||
const item = new GitTimelineItem('', index ? '~' : 'HEAD', localize('git.timeline.uncommitedChanges', 'Uncommitted Changes'), date.getTime(), 'working', 'git:file:working');
|
||||
// TODO@eamodio: Replace with a better icon -- reflecting its status maybe?
|
||||
item.iconPath = new ThemeIcon('git-commit');
|
||||
item.description = '';
|
||||
item.setItemDetails(you, undefined, dateFormatter.format(date), Resource.getStatusText(working.type));
|
||||
|
||||
const cmd = this.commands.resolveTimelineOpenDiffCommand(item, uri);
|
||||
if (cmd) {
|
||||
item.command = {
|
||||
title: openComparison,
|
||||
command: cmd.command,
|
||||
arguments: cmd.arguments,
|
||||
};
|
||||
}
|
||||
|
||||
items.splice(0, 0, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -235,7 +261,7 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
}
|
||||
|
||||
private onConfigurationChanged(e: ConfigurationChangeEvent) {
|
||||
if (e.affectsConfiguration('git.timeline.date') || e.affectsConfiguration('git.timeline.showAuthor')) {
|
||||
if (e.affectsConfiguration('git.timeline.date') || e.affectsConfiguration('git.timeline.showAuthor') || e.affectsConfiguration('git.timeline.showUncommitted')) {
|
||||
this.fireChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user