File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 300300              "default" : true ,
301301              "description" : " Check if there is a newer version of Task on startup." 
302302            },
303+             "doubleClickToRun" : {
304+               "type" : " number"  ,
305+               "default" : 500 ,
306+               "description" : " The double-click timeout for a task in the tree view. To disable double-click to run, set this to 0." 
307+             },
303308            "tree" : {
304309              "type" : " object"  ,
305310              "description" : " Tree view configuration options."  ,
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ class TaskfileService {
4040    private  lastTaskDir : string  |  undefined ; 
4141    private  lastTaskCliArgs : string  |  undefined ; 
4242    private  version : semver . SemVer  |  undefined ; 
43+ 	private  previousSelection : string  |  undefined ; 
44+ 	private  previousSelectionTimestamp : number  |  undefined ; 
4345
4446    private  constructor ( )  { 
4547        TaskfileService . outputChannel  =  vscode . window . createOutputChannel ( 'Task' ) ; 
@@ -291,6 +293,16 @@ class TaskfileService {
291293    } 
292294
293295    public  async  goToDefinition ( task : Task ,  preview : boolean  =  false ) : Promise < void >  { 
296+ 		const  currentTime  =  Date . now ( ) ; 
297+ 		const  doubleClicked  =  this . previousSelection  !==  undefined  &&  this . previousSelectionTimestamp  !==  undefined 
298+ 			&&  this . previousSelection  ===  task . name 
299+ 			&&  ( currentTime  -  this . previousSelectionTimestamp )  <  settings . doubleClickToRun ; 
300+         if  ( doubleClicked )  { 
301+             this . previousSelection  =  undefined ; 
302+             this . previousSelectionTimestamp  =  undefined ; 
303+             return  this . runTask ( task . name ) ; 
304+         } 
305+ 
294306        log . info ( `Navigating to "${ task . name }  " definition in: "${ task . location . taskfile }  "` ) ; 
295307
296308        let  position  =  new  vscode . Position ( task . location . line  -  1 ,  task . location . column  -  1 ) ; 
@@ -311,6 +323,9 @@ class TaskfileService {
311323        }  catch  ( err )  { 
312324            log . error ( err ) ; 
313325        } 
326+ 
327+         this . previousSelection  =  task . name ; 
328+         this . previousSelectionTimestamp  =  currentTime ; 
314329    } 
315330} 
316331
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class Settings {
77    public  path ! : string ; 
88    public  outputTo ! : OutputTo ; 
99    public  checkForUpdates ! : boolean ; 
10+     public  doubleClickToRun ! : number ; 
1011    public  tree ! : TreeSettings ; 
1112    public  terminal ! : TerminalSettings ; 
1213
@@ -30,6 +31,7 @@ class Settings {
3031        this . path  =  config . get ( "path" )  ??  "task" ; 
3132        this . outputTo  =  config . get ( "outputTo" )  ??  OutputTo . output ; 
3233        this . checkForUpdates  =  config . get ( "checkForUpdates" )  ??  true ; 
34+         this . doubleClickToRun  =  config . get ( "doubleClickToRun" )  ??  500 ; 
3335        this . tree  =  new  TreeSettings ( ) ; 
3436        this . terminal  =  new  TerminalSettings ( ) ; 
3537    } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments