未验证 提交 6bbfedaa 编写于 作者: D Daniel Imms

displayDetectedWslProfiles -> useWslProfiles

Update setting name to remove ambiguity with the 'detected' section in
select default profile
上级 b45ab9da
......@@ -154,7 +154,7 @@ export class TerminalService implements ITerminalService {
if (e.affectsConfiguration('terminal.integrated.profiles.windows') ||
e.affectsConfiguration('terminal.integrated.profiles.osx') ||
e.affectsConfiguration('terminal.integrated.profiles.linux') ||
e.affectsConfiguration('terminal.integrated.displayDetectedWslProfiles')) {
e.affectsConfiguration('terminal.integrated.useWslProfiles')) {
this._updateAvailableProfilesNow();
}
});
......
......@@ -102,7 +102,7 @@ export interface ITerminalConfiguration {
windows: string[];
};
profiles: ITerminalProfiles;
displayDetectedWslProfiles: boolean;
useWslProfiles: boolean;
altClickMovesCursor: boolean;
macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean;
......
......@@ -217,8 +217,8 @@ export const terminalConfiguration: IConfigurationNode = {
]
}
},
'terminal.integrated.displayDetectedWslProfiles': {
description: localize('terminal.integrated.displayDetectedWslProfiles', 'Controls whether or not WSL distros are shown in the terminal dropdown'),
'terminal.integrated.useWslProfiles': {
description: localize('terminal.integrated.useWslProfiles', 'Controls whether or not WSL distros are shown in the terminal dropdown'),
type: 'boolean',
default: true
},
......
......@@ -18,10 +18,10 @@ import * as pfs from 'vs/base/node/pfs';
let profileSources: Map<string, IPotentialTerminalProfile> | undefined;
export function detectAvailableProfiles(configuredProfilesOnly: boolean, logService?: ILogService, config?: ITerminalConfiguration, variableResolver?: ExtHostVariableResolverService, workspaceFolder?: IWorkspaceFolder, statProvider?: IStatProvider, testPaths?: string[]): Promise<ITerminalProfile[]> {
return platform.isWindows ? detectAvailableWindowsProfiles(configuredProfilesOnly, statProvider, logService, config?.displayDetectedWslProfiles, config?.profiles.windows, variableResolver, workspaceFolder) : detectAvailableUnixProfiles(statProvider, logService, configuredProfilesOnly, platform.isMacintosh ? config?.profiles.osx : config?.profiles.linux, testPaths, variableResolver, workspaceFolder);
return platform.isWindows ? detectAvailableWindowsProfiles(configuredProfilesOnly, statProvider, logService, config?.useWslProfiles, config?.profiles.windows, variableResolver, workspaceFolder) : detectAvailableUnixProfiles(statProvider, logService, configuredProfilesOnly, platform.isMacintosh ? config?.profiles.osx : config?.profiles.linux, testPaths, variableResolver, workspaceFolder);
}
async function detectAvailableWindowsProfiles(configuredProfilesOnly: boolean, statProvider?: IStatProvider, logService?: ILogService, displayDetectedWslProfiles?: boolean, configProfiles?: { [key: string]: ITerminalProfileObject }, variableResolver?: ExtHostVariableResolverService, workspaceFolder?: IWorkspaceFolder): Promise<ITerminalProfile[]> {
async function detectAvailableWindowsProfiles(configuredProfilesOnly: boolean, statProvider?: IStatProvider, logService?: ILogService, useWslProfiles?: boolean, configProfiles?: { [key: string]: ITerminalProfileObject }, variableResolver?: ExtHostVariableResolverService, workspaceFolder?: IWorkspaceFolder): Promise<ITerminalProfile[]> {
// Determine the correct System32 path. We want to point to Sysnative
// when the 32-bit version of VS Code is running on a 64-bit machine.
// The reason for this is because PowerShell's important PSReadline
......@@ -63,8 +63,8 @@ async function detectAvailableWindowsProfiles(configuredProfilesOnly: boolean, s
const resultProfiles: ITerminalProfile[] = await transformToTerminalProfiles(detectedProfiles.entries(), logService, statProvider, variableResolver, workspaceFolder);
if (!configuredProfilesOnly || (configuredProfilesOnly && displayDetectedWslProfiles)) {
resultProfiles.push(... await getWslProfiles(`${system32Path}\\${useWSLexe ? 'wsl.exe' : 'bash.exe'}`, displayDetectedWslProfiles));
if (!configuredProfilesOnly || (configuredProfilesOnly && useWslProfiles)) {
resultProfiles.push(... await getWslProfiles(`${system32Path}\\${useWSLexe ? 'wsl.exe' : 'bash.exe'}`, useWslProfiles));
}
return resultProfiles;
......@@ -145,9 +145,9 @@ async function getPowershellProfiles(): Promise<IPotentialTerminalProfile[]> {
return profiles;
}
async function getWslProfiles(wslPath: string, displayDetectedWslProfiles?: boolean): Promise<ITerminalProfile[]> {
async function getWslProfiles(wslPath: string, useWslProfiles?: boolean): Promise<ITerminalProfile[]> {
const profiles: ITerminalProfile[] = [];
if (displayDetectedWslProfiles) {
if (useWslProfiles) {
const distroOutput = await new Promise<string>((resolve, reject) => {
// wsl.exe output is encoded in utf16le (ie. A -> 0x4100)
cp.exec('wsl.exe -l', { encoding: 'utf16le' }, (err, stdout) => {
......
......@@ -23,7 +23,7 @@ suite('Workbench - TerminalProfiles', () => {
linux: {},
osx: {}
},
displayDetectedWslProfiles: false
useWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config as ITerminalConfiguration, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'Git Bash', path: _paths[0], args: ['--login'], isAutoDetected: undefined, overrideName: undefined }];
......@@ -39,7 +39,7 @@ suite('Workbench - TerminalProfiles', () => {
linux: {},
osx: {},
},
displayDetectedWslProfiles: false
useWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config as ITerminalConfiguration, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'Command Prompt', path: _paths[0] }];
......@@ -70,7 +70,7 @@ suite('Workbench - TerminalProfiles', () => {
},
linux: {}
},
displayDetectedWslProfiles: false
useWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config as ITerminalConfiguration, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'bash', path: _paths[0] }, { profileName: 'bash', path: _paths[0] }, { profileName: 'zsh', path: _paths[1] }, { profileName: 'tmux', path: _paths[2] }, { profileName: 'fish', path: _paths[3] }];
......@@ -101,7 +101,7 @@ suite('Workbench - TerminalProfiles', () => {
},
osx: {}
},
displayDetectedWslProfiles: false
useWslProfiles: false
};
const profiles = await detectAvailableProfiles(true, undefined, config as ITerminalConfiguration, undefined, undefined, createStatProvider(_paths));
const expected = [{ profileName: 'bash', path: _paths[0] }, { profileName: 'bash', path: _paths[0] }, { profileName: 'zsh', path: _paths[1] }, { profileName: 'tmux', path: _paths[2] }, { profileName: 'fish', path: _paths[3] }];
......@@ -124,5 +124,5 @@ suite('Workbench - TerminalProfiles', () => {
export interface ITestTerminalConfig {
profiles: ITerminalProfiles;
displayDetectedWslProfiles: boolean
useWslProfiles: boolean
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册