mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
include detected profiles in getProfiles, use configured icon (#138628)
This commit is contained in:
parent
7a1a06a0fc
commit
212a8ca457
|
@ -172,7 +172,7 @@ async function transformToTerminalProfiles(
|
|||
} else {
|
||||
originalPaths = Array.isArray(profile.path) ? profile.path : [profile.path];
|
||||
args = isWindows ? profile.args : Array.isArray(profile.args) ? profile.args : undefined;
|
||||
icon = validateIcon(profile.icon) || undefined;
|
||||
icon = validateIcon(profile.icon);
|
||||
}
|
||||
|
||||
const paths = (await variableResolver?.(originalPaths)) || originalPaths.slice();
|
||||
|
@ -267,7 +267,8 @@ async function getWslProfiles(wslPath: string, defaultProfileName: string | unde
|
|||
path: wslPath,
|
||||
args: [`-d`, `${distroName}`],
|
||||
isDefault: profileName === defaultProfileName,
|
||||
icon: getWslIcon(distroName)
|
||||
icon: getWslIcon(distroName),
|
||||
isAutoDetected: true
|
||||
};
|
||||
// Add the profile
|
||||
profiles.push(profile);
|
||||
|
@ -327,6 +328,7 @@ function applyConfigProfilesToMap(configProfiles: { [key: string]: IUnresolvedTe
|
|||
if (value === null || (!('path' in value) && !('source' in value))) {
|
||||
profilesMap.delete(profileName);
|
||||
} else {
|
||||
value.icon = value.icon || profilesMap.get(profileName)?.icon;
|
||||
profilesMap.set(profileName, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -709,7 +709,7 @@ export function getTerminalActionBarArgs(location: ITerminalLocationOptions, pro
|
|||
} {
|
||||
let dropdownActions: IAction[] = [];
|
||||
let submenuActions: IAction[] = [];
|
||||
|
||||
profiles = profiles.filter(e => !e.isAutoDetected);
|
||||
const splitLocation = (location === TerminalLocation.Editor || (typeof location === 'object' && 'viewColumn' in location && location.viewColumn === ACTIVE_GROUP)) ? { viewColumn: SIDE_GROUP } : { splitActiveTerminal: true };
|
||||
for (const p of profiles) {
|
||||
const isDefault = p.profileName === defaultProfileName;
|
||||
|
|
|
@ -28,7 +28,6 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
|
|||
* and keeps the available terminal profiles updated
|
||||
*/
|
||||
export class TerminalProfileService implements ITerminalProfileService {
|
||||
private _ifNoProfilesTryAgain: boolean = true;
|
||||
private _webExtensionContributedProfileContextKey: IContextKey<boolean>;
|
||||
private _profilesReadyBarrier: AutoOpenBarrier;
|
||||
private _availableProfiles: ITerminalProfile[] | undefined;
|
||||
|
@ -104,17 +103,7 @@ export class TerminalProfileService implements ITerminalProfileService {
|
|||
}
|
||||
|
||||
protected async _refreshAvailableProfilesNow(): Promise<void> {
|
||||
const profiles = await this._detectProfiles();
|
||||
if (profiles.length === 0 && this._ifNoProfilesTryAgain) {
|
||||
// available profiles get updated when a terminal is created
|
||||
// or relevant config changes.
|
||||
// if there are no profiles, we want to refresh them again
|
||||
// since terminal creation can't happen in this case and users
|
||||
// might not think to try changing the config
|
||||
this._ifNoProfilesTryAgain = false;
|
||||
await this._refreshAvailableProfilesNow();
|
||||
return;
|
||||
}
|
||||
const profiles = await this._detectProfiles(true);
|
||||
const profilesChanged = !(equals(profiles, this._availableProfiles, profilesEqual));
|
||||
const contributedProfilesChanged = await this._updateContributedProfiles();
|
||||
if (profilesChanged || contributedProfilesChanged) {
|
||||
|
|
|
@ -318,17 +318,6 @@ suite('TerminalProfileService', () => {
|
|||
deepStrictEqual(terminalProfileService.availableProfiles, [powershellProfile]);
|
||||
deepStrictEqual(terminalProfileService.contributedProfiles, [jsdebugProfile]);
|
||||
});
|
||||
test('should call refreshAvailableProfiles again if no profiles are returned from local/remoteTerminalService', async () => {
|
||||
terminalInstanceService.setReturnNone();
|
||||
const calls: ITerminalProfile[][] = [];
|
||||
terminalProfileService.onDidChangeAvailableProfiles(e => calls.push(e));
|
||||
await terminalProfileService.hasRefreshedProfiles;
|
||||
deepStrictEqual(calls, [
|
||||
[powershellProfile]
|
||||
]);
|
||||
deepStrictEqual(terminalProfileService.availableProfiles, [powershellProfile]);
|
||||
deepStrictEqual(terminalProfileService.contributedProfiles, [jsdebugProfile]);
|
||||
});
|
||||
suite('Profiles Quickpick', () => {
|
||||
let quickInputService: MockQuickInputService;
|
||||
let mockTerminalProfileService: MockTerminalProfileService;
|
||||
|
|
Loading…
Reference in a new issue