File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -11,25 +11,23 @@ export function activate (context: vscode.ExtensionContext) {
1111 'http://localhost:3033/snippets/embed-folder'
1212 )
1313
14- const options : vscode . QuickPickItem [ ] = [ ]
14+ const options = data
15+ . filter ( i => ! i . isDeleted )
16+ . reduce ( ( acc : vscode . QuickPickItem [ ] , snippet ) => {
17+ const fragments = snippet . content . map ( fragment => {
18+ return {
19+ label : snippet . name || '' ,
20+ detail : snippet . content . length > 1 ? fragment . label : '' ,
21+ description : `${ fragment . language } • ${
22+ snippet . folder ?. name || 'Inbox'
23+ } `
24+ }
25+ } )
1526
16- for ( const snippet of data ) {
17- if ( snippet . isDeleted ) continue
27+ acc . push ( ...fragments )
1828
19- for ( const fragment of snippet . content ) {
20- let fragmentLabel = ''
21- if ( snippet . content . length > 1 ) {
22- fragmentLabel = fragment . label
23- }
24- options . push ( {
25- label : `${ snippet . name || '' } ` ,
26- detail : `${ fragmentLabel } ` ,
27- description : `${ fragment . language } • ${
28- snippet . folder ?. name || 'Inbox'
29- } `
30- } )
31- }
32- }
29+ return acc
30+ } , [ ] ) as vscode . QuickPickItem [ ]
3331
3432 let fragmentContent = ''
3533
You can’t perform that action at this time.
0 commit comments