@@ -19,9 +19,8 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
1919import { debounce } from 'vs/base/common/decorators' ;
2020import { ThemeIcon } from 'vs/base/common/themables' ;
2121import { URI } from 'vs/base/common/uri' ;
22- import { equals } from 'vs/base/common/arrays' ;
2322import { deepClone } from 'vs/base/common/objects' ;
24- import { terminalProfileArgsMatch , isUriComponents } from 'vs/platform/terminal/common/terminalProfiles' ;
23+ import { isUriComponents } from 'vs/platform/terminal/common/terminalProfiles' ;
2524import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal' ;
2625
2726export interface IProfileContextProvider {
@@ -345,48 +344,6 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
345344 }
346345 }
347346
348- private _isValidShellArgs ( shellArgs : unknown , os : OperatingSystem ) : shellArgs is string | string [ ] | undefined {
349- if ( shellArgs === undefined ) {
350- return true ;
351- }
352- if ( os === OperatingSystem . Windows && typeof shellArgs === 'string' ) {
353- return true ;
354- }
355- if ( Array . isArray ( shellArgs ) && shellArgs . every ( e => typeof e === 'string' ) ) {
356- return true ;
357- }
358- return false ;
359- }
360-
361- async createProfileFromShellAndShellArgs ( shell ?: unknown , shellArgs ?: unknown ) : Promise < ITerminalProfile | string > {
362- const detectedProfile = this . _terminalProfileService . availableProfiles ?. find ( p => {
363- if ( p . path !== shell ) {
364- return false ;
365- }
366- if ( p . args === undefined || typeof p . args === 'string' ) {
367- return p . args === shellArgs ;
368- }
369- return p . path === shell && equals ( p . args , ( shellArgs || [ ] ) as string [ ] ) ;
370- } ) ;
371- const fallbackProfile = ( await this . getDefaultProfile ( {
372- remoteAuthority : this . _remoteAgentService . getConnection ( ) ?. remoteAuthority ,
373- os : this . _primaryBackendOs !
374- } ) ) ;
375- fallbackProfile . profileName = `${ fallbackProfile . path } (migrated)` ;
376- const profile = detectedProfile || fallbackProfile ;
377- const args = this . _isValidShellArgs ( shellArgs , this . _primaryBackendOs ! ) ? shellArgs : profile . args ;
378- const createdProfile = {
379- profileName : profile . profileName ,
380- path : profile . path ,
381- args,
382- isDefault : true
383- } ;
384- if ( detectedProfile && detectedProfile . profileName === createdProfile . profileName && detectedProfile . path === createdProfile . path && terminalProfileArgsMatch ( detectedProfile . args , createdProfile . args ) ) {
385- return detectedProfile . profileName ;
386- }
387- return createdProfile ;
388- }
389-
390347 private _isValidAutomationProfile ( profile : unknown , os : OperatingSystem ) : profile is ITerminalProfile {
391348 if ( profile === null || profile === undefined || typeof profile !== 'object' ) {
392349 return false ;
0 commit comments