Browse Source

Keeps context when showing more items in a view

main
Eric Amodio 5 years ago
parent
commit
6e42e4d6b1
12 changed files with 36 additions and 11 deletions
  1. +3
    -1
      CHANGELOG.md
  2. +1
    -0
      README.md
  3. +6
    -0
      package.json
  4. +1
    -0
      src/config.ts
  5. +1
    -1
      src/views/nodes/branchNode.ts
  6. +1
    -1
      src/views/nodes/branchTrackingStatusNode.ts
  7. +15
    -5
      src/views/nodes/common.ts
  8. +1
    -1
      src/views/nodes/contributorNode.ts
  9. +1
    -1
      src/views/nodes/resultsCommitsNode.ts
  10. +1
    -1
      src/views/nodes/tagNode.ts
  11. +4
    -0
      src/views/viewBase.ts
  12. +1
    -0
      src/views/viewCommands.ts

+ 3
- 1
CHANGELOG.md View File

@ -21,13 +21,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- A context menu provides access to more common file revision commands
- Adds a _Collapse All_ command to the _Repositories_ view — closes [#688](https://github.com/eamodio/vscode-gitlens/issues/688)
- Adds version links to CHANGELOG — closes [#617](https://github.com/eamodio/vscode-gitlens/issues/617) thanks to [PR #600](https://github.com/eamodio/vscode-gitlens/pull/660) by John Gee ([@shadowspawn](https://github.com/shadowspawn))
- Adds a `gitlens.views.pageItemLimit` setting to specify the number of items to show in a each page when paginating a view list. Use 0 to specify no limit
### Changed
- Updates the invite link to the [VS Code Development Community Slack](https://vscode-slack.amod.io)
- Improves the behavior of the _Show More Commits_ & _Show More Results_ commands - no longer loses the context of the last selected item before showing more
- Improves the behavior of the _Open Changes with Next Revision_ (`gitlens.diffWithNext`) command when in the diff editor
- Improves the behavior of the _Open Changes with Previous Revision_ (`gitlens.diffWithPrevious`) command when in the diff editor
- Improves the behavior of the _Open Changes with Working File_ (`gitlens.diffWithWorking`) command when in the diff editor
- Updates the invite link to the [VS Code Development Community Slack](https://vscode-slack.amod.io)
### Fixed

+ 1
- 0
README.md View File

@ -817,6 +817,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.commitDescriptionFormat` | Specifies the description format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${email}` &mdash; commit author e-mail<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}` &mdash; formatted commit date (format specified by `gitlens.defaultDateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.defaultItemLimit` | Specifies the default number of items to show in a view list. Use 0 to specify no limit |
| `gitlens.views.pageItemLimit` | Specifies the number of items to show in a each page when paginating a view list. Use 0 to specify no limit |
| `gitlens.views.showRelativeDateMarkers` | Specifies whether to show relative date markers (_Less than a week ago_, _Over a week ago_, _Over a month ago_, etc) on revision (commit) histories in the views |
| `gitlens.views.stashFileFormat` | Specifies the format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.stashFileDescriptionFormat` | Specifies the description format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |

+ 6
- 0
package.json View File

@ -1335,6 +1335,12 @@
"markdownDescription": "Specifies the default number of items to show in a view list. Use 0 to specify no limit",
"scope": "window"
},
"gitlens.views.pageItemLimit": {
"type": "number",
"default": 20,
"markdownDescription": "Specifies the number of items to show in a each page when paginating a view list. Use 0 to specify no limit",
"scope": "window"
},
"gitlens.views.fileHistory.avatars": {
"type": "boolean",
"default": true,

+ 1
- 0
src/config.ts View File

@ -367,6 +367,7 @@ export interface ViewsConfig {
compare: CompareViewConfig;
defaultItemLimit: number;
lineHistory: LineHistoryViewConfig;
pageItemLimit: number;
repositories: RepositoriesViewConfig;
search: SearchViewConfig;
showRelativeDateMarkers: boolean;

+ 1
- 1
src/views/nodes/branchNode.ts View File

@ -96,7 +96,7 @@ export class BranchNode extends ViewRefNode implements Pageabl
);
if (log.truncated) {
children.push(new ShowMoreNode(this.view, this, 'Commits'));
children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1]));
}
this._children = children;

+ 1
- 1
src/views/nodes/branchTrackingStatusNode.ts View File

@ -74,7 +74,7 @@ export class BranchTrackingStatusNode extends ViewNode implements
}
if (log.truncated) {
children.push(new ShowMoreNode(this.view, this, 'Commits'));
children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1]));
}
return children;
}

+ 15
- 5
src/views/nodes/common.ts View File

@ -139,8 +139,17 @@ export class UpdateableMessageNode extends ViewNode {
export abstract class PagerNode extends ViewNode {
protected _args: RefreshNodeCommandArgs = {};
constructor(view: View, parent: ViewNode, protected readonly message: string) {
constructor(
view: View,
parent: ViewNode,
protected readonly message: string,
previousNode?: ViewNode,
maxCount: number = Container.config.views.pageItemLimit
) {
super(unknownGitUri, view, parent);
this._args.maxCount = maxCount;
this._args.previousNode = previousNode;
}
getChildren(): ViewNode[] | Promise<ViewNode[]> {
@ -168,14 +177,15 @@ export abstract class PagerNode extends ViewNode {
}
export class ShowMoreNode extends PagerNode {
constructor(view: View, parent: ViewNode, type: string, maxCount: number = Container.config.advanced.maxListItems) {
constructor(view: View, parent: ViewNode, itemType: string, previousNode: ViewNode, maxCount?: number) {
super(
view,
parent,
maxCount === 0
? `Show All ${type} ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`
: `Show More ${type}`
? `Show All ${itemType} ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`
: `Show More ${itemType}`,
previousNode,
maxCount
);
this._args.maxCount = maxCount;
}
}

+ 1
- 1
src/views/nodes/contributorNode.ts View File

@ -42,7 +42,7 @@ export class ContributorNode extends ViewNode implements Pagea
];
if (log.truncated) {
children.push(new ShowMoreNode(this.view, this, 'Commits'));
children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1]));
}
return children;
}

+ 1
- 1
src/views/nodes/resultsCommitsNode.ts View File

@ -47,7 +47,7 @@ export class ResultsCommitsNode extends ViewNode implements Pagea
];
if (log.truncated) {
children.push(new ShowMoreNode(this.view, this, 'Results'));
children.push(new ShowMoreNode(this.view, this, 'Results', children[children.length - 1]));
}
return children;

+ 1
- 1
src/views/nodes/tagNode.ts View File

@ -49,7 +49,7 @@ export class TagNode extends ViewRefNode implements PageableVi
];
if (log.truncated) {
children.push(new ShowMoreNode(this.view, this, 'Commits'));
children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1]));
}
return children;
}

+ 4
- 0
src/views/viewBase.ts View File

@ -158,6 +158,10 @@ export abstract class ViewBase> implements TreeData
else {
node.maxCount = (node.maxCount || args.maxCount) + args.maxCount;
}
if (args.previousNode !== undefined) {
void (await this.reveal(args.previousNode, { select: true }));
}
}
}

+ 1
- 0
src/views/viewCommands.ts View File

@ -39,6 +39,7 @@ import { Strings } from '../system/string';
export interface RefreshNodeCommandArgs {
maxCount?: number;
previousNode?: ViewNode;
}
interface CompareSelectedInfo {

Loading…
Cancel
Save