File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,6 @@ function activate(
79
79
label : trans . __ ( 'Contact Kernel and Execute Code' ) ,
80
80
caption : trans . __ ( 'Contact Kernel and Execute Code' ) ,
81
81
execute : async ( ) => {
82
- // Create the panel if it does not exist
83
- if ( ! panel ) {
84
- await createPanel ( ) ;
85
- }
86
82
// Prompt the user about the statement to be executed
87
83
const input = await InputDialog . getText ( {
88
84
title : trans . __ ( 'Code to execute' ) ,
@@ -92,7 +88,16 @@ function activate(
92
88
// Execute the statement
93
89
if ( input . button . accept ) {
94
90
const code = input . value || '' ;
95
- panel . execute ( code ) ;
91
+ if ( ! panel ) {
92
+ // Create the panel if it does not exist
93
+ createPanel ( )
94
+ . then ( async ( panel ) => {
95
+ await panel . session . ready ;
96
+ panel . execute ( code ) ;
97
+ } ) ;
98
+ } else {
99
+ panel . execute ( code ) ;
100
+ }
96
101
}
97
102
}
98
103
} ) ;
You can’t perform that action at this time.
0 commit comments