Pārlūkot izejas kodu

Adds sending of "next" hint to Commit Details nav

main
Eric Amodio pirms 1 gada
vecāks
revīzija
fdedd625f0
2 mainītis faili ar 13 papildinājumiem un 2 dzēšanām
  1. +5
    -1
      src/system/mru.ts
  2. +8
    -1
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 5
- 1
src/system/mru.ts Parādīt failu

@ -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 Parādīt failu

@ -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,
},
});
}

Notiek ielāde…
Atcelt
Saglabāt