Terminal profiles (#118790)

* get basics working in current dropdown

* filter profiles based on what we want in the dropdown and other info

* add copywright

* terminal.ts -> terminalProfile.ts

* seperate linux distro code

* improve terminalConfig setting description

* add passing tests and fix #79572

* add test for login args

* add wsl stuff

* fix #77652

* lengthen throttle time to 10s

* shell -> process and fire update profiles so dropdown is updated

* consolidate code in terminalProfile

* change profile selection logic

* change profile config structure

* use <ProfileName, IterminalProfileObject> and get wsl distro names to look normal

* provide terminalConfig to terminalProfiles

* move detection/validation to terminalProfiles

* isWorkspaceShellAllowed

* add quickPickOnly so Select Default Profiles returns all and otherwise filters based on config

* Add logs for errors within terminalProfiles

* change return type

* use sync

* fix bug, get custom generated to work

* workspace shell permissions

* add some comments and clean up

* when ext host ready update profiles

* improve terminalProfileObjectEqual check

* don't use windows powershell unless no other powershell
This commit is contained in:
Megan Rogge
2021-03-16 19:02:59 -05:00
committed by GitHub
parent e5fc49d8af
commit e8e6d64105
15 changed files with 628 additions and 181 deletions

View File

@@ -9,15 +9,16 @@ import { generateUuid } from 'vs/base/common/uuid';
import { getSystemShell, getSystemShellSync } from 'vs/base/node/shell';
import { ILogService } from 'vs/platform/log/common/log';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IShellAndArgsDto, IShellDefinitionDto } from 'vs/workbench/api/common/extHost.protocol';
import { IShellAndArgsDto } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostConfigProvider, ExtHostConfiguration, IExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration';
import { ExtHostVariableResolverService } from 'vs/workbench/api/common/extHostDebugService';
import { ExtHostDocumentsAndEditors, IExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { BaseExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/common/extHostTerminalService';
import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
import { ITerminalConfiguration, ITerminalProfile } from 'vs/workbench/contrib/terminal/common/terminal';
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
import { detectAvailableShells } from 'vs/workbench/contrib/terminal/node/terminal';
import { detectAvailableProfiles } from 'vs/workbench/contrib/terminal/node/terminalProfiles';
import type * as vscode from 'vscode';
export class ExtHostTerminalService extends BaseExtHostTerminalService {
@@ -131,8 +132,9 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders || [], this._extHostDocumentsAndEditors, configProvider);
}
public $getAvailableShells(): Promise<IShellDefinitionDto[]> {
return detectAvailableShells();
public async $getAvailableProfiles(quickLaunchOnly: boolean): Promise<ITerminalProfile[]> {
const config = await (await this._extHostConfiguration.getConfigProvider()).getConfiguration().get('terminal.integrated');
return detectAvailableProfiles(quickLaunchOnly, this._logService, config as ITerminalConfiguration, this._variableResolver, this._lastActiveWorkspace);
}
public async $getDefaultShellAndArgs(useAutomationShell: boolean): Promise<IShellAndArgsDto> {