瀏覽代碼

Renames showMore to loadMore

Renames showAll to loadAll
main
Eric Amodio 4 年之前
父節點
當前提交
4e32a62a46
共有 17 個檔案被更改,包括 74 行新增74 行删除
  1. +6
    -6
      package.json
  2. +1
    -1
      src/views/branchesView.ts
  3. +2
    -2
      src/views/commitsView.ts
  4. +3
    -3
      src/views/nodes/branchNode.ts
  5. +3
    -3
      src/views/nodes/branchTrackingStatusNode.ts
  6. +12
    -12
      src/views/nodes/common.ts
  7. +3
    -3
      src/views/nodes/contributorNode.ts
  8. +3
    -3
      src/views/nodes/fileHistoryNode.ts
  9. +3
    -3
      src/views/nodes/lineHistoryNode.ts
  10. +6
    -6
      src/views/nodes/reflogNode.ts
  11. +6
    -6
      src/views/nodes/reflogRecordNode.ts
  12. +5
    -5
      src/views/nodes/resultsCommitsNode.ts
  13. +8
    -8
      src/views/nodes/tagNode.ts
  14. +2
    -2
      src/views/nodes/viewNode.ts
  15. +1
    -1
      src/views/repositoriesView.ts
  16. +8
    -8
      src/views/viewBase.ts
  17. +2
    -2
      src/views/viewCommands.ts

+ 6
- 6
package.json 查看文件

@ -3293,12 +3293,12 @@
"icon": "$(refresh)"
},
{
"command": "gitlens.views.showMoreChildren",
"command": "gitlens.views.loadMoreChildren",
"title": "Load More",
"category": "GitLens"
},
{
"command": "gitlens.views.showAllChildren",
"command": "gitlens.views.loadAllChildren",
"title": "Load All",
"category": "GitLens",
"icon": {
@ -4564,11 +4564,11 @@
"when": "false"
},
{
"command": "gitlens.views.showMoreChildren",
"command": "gitlens.views.loadMoreChildren",
"when": "false"
},
{
"command": "gitlens.views.showAllChildren",
"command": "gitlens.views.loadAllChildren",
"when": "false"
},
{
@ -6755,12 +6755,12 @@
"group": "9_gitlens@99"
},
{
"command": "gitlens.views.showAllChildren",
"command": "gitlens.views.loadAllChildren",
"when": "viewItem =~ /gitlens:pager\\b/",
"group": "inline@1"
},
{
"command": "gitlens.views.showAllChildren",
"command": "gitlens.views.loadAllChildren",
"when": "viewItem =~ /gitlens:pager\\b/",
"group": "1_gitlens_actions@1"
}

+ 1
- 1
src/views/branchesView.ts 查看文件

@ -283,7 +283,7 @@ export class BranchesView extends ViewBase
}
if (n instanceof BranchNode && branches.includes(n.branch.name)) {
await n.showMore({ until: commit.ref });
await n.loadMore({ until: commit.ref });
return true;
}

+ 2
- 2
src/views/commitsView.ts 查看文件

@ -307,7 +307,7 @@ export class CommitsView extends ViewBase {
if (node instanceof CommitsRepositoryNode) {
node = await node.getSplattedChild?.();
if (node instanceof BranchNode) {
await node.showMore({ until: commit.ref });
await node.loadMore({ until: commit.ref });
}
}
@ -318,7 +318,7 @@ export class CommitsView extends ViewBase {
if (n.id.startsWith(repoNodeId)) {
const node = await n.getSplattedChild?.();
if (node instanceof BranchNode) {
await node.showMore({ until: commit.ref });
await node.loadMore({ until: commit.ref });
return true;
}
}

+ 3
- 3
src/views/nodes/branchNode.ts 查看文件

@ -4,7 +4,7 @@ import { BranchesView } from '../branchesView';
import { BranchTrackingStatusNode } from './branchTrackingStatusNode';
import { CommitNode } from './commitNode';
import { CommitsView } from '../commitsView';
import { MessageNode, ShowMoreNode } from './common';
import { LoadMoreNode, MessageNode } from './common';
import { ViewBranchesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
@ -151,7 +151,7 @@ export class BranchNode
);
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
this._children = children;
@ -297,7 +297,7 @@ export class BranchNode
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 3
- 3
src/views/nodes/branchTrackingStatusNode.ts 查看文件

@ -3,7 +3,7 @@ import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { BranchNode } from './branchNode';
import { BranchTrackingStatusFilesNode } from './branchTrackingStatusFilesNode';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { LoadMoreNode } from './common';
import { Container } from '../../container';
import { GitBranch, GitLog, GitRevision, GitTrackingState } from '../../git/git';
import { GitUri } from '../../git/gitUri';
@ -94,7 +94,7 @@ export class BranchTrackingStatusNode extends ViewNode implement
}
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
if (!this.isReposView && this.status.upstream && this.upstreamType === 'ahead' && this.status.state.ahead > 0) {
@ -232,7 +232,7 @@ export class BranchTrackingStatusNode extends ViewNode implement
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 12
- 12
src/views/nodes/common.ts 查看文件

@ -140,22 +140,22 @@ export abstract class PagerNode extends ViewNode {
view: View,
parent: ViewNode & PageableViewNode,
protected readonly message: string,
private readonly _previousNode?: ViewNode,
private readonly _pageSize: number = Container.config.views.pageItemLimit,
protected readonly previousNode?: ViewNode,
protected readonly pageSize: number = Container.config.views.pageItemLimit,
) {
super(unknownGitUri, view, parent);
}
showMore() {
return this.view.showMoreNodeChildren(
this.parent! as ViewNode & PageableViewNode,
this._pageSize,
this._previousNode,
);
loadAll() {
return this.view.loadMoreNodeChildren(this.parent! as ViewNode & PageableViewNode, 0, this.previousNode);
}
showAll() {
return this.view.showMoreNodeChildren(this.parent! as ViewNode & PageableViewNode, 0, this._previousNode);
loadMore() {
return this.view.loadMoreNodeChildren(
this.parent! as ViewNode & PageableViewNode,
this.pageSize,
this.previousNode,
);
}
getChildren(): ViewNode[] | Promise<ViewNode[]> {
@ -172,13 +172,13 @@ export abstract class PagerNode extends ViewNode {
getCommand(): Command | undefined {
return {
title: 'Load more',
command: 'gitlens.views.showMoreChildren',
command: 'gitlens.views.loadMoreChildren',
arguments: [this],
};
}
}
export class ShowMoreNode extends PagerNode {
export class LoadMoreNode extends PagerNode {
constructor(view: View, parent: ViewNode & PageableViewNode, previousNode: ViewNode, pageSize?: number) {
super(
view,

+ 3
- 3
src/views/nodes/contributorNode.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { MessageNode, ShowMoreNode } from './common';
import { LoadMoreNode, MessageNode } from './common';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { ContributorsView } from '../contributorsView';
@ -54,7 +54,7 @@ export class ContributorNode extends ViewNode
];
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
return children;
}
@ -111,7 +111,7 @@ export class ContributorNode extends ViewNode
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 3
- 3
src/views/nodes/fileHistoryNode.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitFileNode } from './commitFileNode';
import { MessageNode, ShowMoreNode } from './common';
import { LoadMoreNode, MessageNode } from './common';
import { Container } from '../../container';
import { FileHistoryTrackerNode } from './fileHistoryTrackerNode';
import {
@ -82,7 +82,7 @@ export class FileHistoryNode extends SubscribeableViewNode implements PageableVi
);
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
}
@ -174,7 +174,7 @@ export class FileHistoryNode extends SubscribeableViewNode implements PageableVi
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 3
- 3
src/views/nodes/lineHistoryNode.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { Disposable, Selection, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitFileNode } from './commitFileNode';
import { MessageNode, ShowMoreNode } from './common';
import { LoadMoreNode, MessageNode } from './common';
import { Container } from '../../container';
import {
GitCommitType,
@ -203,7 +203,7 @@ export class LineHistoryNode extends SubscribeableViewNode implements PageableVi
);
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
}
@ -303,7 +303,7 @@ export class LineHistoryNode extends SubscribeableViewNode implements PageableVi
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 6
- 6
src/views/nodes/reflogNode.ts 查看文件

@ -1,14 +1,14 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { LoadMoreNode, MessageNode } from './common';
import { Container } from '../../container';
import { GitReflog, Repository } from '../../git/git';
import { GitUri } from '../../git/gitUri';
import { ContextValues, PageableViewNode, ViewNode } from './viewNode';
import { RepositoriesView } from '../repositoriesView';
import { ReflogRecordNode } from './reflogRecordNode';
import { debug, gate } from '../../system';
import { MessageNode, ShowMoreNode } from './common';
import { RepositoriesView } from '../repositoriesView';
import { RepositoryNode } from './repositoryNode';
import { debug, gate } from '../../system';
import { ContextValues, PageableViewNode, ViewNode } from './viewNode';
export class ReflogNode extends ViewNode<RepositoriesView> implements PageableViewNode {
static key = ':reflog';
@ -38,7 +38,7 @@ export class ReflogNode extends ViewNode implements PageableVi
children.push(...reflog.records.map(r => new ReflogRecordNode(this.view, this, r)));
if (reflog.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
this._children = children;
@ -85,7 +85,7 @@ export class ReflogNode extends ViewNode implements PageableVi
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number) {
async loadMore(limit?: number) {
let reflog = await this.getReflog();
if (reflog === undefined || !reflog.hasMore) return;

+ 6
- 6
src/views/nodes/reflogRecordNode.ts 查看文件

@ -1,15 +1,15 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { LoadMoreNode, MessageNode } from './common';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitLog, GitReflogRecord } from '../../git/git';
import { GitUri } from '../../git/gitUri';
import { RepositoryNode } from './repositoryNode';
import { debug, gate, Iterables } from '../../system';
import { ViewsWithFiles } from '../viewBase';
import { CommitNode } from './commitNode';
import { MessageNode, ShowMoreNode } from './common';
import { ContextValues, PageableViewNode, ViewNode } from './viewNode';
import { RepositoryNode } from './repositoryNode';
export class ReflogRecordNode extends ViewNode<ViewsWithFiles> implements PageableViewNode {
static key = ':reflog-record';
@ -45,12 +45,12 @@ export class ReflogRecordNode extends ViewNode implements Pageab
const log = await this.getLog();
if (log === undefined) return [new MessageNode(this.view, this, 'No commits could be found.')];
const children: (CommitNode | ShowMoreNode)[] = [
const children: (CommitNode | LoadMoreNode)[] = [
...Iterables.map(log.commits.values(), c => new CommitNode(this.view, this, c)),
];
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
return children;
}
@ -104,7 +104,7 @@ export class ReflogRecordNode extends ViewNode implements Pageab
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log === undefined || !log.hasMore) return;

+ 5
- 5
src/views/nodes/resultsCommitsNode.ts 查看文件

@ -1,13 +1,13 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { LoadMoreNode } from './common';
import { Container } from '../../container';
import { GitLog } from '../../git/git';
import { GitUri } from '../../git/gitUri';
import { insertDateMarkers } from './helpers';
import { debug, gate, Iterables, Promises } from '../../system';
import { ViewsWithFiles } from '../viewBase';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { insertDateMarkers } from './helpers';
import { ContextValues, PageableViewNode, ViewNode } from './viewNode';
export interface CommitsQueryResults {
@ -59,7 +59,7 @@ export class ResultsCommitsNode extends ViewNode implements Page
];
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
return children;
@ -128,7 +128,7 @@ export class ResultsCommitsNode extends ViewNode implements Page
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number) {
async loadMore(limit?: number) {
const results = await this.getCommitsQueryResults();
if (results === undefined || !results.hasMore) return;

+ 8
- 8
src/views/nodes/tagNode.ts 查看文件

@ -1,19 +1,19 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { LoadMoreNode, MessageNode } from './common';
import { ViewBranchesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { emojify } from '../../emojis';
import { GitLog, GitRevision, GitTag, GitTagReference, TagDateFormatting } from '../../git/git';
import { GitUri } from '../../git/gitUri';
import { debug, gate, Iterables, Strings } from '../../system';
import { RepositoriesView } from '../repositoriesView';
import { CommitNode } from './commitNode';
import { MessageNode, ShowMoreNode } from './common';
import { insertDateMarkers } from './helpers';
import { ContextValues, PageableViewNode, ViewNode, ViewRefNode } from './viewNode';
import { emojify } from '../../emojis';
import { RepositoryNode } from './repositoryNode';
import { GlyphChars } from '../../constants';
import { debug, gate, Iterables, Strings } from '../../system';
import { TagsView } from '../tagsView';
import { ContextValues, PageableViewNode, ViewNode, ViewRefNode } from './viewNode';
export class TagNode extends ViewRefNode<TagsView | RepositoriesView, GitTagReference> implements PageableViewNode {
static key = ':tag';
@ -57,7 +57,7 @@ export class TagNode extends ViewRefNode
];
if (log.hasMore) {
children.push(new ShowMoreNode(this.view, this, children[children.length - 1]));
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}
return children;
}
@ -109,7 +109,7 @@ export class TagNode extends ViewRefNode
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async showMore(limit?: number | { until?: any }) {
async loadMore(limit?: number | { until?: any }) {
let log = await this.getLog();
if (log == null || !log.hasMore) return;

+ 2
- 2
src/views/nodes/viewNode.ts 查看文件

@ -144,12 +144,12 @@ export interface PageableViewNode {
readonly id: string;
limit?: number;
readonly hasMore: boolean;
showMore(limit?: number | { until?: any }): Promise<void>;
loadMore(limit?: number | { until?: any }): Promise<void>;
}
export namespace PageableViewNode {
export function is(node: ViewNode): node is ViewNode & PageableViewNode {
return Functions.is<ViewNode & PageableViewNode>(node, 'showMore');
return Functions.is<ViewNode & PageableViewNode>(node, 'loadMore');
}
}

+ 1
- 1
src/views/repositoriesView.ts 查看文件

@ -194,7 +194,7 @@ export class RepositoriesView extends ViewBase
if (n instanceof BranchNode) {
if (n.id.startsWith(repoNodeId) && branches.includes(n.branch.name)) {
await n.showMore({ until: commit.ref });
await n.loadMore({ until: commit.ref });
return true;
}
}

+ 8
- 8
src/views/viewBase.ts 查看文件

@ -407,7 +407,7 @@ export abstract class ViewBase<
while (true) {
if (token?.isCancellationRequested) return undefined;
await this.showMoreNodeChildren(node, defaultPageSize);
await this.loadMoreNodeChildren(node, defaultPageSize);
pagedChildren = await Promises.cancellable(
Promise.resolve(node.getChildren()),
@ -530,18 +530,13 @@ export abstract class ViewBase<
return this._lastKnownLimits.get(node.id);
}
@debug({ args: { 0: (n: ViewNode) => n.toString() }, singleLine: true })
resetNodeLastKnownLimit(node: PageableViewNode) {
this._lastKnownLimits.delete(node.id);
}
@debug({
args: {
0: (n: ViewNode & PageableViewNode) => n.toString(),
3: (n?: ViewNode) => (n == null ? '' : n.toString()),
},
})
async showMoreNodeChildren(
async loadMoreNodeChildren(
node: ViewNode & PageableViewNode,
limit: number | { until: any } | undefined,
previousNode?: ViewNode,
@ -550,10 +545,15 @@ export abstract class ViewBase<
void (await this.reveal(previousNode, { select: true }));
}
await node.showMore(limit);
await node.loadMore(limit);
this._lastKnownLimits.set(node.id, node.limit);
}
@debug({ args: { 0: (n: ViewNode) => n.toString() }, singleLine: true })
resetNodeLastKnownLimit(node: PageableViewNode) {
this._lastKnownLimits.delete(node.id);
}
@debug({
args: { 0: (n: ViewNode) => (n != null ? n.toString() : '') },
})

+ 2
- 2
src/views/viewCommands.ts 查看文件

@ -90,8 +90,8 @@ export class ViewCommands {
this,
);
commands.registerCommand('gitlens.views.executeNodeCallback', (fn: <R>() => Promise<R>) => fn(), this);
commands.registerCommand('gitlens.views.showMoreChildren', (node: PagerNode) => node.showMore(), this);
commands.registerCommand('gitlens.views.showAllChildren', (node: PagerNode) => node.showAll(), this);
commands.registerCommand('gitlens.views.loadMoreChildren', (node: PagerNode) => node.loadMore(), this);
commands.registerCommand('gitlens.views.loadAllChildren', (node: PagerNode) => node.loadAll(), this);
commands.registerCommand('gitlens.views.fetch', this.fetch, this);
commands.registerCommand('gitlens.views.publishBranch', this.publishBranch, this);

Loading…
取消
儲存