@@ -174,7 +174,11 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
174
174
this . onDidFocusSession ( this . debugService . getViewModel ( ) . focusedSession ) ;
175
175
}
176
176
177
- this . _register ( this . debugService . getViewModel ( ) . onDidFocusSession ( async session => this . onDidFocusSession ( session ) ) ) ;
177
+ this . _register ( this . debugService . getViewModel ( ) . onDidFocusSession ( session => {
178
+ if ( this . isVisible ( ) ) {
179
+ this . onDidFocusSession ( session ) ;
180
+ }
181
+ } ) ) ;
178
182
this . _register ( this . debugService . getViewModel ( ) . onDidEvaluateLazyExpression ( async e => {
179
183
if ( e instanceof Variable && this . tree ?. hasNode ( e ) ) {
180
184
await this . tree . updateChildren ( e , false , true ) ;
@@ -201,19 +205,27 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
201
205
}
202
206
} ) ) ;
203
207
this . _register ( this . onDidChangeBodyVisibility ( visible => {
204
- if ( visible ) {
205
- if ( ! this . model ) {
206
- this . model = this . modelService . getModel ( Repl . URI ) || this . modelService . createModel ( '' , null , Repl . URI , true ) ;
207
- }
208
- this . setMode ( ) ;
209
- this . replInput . setModel ( this . model ) ;
210
- this . updateInputDecoration ( ) ;
211
- this . refreshReplElements ( true ) ;
212
- if ( this . styleChangedWhenInvisible ) {
213
- this . styleChangedWhenInvisible = false ;
214
- this . tree ?. updateChildren ( undefined , true , false ) ;
215
- this . onDidStyleChange ( ) ;
216
- }
208
+ if ( ! visible ) {
209
+ return ;
210
+ }
211
+ if ( ! this . model ) {
212
+ this . model = this . modelService . getModel ( Repl . URI ) || this . modelService . createModel ( '' , null , Repl . URI , true ) ;
213
+ }
214
+
215
+ const focusedSession = this . debugService . getViewModel ( ) . focusedSession ;
216
+ if ( this . tree && this . tree . getInput ( ) !== focusedSession ) {
217
+ this . onDidFocusSession ( focusedSession ) ;
218
+ }
219
+
220
+ this . setMode ( ) ;
221
+ this . replInput . setModel ( this . model ) ;
222
+ this . updateInputDecoration ( ) ;
223
+ this . refreshReplElements ( true ) ;
224
+
225
+ if ( this . styleChangedWhenInvisible ) {
226
+ this . styleChangedWhenInvisible = false ;
227
+ this . tree ?. updateChildren ( undefined , true , false ) ;
228
+ this . onDidStyleChange ( ) ;
217
229
}
218
230
} ) ) ;
219
231
this . _register ( this . configurationService . onDidChangeConfiguration ( e => {
0 commit comments