@@ -180,11 +180,16 @@ class TreeDataProviderDelegate implements vscode.TreeDataProvider<undefined> {
180180// --- history
181181
182182class HistoryItem {
183+
184+ readonly description : string ;
185+
183186 constructor (
184187 readonly word : string ,
185188 readonly anchor : WordAnchor ,
186189 readonly input : SymbolTreeInput ,
187- ) { }
190+ ) {
191+ this . description = `${ vscode . workspace . asRelativePath ( input . uri ) } • ${ input . title . toLocaleLowerCase ( ) } ` ;
192+ }
188193}
189194
190195class TreeInputHistory implements vscode . TreeDataProvider < HistoryItem > {
@@ -221,7 +226,22 @@ class TreeInputHistory implements vscode.TreeDataProvider<HistoryItem>{
221226 const position = item . anchor . getPosition ( ) ?? item . input . position ;
222227 return vscode . commands . executeCommand ( 'vscode.open' , item . input . uri , { selection : new vscode . Range ( position , position ) } ) ;
223228 }
224- } )
229+ } ) ,
230+ vscode . commands . registerCommand ( 'references-view.pickFromHistory' , async ( ) => {
231+ interface HistoryPick extends vscode . QuickPickItem {
232+ item : HistoryItem ;
233+ }
234+ const entries = await this . getChildren ( ) ;
235+ const picks = entries . map ( item => < HistoryPick > {
236+ label : item . word ,
237+ description : item . description ,
238+ item
239+ } ) ;
240+ const pick = await vscode . window . showQuickPick ( picks , { placeHolder : 'Select previous reference search' } ) ;
241+ if ( pick ) {
242+ this . _reRunHistoryItem ( pick . item ) ;
243+ }
244+ } ) ,
225245 ) ;
226246 }
227247
@@ -264,10 +284,10 @@ class TreeInputHistory implements vscode.TreeDataProvider<HistoryItem>{
264284
265285 // --- tree data provider
266286
267- getTreeItem ( element : HistoryItem ) : vscode . TreeItem {
268- const result = new vscode . TreeItem ( element . word ) ;
269- result . description = ` ${ vscode . workspace . asRelativePath ( element . input . uri ) } • ${ element . input . title . toLocaleLowerCase ( ) } ` ;
270- // result.command = { command: 'references -view.SHOW ', arguments: [element ], title: 'Rerun' };
287+ getTreeItem ( item : HistoryItem ) : vscode . TreeItem {
288+ const result = new vscode . TreeItem ( item . word ) ;
289+ result . description = item . description ;
290+ result . command = { command : '_references -view.showHistoryItem ' , arguments : [ item ] , title : 'Rerun' } ;
271291 result . collapsibleState = vscode . TreeItemCollapsibleState . None ;
272292 result . contextValue = 'history-item' ;
273293 return result ;
0 commit comments