소스 검색

Adds sending of "next" hint to Commit Details nav

main
Eric Amodio 1 년 전
부모
커밋
fdedd625f0
2개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. +5
    -1
      src/system/mru.ts
  2. +8
    -1
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 5
- 1
src/system/mru.ts 파일 보기

@ -31,7 +31,11 @@ export class MRU {
this._position = 0;
}
get(): T | undefined {
get(position?: number): T | undefined {
if (position != null) {
if (position < 0 || position >= this.stack.length) return undefined;
return this.stack[position];
}
return this.stack.length > 0 ? this.stack[0] : undefined;
}

+ 8
- 1
src/webviews/commitDetails/commitDetailsWebview.ts 파일 보기

@ -25,7 +25,7 @@ import { serializeIssueOrPullRequest } from '../../git/models/issue';
import type { PullRequest } from '../../git/models/pullRequest';
import { serializePullRequest } from '../../git/models/pullRequest';
import type { GitRevisionReference } from '../../git/models/reference';
import { getReferenceFromRevision } from '../../git/models/reference';
import { getReferenceFromRevision, shortenRevision } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeCoreCommand } from '../../system/command';
@ -80,6 +80,7 @@ interface Context {
navigationStack: {
count: number;
position: number;
hint?: string;
};
visible: boolean;
@ -537,10 +538,16 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
if (!options?.skipStack) {
this._commitStack.add(getReferenceFromRevision(commit));
}
let sha = this._commitStack.get(this._commitStack.position + 1)?.ref;
if (sha != null) {
sha = shortenRevision(sha);
}
this.updatePendingContext({
navigationStack: {
count: this._commitStack.count,
position: this._commitStack.position,
hint: sha,
},
});
}

불러오는 중...
취소
저장