11import * as fsapi from 'fs-extra' ;
22import * as path from 'path' ;
3- import { Disposable , EventEmitter , ProgressLocation , Terminal , TerminalOptions , Uri } from 'vscode' ;
3+ import { Disposable , EventEmitter , ProgressLocation , Terminal , Uri } from 'vscode' ;
44import { PythonEnvironment , PythonEnvironmentApi , PythonProject , PythonTerminalCreateOptions } from '../../api' ;
55import { ActivationStrings } from '../../common/localize' ;
66import { traceInfo , traceVerbose } from '../../common/logging' ;
@@ -34,6 +34,7 @@ import {
3434 getAutoActivationType ,
3535 getEnvironmentForTerminal ,
3636 shouldActivateInCurrentTerminal ,
37+ shouldSkipTerminalActivation ,
3738 waitForShellIntegration ,
3839} from './utils' ;
3940
@@ -94,7 +95,7 @@ export class TerminalManagerImpl implements TerminalManager {
9495 this . onTerminalClosedEmitter . fire ( t ) ;
9596 } ) ,
9697 this . onTerminalOpened ( async ( t ) => {
97- if ( this . skipActivationOnOpen . has ( t ) || ( t . creationOptions as TerminalOptions ) ?. hideFromUser ) {
98+ if ( this . skipActivationOnOpen . has ( t ) || shouldSkipTerminalActivation ( t ) ) {
9899 return ;
99100 }
100101 let env = this . ta . getEnvironment ( t ) ;
@@ -419,7 +420,11 @@ export class TerminalManagerImpl implements TerminalManager {
419420
420421 if ( actType === ACT_TYPE_COMMAND ) {
421422 if ( ! skipPreExistingTerminals ) {
422- await Promise . all ( terminals ( ) . map ( async ( t ) => this . activateUsingCommand ( api , t ) ) ) ;
423+ await Promise . all (
424+ terminals ( )
425+ . filter ( ( t ) => ! shouldSkipTerminalActivation ( t ) )
426+ . map ( async ( t ) => this . activateUsingCommand ( api , t ) ) ,
427+ ) ;
423428 }
424429 } else if ( actType === ACT_TYPE_SHELL ) {
425430 const shells = new Set (
@@ -431,12 +436,14 @@ export class TerminalManagerImpl implements TerminalManager {
431436 await this . handleSetupCheck ( shells ) ;
432437 if ( ! skipPreExistingTerminals ) {
433438 await Promise . all (
434- terminals ( ) . map ( async ( t ) => {
435- // If the shell is not set up, we activate using command fallback.
436- if ( this . shellSetup . get ( identifyTerminalShell ( t ) ) === false ) {
437- await this . activateUsingCommand ( api , t ) ;
438- }
439- } ) ,
439+ terminals ( )
440+ . filter ( ( t ) => ! shouldSkipTerminalActivation ( t ) )
441+ . map ( async ( t ) => {
442+ // If the shell is not set up, we activate using command fallback.
443+ if ( this . shellSetup . get ( identifyTerminalShell ( t ) ) === false ) {
444+ await this . activateUsingCommand ( api , t ) ;
445+ }
446+ } ) ,
440447 ) ;
441448 }
442449 }
0 commit comments