diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index 938251d..d71ffff 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -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(node, 'supportsPaging', true); + +export namespace PageableViewNode { + export function is(node: ViewNode): node is ViewNode & PageableViewNode { + return Functions.is(node, 'supportsPaging', true); + } } export abstract class SubscribeableViewNode extends ViewNode { diff --git a/src/views/viewBase.ts b/src/views/viewBase.ts index 38919e8..d49ee3a 100644 --- a/src/views/viewBase.ts +++ b/src/views/viewBase.ts @@ -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) { // Clear any last max count if the node was collapsed - if (nodeSupportsPaging(e.element)) { + if (PageableViewNode.is(e.element)) { this.resetNodeLastMaxCount(e.element); } diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index 9304b79..4cba171 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -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); }