11import {
22 BaseSource ,
3- Candidate ,
43 fn ,
5- GatherCandidatesArguments ,
4+ GatherArguments ,
65 homeDir ,
6+ Item ,
77 path as univPath ,
88 vars ,
99 wrapA ,
@@ -15,10 +15,10 @@ type Params = {
1515 mode : "os" | "win32" | "posix" ;
1616 takeFileNum : number ;
1717 projMarkers : string [ ] ;
18- cwdMaxCandidates : number ;
19- bufMaxCandidates : number ;
20- projFromCwdMaxCandidates : number [ ] ;
21- projFromBufMaxCandidates : number [ ] ;
18+ cwdMaxItems : number ;
19+ bufMaxItems : number ;
20+ projFromCwdMaxItems : number [ ] ;
21+ projFromBufMaxItems : number [ ] ;
2222 cwdAsRoot : boolean ;
2323 bufAsRoot : boolean ;
2424 projAsRoot : boolean ;
@@ -57,19 +57,19 @@ const existsDir = async (filePath: string): Promise<boolean> => {
5757} ;
5858
5959export class Source extends BaseSource < Params > {
60- async gatherCandidates (
61- args : GatherCandidatesArguments < Params > ,
62- ) : Promise < Candidate [ ] > {
60+ async gather (
61+ args : GatherArguments < Params > ,
62+ ) : Promise < Item [ ] > {
6363 const p = args . sourceParams ;
6464 const mode = p . mode === "os"
6565 ? ( Deno . build . os === "windows" ? "win32" : "posix" )
6666 : p . mode ;
6767 const path = mode === "posix" ? univPath . posix : univPath . win32 ;
6868 const maxOfMax = Math . max (
69- p . cwdMaxCandidates ,
70- p . bufMaxCandidates ,
71- ...p . projFromCwdMaxCandidates ,
72- ...p . projFromBufMaxCandidates ,
69+ p . cwdMaxItems ,
70+ p . bufMaxItems ,
71+ ...p . projFromCwdMaxItems ,
72+ ...p . projFromBufMaxItems ,
7373 ) ;
7474
7575 // e.g. (
@@ -162,23 +162,23 @@ export class Source extends BaseSource<Params> {
162162 // point from cwd
163163 findPointsAsync . push ( {
164164 dir : cwd ,
165- max : p . cwdMaxCandidates ,
165+ max : p . cwdMaxItems ,
166166 menu : p . displayCwd ,
167167 asRoot : p . cwdAsRoot ,
168168 } ) ;
169169
170170 // point from project-root found from cwd
171171 findPointsAsync . push (
172172 util . findMarkers (
173- p . projFromCwdMaxCandidates . length ,
173+ p . projFromCwdMaxItems . length ,
174174 cwd ,
175175 p . projMarkers ,
176176 path ,
177177 )
178178 . then ( ( dirs ) =>
179179 dirs . map ( ( dir , i ) => ( {
180180 dir,
181- max : p . projFromCwdMaxCandidates [ i ] ,
181+ max : p . projFromCwdMaxItems [ i ] ,
182182 menu : `${ p . displayCwd } ^${ i === 0 ? "" : i + 1 } ` ,
183183 asRoot : p . projAsRoot ,
184184 } ) )
@@ -192,22 +192,22 @@ export class Source extends BaseSource<Params> {
192192 findPointsAsync . push ( {
193193 dir : bufDir ,
194194 menu : p . displayBuf ,
195- max : p . bufMaxCandidates ,
195+ max : p . bufMaxItems ,
196196 asRoot : p . bufAsRoot ,
197197 } ) ;
198198
199199 // point from project-root found from buf
200200 findPointsAsync . push (
201201 util . findMarkers (
202- p . projFromBufMaxCandidates . length ,
202+ p . projFromBufMaxItems . length ,
203203 bufDir ,
204204 p . projMarkers ,
205205 path ,
206206 )
207207 . then ( ( dirs ) =>
208208 dirs . map ( ( dir , i ) => ( {
209209 dir,
210- max : p . projFromBufMaxCandidates [ i ] ,
210+ max : p . projFromBufMaxItems [ i ] ,
211211 menu : `${ p . displayBuf } ^${ i === 0 ? "" : i + 1 } ` ,
212212 asRoot : p . projAsRoot ,
213213 } ) )
@@ -243,7 +243,7 @@ export class Source extends BaseSource<Params> {
243243 } ) ) ,
244244 ) ;
245245
246- const candidatesList = await Promise . all (
246+ const itemsList = await Promise . all (
247247 resolvedFindPoints
248248 . filter ( ( { ex } ) => ex )
249249 . map ( ( { point } ) => point )
@@ -261,7 +261,7 @@ export class Source extends BaseSource<Params> {
261261 ( entry . isSymlink && p . followSymlinks &&
262262 await existsDir ( path . join ( dir , entry . name ) ) ) ,
263263 } ) )
264- . map ( ( { name, isDirectory, isSymlink } ) : Candidate => ( {
264+ . map ( ( { name, isDirectory, isSymlink } ) : Item => ( {
265265 word : name . slice ( inputFileBasePrefix . length ) +
266266 ( p . trailingSlash && isDirectory ? path . sep : "" ) ,
267267 abbr : name . slice ( inputFileBasePrefix . length ) +
@@ -282,10 +282,9 @@ export class Source extends BaseSource<Params> {
282282 . catch ( ( ) => [ ] ) ,
283283 ) ,
284284 ) ;
285- const candidates : Candidate [ ] = candidatesList
286- . flat ( ) ;
285+ const items : Item [ ] = itemsList . flat ( ) ;
287286
288- return candidates ;
287+ return items ;
289288 }
290289
291290 params ( ) : Params {
@@ -297,10 +296,10 @@ export class Source extends BaseSource<Params> {
297296 ".github" ,
298297 ] ,
299298 takeFileNum : 10000 ,
300- cwdMaxCandidates : 1000 ,
301- bufMaxCandidates : 1000 ,
302- projFromCwdMaxCandidates : [ 1000 ] ,
303- projFromBufMaxCandidates : [ 1000 ] ,
299+ cwdMaxItems : 1000 ,
300+ bufMaxItems : 1000 ,
301+ projFromCwdMaxItems : [ 1000 ] ,
302+ projFromBufMaxItems : [ 1000 ] ,
304303 cwdAsRoot : false ,
305304 bufAsRoot : false ,
306305 projAsRoot : true ,
0 commit comments