mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-06 02:44:33 +01:00
1 parent
510b49e1da
commit
d0c2b01b60
3 files changed
+22
-13
No files matched your search
@@ -48,7 +48,7 @@ export class PtyHostService extends Disposable implements IPtyService {
|
||||
private _restartCount = 0;
|
||||
private _isResponsive = true;
|
||||
private _isDisposed = false;
|
||||
|
||||
private _logIfWslNotInstalled = true;
|
||||
private _heartbeatFirstTimeout?: NodeJS.Timeout;
|
||||
private _heartbeatSecondTimeout?: NodeJS.Timeout;
|
||||
|
||||
@@ -269,7 +269,11 @@ export class PtyHostService extends Disposable implements IPtyService {
|
||||
}
|
||||
async getProfiles(workspaceId: string, profiles: unknown, defaultProfile: unknown, includeDetectedProfiles: boolean = false): Promise<ITerminalProfile[]> {
|
||||
const shellEnv = await this._shellEnv;
|
||||
return detectAvailableProfiles(profiles, defaultProfile, includeDetectedProfiles, this._configurationService, shellEnv, undefined, this._logService, this._resolveVariables.bind(this, workspaceId));
|
||||
const shouldLog = this._logIfWslNotInstalled;
|
||||
if (shouldLog) {
|
||||
this._logIfWslNotInstalled = false;
|
||||
}
|
||||
return detectAvailableProfiles(profiles, defaultProfile, includeDetectedProfiles, shouldLog, this._configurationService, shellEnv, undefined, this._logService, this._resolveVariables.bind(this, workspaceId));
|
||||
}
|
||||
getEnvironment(): Promise<IProcessEnvironment> {
|
||||
return this._proxy.getEnvironment();
|
||||
|
||||
@@ -22,12 +22,13 @@ export function detectAvailableProfiles(
|
||||
profiles: unknown,
|
||||
defaultProfile: unknown,
|
||||
includeDetectedProfiles: boolean,
|
||||
logIfWslNotInstalled: boolean,
|
||||
configurationService: IConfigurationService,
|
||||
shellEnv: typeof process.env = process.env,
|
||||
fsProvider?: IFsProvider,
|
||||
logService?: ILogService,
|
||||
variableResolver?: (text: string[]) => Promise<string[]>,
|
||||
testPwshSourcePaths?: string[],
|
||||
testPwshSourcePaths?: string[]
|
||||
): Promise<ITerminalProfile[]> {
|
||||
fsProvider = fsProvider || {
|
||||
existsFile: pfs.SymlinkSupport.existsFile,
|
||||
@@ -36,6 +37,7 @@ export function detectAvailableProfiles(
|
||||
if (isWindows) {
|
||||
return detectAvailableWindowsProfiles(
|
||||
includeDetectedProfiles,
|
||||
logIfWslNotInstalled,
|
||||
fsProvider,
|
||||
shellEnv,
|
||||
logService,
|
||||
@@ -60,6 +62,7 @@ export function detectAvailableProfiles(
|
||||
|
||||
async function detectAvailableWindowsProfiles(
|
||||
includeDetectedProfiles: boolean,
|
||||
logIfWslNotInstalled: boolean,
|
||||
fsProvider: IFsProvider,
|
||||
shellEnv: typeof process.env,
|
||||
logService?: ILogService,
|
||||
@@ -130,7 +133,9 @@ async function detectAvailableWindowsProfiles(
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logService?.info('WSL is not installed, so could not detect WSL profiles');
|
||||
if (logIfWslNotInstalled) {
|
||||
logService?.info('WSL is not installed, so could not detect WSL profiles');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
useWslProfiles: false
|
||||
};
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const expected = [
|
||||
{ profileName: 'Git Bash', path: 'C:\\Program Files\\Git\\bin\\bash.exe', args: ['--login'], isDefault: true }
|
||||
];
|
||||
@@ -67,7 +67,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
useWslProfiles: false
|
||||
};
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', overrideName: true, args: ['-NoProfile'], isDefault: true }
|
||||
];
|
||||
@@ -88,7 +88,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
useWslProfiles: false
|
||||
};
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const expected = [{ profileName: 'Git Bash', path: 'C:\\Program Files\\Git\\bin\\bash.exe', args: [], isAutoDetected: undefined, overrideName: undefined, isDefault: true }];
|
||||
profilesEqual(profiles, expected);
|
||||
});
|
||||
@@ -112,7 +112,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
];
|
||||
const fsProvider = createFsProvider(pwshSourcePaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', isDefault: true }
|
||||
];
|
||||
@@ -127,7 +127,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
];
|
||||
const fsProvider = createFsProvider(pwshSourcePaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', isDefault: true }
|
||||
];
|
||||
@@ -140,7 +140,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
];
|
||||
const fsProvider = createFsProvider(pwshSourcePaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, pwshSourcePaths);
|
||||
strictEqual(profiles.length, 1);
|
||||
strictEqual(profiles[0].profileName, 'PowerShell');
|
||||
});
|
||||
@@ -185,7 +185,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
'/bin/fakeshell3'
|
||||
]);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: absoluteConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, false, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: '/bin/fakeshell1', isDefault: true },
|
||||
{ profileName: 'fakeshell3', path: '/bin/fakeshell3', isDefault: true }
|
||||
@@ -198,7 +198,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
'/bin/fakeshell3'
|
||||
], '/bin/fakeshell1\n/bin/fakeshell3');
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: onPathConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, true, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: 'fakeshell1', isDefault: true },
|
||||
{ profileName: 'fakeshell3', path: 'fakeshell3', isDefault: true }
|
||||
@@ -211,7 +211,7 @@ suite('Workbench - TerminalProfiles', () => {
|
||||
'/bin/fakeshell1'
|
||||
], '/bin/fakeshell1\n/bin/fakeshell3');
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: onPathConfig } });
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const profiles = await detectAvailableProfiles(undefined, undefined, true, true, configurationService, process.env, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: 'fakeshell1', isDefault: true }
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user