Browse Source

Renames nodeSupportsPaging to PageableViewNode.is

main
Eric Amodio 5 years ago
parent
commit
9f291ef720
3 changed files with 9 additions and 7 deletions
  1. +5
    -2
      src/views/nodes/viewNode.ts
  2. +2
    -3
      src/views/viewBase.ts
  3. +2
    -2
      src/views/viewCommands.ts

+ 5
- 2
src/views/nodes/viewNode.ts View File

@ -123,8 +123,11 @@ export interface PageableViewNode {
readonly rememberLastMaxCount?: boolean;
maxCount: number | undefined;
}
export function nodeSupportsPaging(node: ViewNode): node is ViewNode & PageableViewNode {
return Functions.is<ViewNode & PageableViewNode>(node, 'supportsPaging', true);
export namespace PageableViewNode {
export function is(node: ViewNode): node is ViewNode & PageableViewNode {
return Functions.is<ViewNode & PageableViewNode>(node, 'supportsPaging', true);
}
}
export abstract class SubscribeableViewNode<TView extends View = View> extends ViewNode<TView> {

+ 2
- 3
src/views/viewBase.ts View File

@ -22,8 +22,7 @@ import { debug, Functions, log, Strings } from '../system';
import { CompareView } from './compareView';
import { FileHistoryView } from './fileHistoryView';
import { LineHistoryView } from './lineHistoryView';
import { ViewNode } from './nodes';
import { nodeSupportsPaging, PageableViewNode } from './nodes/viewNode';
import { PageableViewNode, ViewNode } from './nodes';
import { RepositoriesView } from './repositoriesView';
import { SearchView } from './searchView';
@ -129,7 +128,7 @@ export abstract class ViewBase> implements TreeData
protected onElementCollapsed(e: TreeViewExpansionEvent<ViewNode>) {
// Clear any last max count if the node was collapsed
if (nodeSupportsPaging(e.element)) {
if (PageableViewNode.is(e.element)) {
this.resetNodeLastMaxCount(e.element);
}

+ 2
- 2
src/views/viewCommands.ts View File

@ -26,7 +26,7 @@ import {
FileHistoryNode,
FolderNode,
LineHistoryNode,
nodeSupportsPaging,
PageableViewNode,
PagerNode,
RemoteNode,
RepositoryNode,
@ -68,7 +68,7 @@ export class ViewCommands {
commands.registerCommand(
'gitlens.views.refreshNode',
(node: ViewNode, reset?: boolean) => {
if (reset == null && nodeSupportsPaging(node)) {
if (reset == null && PageableViewNode.is(node)) {
node.maxCount = undefined;
node.view.resetNodeLastMaxCount(node);
}

Loading…
Cancel
Save