@@ -36,31 +36,25 @@ export class CodeExecutionManager implements ICodeExecutionManager {
36
36
}
37
37
38
38
public registerCommands ( ) {
39
- [ Commands . Exec_In_Terminal , Commands . Exec_In_Terminal_Icon , Commands . Exec_In_Separate_Terminal ] . forEach (
40
- ( cmd ) => {
41
- this . disposableRegistry . push (
42
- this . commandManager . registerCommand ( cmd as any , async ( file : Resource ) => {
43
- const interpreterService = this . serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
44
- const interpreter = await interpreterService . getActiveInterpreter ( file ) ;
45
- if ( ! interpreter ) {
46
- this . commandManager
47
- . executeCommand ( Commands . TriggerEnvironmentSelection , file )
48
- . then ( noop , noop ) ;
49
- return ;
50
- }
51
- const trigger = cmd === Commands . Exec_In_Terminal ? 'command' : 'icon' ;
52
- await this . executeFileInTerminal ( file , trigger , {
53
- newTerminalPerFile : cmd === Commands . Exec_In_Separate_Terminal ,
39
+ [ Commands . Exec_In_Terminal , Commands . Exec_In_Terminal_Icon ] . forEach ( ( cmd ) => {
40
+ this . disposableRegistry . push (
41
+ this . commandManager . registerCommand ( cmd as any , async ( file : Resource ) => {
42
+ const interpreterService = this . serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
43
+ const interpreter = await interpreterService . getActiveInterpreter ( file ) ;
44
+ if ( ! interpreter ) {
45
+ this . commandManager . executeCommand ( Commands . TriggerEnvironmentSelection , file ) . then ( noop , noop ) ;
46
+ return ;
47
+ }
48
+ const trigger = cmd === Commands . Exec_In_Terminal ? 'command' : 'icon' ;
49
+ await this . executeFileInTerminal ( file , trigger )
50
+ . then ( ( ) => {
51
+ if ( this . shouldTerminalFocusOnStart ( file ) )
52
+ this . commandManager . executeCommand ( 'workbench.action.terminal.focus' ) ;
54
53
} )
55
- . then ( ( ) => {
56
- if ( this . shouldTerminalFocusOnStart ( file ) )
57
- this . commandManager . executeCommand ( 'workbench.action.terminal.focus' ) ;
58
- } )
59
- . catch ( ( ex ) => traceError ( 'Failed to execute file in terminal' , ex ) ) ;
60
- } ) ,
61
- ) ;
62
- } ,
63
- ) ;
54
+ . catch ( ( ex ) => traceError ( 'Failed to execute file in terminal' , ex ) ) ;
55
+ } ) ,
56
+ ) ;
57
+ } ) ;
64
58
this . disposableRegistry . push (
65
59
this . commandManager . registerCommand ( Commands . Exec_Selection_In_Terminal as any , async ( file : Resource ) => {
66
60
const interpreterService = this . serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
@@ -93,16 +87,8 @@ export class CodeExecutionManager implements ICodeExecutionManager {
93
87
) ,
94
88
) ;
95
89
}
96
- private async executeFileInTerminal (
97
- file : Resource ,
98
- trigger : 'command' | 'icon' ,
99
- options ?: { newTerminalPerFile : boolean } ,
100
- ) : Promise < void > {
101
- sendTelemetryEvent ( EventName . EXECUTION_CODE , undefined , {
102
- scope : 'file' ,
103
- trigger,
104
- newTerminalPerFile : options ?. newTerminalPerFile ,
105
- } ) ;
90
+ private async executeFileInTerminal ( file : Resource , trigger : 'command' | 'icon' ) {
91
+ sendTelemetryEvent ( EventName . EXECUTION_CODE , undefined , { scope : 'file' , trigger } ) ;
106
92
const codeExecutionHelper = this . serviceContainer . get < ICodeExecutionHelper > ( ICodeExecutionHelper ) ;
107
93
file = file instanceof Uri ? file : undefined ;
108
94
let fileToExecute = file ? file : await codeExecutionHelper . getFileToExecute ( ) ;
@@ -124,7 +110,7 @@ export class CodeExecutionManager implements ICodeExecutionManager {
124
110
}
125
111
126
112
const executionService = this . serviceContainer . get < ICodeExecutionService > ( ICodeExecutionService , 'standard' ) ;
127
- await executionService . executeFile ( fileToExecute , options ) ;
113
+ await executionService . executeFile ( fileToExecute ) ;
128
114
}
129
115
130
116
@captureTelemetry ( EventName . EXECUTION_CODE , { scope : 'selection' } , false )
0 commit comments