Преглед изворни кода

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

Loading…
Откажи
Сачувај