File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
providers/FileSystemPovider Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ export interface SearchResult {
5656 matches : SearchMatch [ ] ;
5757}
5858
59+ export interface DocSearchResult {
60+ name : string ;
61+ cat : "RTN" | "CLS" | "CSP" | "OTH" ;
62+ ts : string ;
63+ db : string ;
64+ gen : boolean ;
65+ }
66+
5967export interface AtelierJob {
6068 pid : number ;
6169 namespace : string ;
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
2+ import { DocSearchResult } from "../../api/atelier" ;
3+ import { AtelierAPI } from "../../api" ;
24
35export class FileSearchProvider implements vscode . FileSearchProvider {
46 /**
@@ -12,6 +14,32 @@ export class FileSearchProvider implements vscode.FileSearchProvider {
1214 options : vscode . FileSearchOptions ,
1315 token : vscode . CancellationToken
1416 ) : vscode . ProviderResult < vscode . Uri [ ] > {
15- return [ ] ;
17+ const category = `&${ options . folder . query } &` . includes ( "&csp&" ) ? "CSP" : "*" ;
18+ const generated = `&${ options . folder . query } &` . includes ( "&generated=1&" ) ;
19+ const api = new AtelierAPI ( options . folder ) ;
20+ let counter = 0 ;
21+ if ( ! api . enabled ) {
22+ return null ;
23+ }
24+ return api
25+ . getDocNames ( {
26+ filter : query . pattern ,
27+ category,
28+ generated
29+ } )
30+ . then ( ( data ) => data . result . content )
31+ . then ( ( files : DocSearchResult [ ] ) =>
32+ files . map ( ( file ) => {
33+ if ( category === "*" && file . cat === "CSP" ) {
34+ return null ;
35+ }
36+ if ( ! options . maxResults || ++ counter <= options . maxResults ) {
37+ return options . folder . with ( { path : `/${ file . name } ` } ) ;
38+ } else {
39+ return null ;
40+ }
41+ } )
42+ . filter ( ( el ) => el !== null )
43+ ) ;
1644 }
1745}
You can’t perform that action at this time.
0 commit comments