Kaynağa Gözat

Adds file context to commit file quick pick

main
Eric Amodio 4 yıl önce
ebeveyn
işleme
b7394c9013
2 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. +3
    -1
      src/commands/quickCommand.steps.ts
  2. +5
    -2
      src/quickpicks/commitQuickPickItems.ts

+ 3
- 1
src/commands/quickCommand.steps.ts Dosyayı Görüntüle

@ -1703,7 +1703,9 @@ async function getShowCommitOrStashFileStepItems<
const file = state.reference.files.find(f => f.fileName === state.fileName);
if (file == null) return [];
const items: CommandQuickPickItem[] = [new CommitFilesQuickPickItem(state.reference)];
const items: CommandQuickPickItem[] = [
new CommitFilesQuickPickItem(state.reference, undefined, GitUri.getFormattedFilename(state.fileName)),
];
let remotes: GitRemote<RemoteProvider>[] | undefined;

+ 5
- 2
src/quickpicks/commitQuickPickItems.ts Dosyayı Görüntüle

@ -2,6 +2,7 @@
import * as paths from 'path';
import { QuickPickItem, window } from 'vscode';
import { Commands, GitActions, OpenChangedFilesCommandArgs } from '../commands';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { CommitFormatter, GitFile, GitLogCommit, GitStatusFile } from '../git/git';
import { Keys } from '../keyboard';
@ -9,13 +10,15 @@ import { CommandQuickPickItem } from './quickPicksItems';
import { Strings } from '../system';
export class CommitFilesQuickPickItem extends CommandQuickPickItem {
constructor(readonly commit: GitLogCommit, picked: boolean = true) {
constructor(readonly commit: GitLogCommit, picked: boolean = true, fileName?: string) {
super(
{
label: commit.getShortMessage(),
// eslint-disable-next-line no-template-curly-in-string
description: CommitFormatter.fromTemplate('${author}, ${ago} $(git-commit) ${id}', commit),
detail: `$(files) ${commit.getFormattedDiffStatus({ expand: true, separator: ', ' })}`,
detail: `$(files) ${commit.getFormattedDiffStatus({ expand: true, separator: ', ' })}${
fileName ? `${Strings.pad(GlyphChars.Dot, 2, 2)}${fileName}` : ''
}`,
picked: picked,
},
undefined,

Yükleniyor…
İptal
Kaydet