File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const CHUNK_SIZE = 1000;
1414const CHUNK_INTERVAL = 100 ;
1515
1616export type MatchProcessorOptions = {
17+ initialIndex ?: number ;
1718 interval ?: number ;
1819 threshold ?: number ;
1920 chunkSize ?: number ;
@@ -37,7 +38,9 @@ export class MatchProcessor<T extends Detail> implements Disposable {
3738 matchers : readonly [ Matcher < T > , ...Matcher < T > [ ] ] ,
3839 options : MatchProcessorOptions = { } ,
3940 ) {
40- this . matchers = new ItemBelt ( matchers ) ;
41+ this . matchers = new ItemBelt ( matchers , {
42+ index : options . initialIndex ,
43+ } ) ;
4144 this . #interval = options . interval ?? INTERVAL ;
4245 this . #threshold = options . threshold ?? THRESHOLD ;
4346 this . #chunkSize = options . chunkSize ?? CHUNK_SIZE ;
Original file line number Diff line number Diff line change @@ -8,15 +8,24 @@ import type {
88import { ItemBelt } from "../lib/item_belt.ts" ;
99import { dispatch } from "../event.ts" ;
1010
11+ export type PreviewProcessorOptions = {
12+ initialIndex ?: number ;
13+ } ;
14+
1115export class PreviewProcessor < T extends Detail > implements Disposable {
1216 readonly #controller: AbortController = new AbortController ( ) ;
1317 readonly previewers : ItemBelt < Previewer < T > > ;
1418 #processing?: Promise < void > ;
1519 #reserved?: ( ) => void ;
1620 #item: PreviewItem | undefined = undefined ;
1721
18- constructor ( previewers : readonly Previewer < T > [ ] ) {
19- this . previewers = new ItemBelt ( previewers ) ;
22+ constructor (
23+ previewers : readonly Previewer < T > [ ] ,
24+ options : PreviewProcessorOptions = { } ,
25+ ) {
26+ this . previewers = new ItemBelt ( previewers , {
27+ index : options . initialIndex ,
28+ } ) ;
2029 }
2130
2231 get #previewer( ) : Previewer < T > | undefined {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const HEIGHT = 10;
1414const SCROLL_OFFSET = 2 ;
1515
1616export type RenderProcessorOptions = {
17+ initialIndex ?: number ;
1718 height ?: number ;
1819 scrollOffset ?: number ;
1920} ;
@@ -34,7 +35,9 @@ export class RenderProcessor<T extends Detail> implements Disposable {
3435 renderers : readonly Renderer < T > [ ] ,
3536 options : RenderProcessorOptions = { } ,
3637 ) {
37- this . renderers = new ItemBelt ( renderers ) ;
38+ this . renderers = new ItemBelt ( renderers , {
39+ index : options . initialIndex ,
40+ } ) ;
3841 this . #height = options . height ?? HEIGHT ;
3942 this . #scrollOffset = options . scrollOffset ?? SCROLL_OFFSET ;
4043 }
Original file line number Diff line number Diff line change @@ -5,15 +5,23 @@ import type { Sorter } from "jsr:@vim-fall/core@^0.3.0/sorter";
55import { ItemBelt } from "../lib/item_belt.ts" ;
66import { dispatch } from "../event.ts" ;
77
8+ export type SortProcessorOptions = {
9+ initialIndex ?: number ;
10+ } ;
11+
812export class SortProcessor < T extends Detail > implements Disposable {
913 readonly #controller: AbortController = new AbortController ( ) ;
1014 readonly sorters : ItemBelt < Sorter < T > > ;
1115 #processing?: Promise < void > ;
1216 #reserved?: ( ) => void ;
1317 #items: IdItem < T > [ ] = [ ] ;
14-
15- constructor ( sorters : readonly Sorter < T > [ ] ) {
16- this . sorters = new ItemBelt ( sorters ) ;
18+ constructor (
19+ sorters : readonly Sorter < T > [ ] ,
20+ options : SortProcessorOptions = { } ,
21+ ) {
22+ this . sorters = new ItemBelt ( sorters , {
23+ index : options . initialIndex ,
24+ } ) ;
1725 }
1826
1927 get #sorter( ) : Sorter < T > | undefined {
You can’t perform that action at this time.
0 commit comments