提交 9d8d0841 编写于 作者: A Andre Weinand

properly use default terminal for debug; fixes #77110

上级 3b5ee24c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import { DisposableStore } from 'vs/base/common/lifecycle'; import { DisposableStore } from 'vs/base/common/lifecycle';
import { URI as uri } from 'vs/base/common/uri'; import { URI as uri } from 'vs/base/common/uri';
import { IDebugService, IConfig, IDebugConfigurationProvider, IBreakpoint, IFunctionBreakpoint, IBreakpointData, ITerminalSettings, IDebugAdapter, IDebugAdapterDescriptorFactory, IDebugSession, IDebugAdapterFactory } from 'vs/workbench/contrib/debug/common/debug'; import { IDebugService, IConfig, IDebugConfigurationProvider, IBreakpoint, IFunctionBreakpoint, IBreakpointData, IDebugAdapter, IDebugAdapterDescriptorFactory, IDebugSession, IDebugAdapterFactory } from 'vs/workbench/contrib/debug/common/debug';
import { import {
ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, DebugSessionUUID, MainContext, ExtHostContext, ExtHostDebugServiceShape, MainThreadDebugServiceShape, DebugSessionUUID, MainContext,
IExtHostContext, IBreakpointsDeltaDto, ISourceMultiBreakpointDto, ISourceBreakpointDto, IFunctionBreakpointDto, IDebugSessionDto IExtHostContext, IBreakpointsDeltaDto, ISourceMultiBreakpointDto, ISourceBreakpointDto, IFunctionBreakpointDto, IDebugSessionDto
...@@ -71,8 +71,8 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb ...@@ -71,8 +71,8 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
return Promise.resolve(this._proxy.$substituteVariables(folder ? folder.uri : undefined, config)); return Promise.resolve(this._proxy.$substituteVariables(folder ? folder.uri : undefined, config));
} }
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> { runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
return Promise.resolve(this._proxy.$runInTerminal(args, config)); return Promise.resolve(this._proxy.$runInTerminal(args));
} }
// RPC methods (MainThreadDebugServiceShape) // RPC methods (MainThreadDebugServiceShape)
......
...@@ -40,7 +40,7 @@ import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor'; ...@@ -40,7 +40,7 @@ import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
import * as tasks from 'vs/workbench/api/common/shared/tasks'; import * as tasks from 'vs/workbench/api/common/shared/tasks';
import { IRevealOptions, ITreeItem } from 'vs/workbench/common/views'; import { IRevealOptions, ITreeItem } from 'vs/workbench/common/views';
import * as callHierarchy from 'vs/workbench/contrib/callHierarchy/common/callHierarchy'; import * as callHierarchy from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { IAdapterDescriptor, IConfig, ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug'; import { IAdapterDescriptor, IConfig } from 'vs/workbench/contrib/debug/common/debug';
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder'; import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
import { ITerminalDimensions, IShellLaunchConfig } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalDimensions, IShellLaunchConfig } from 'vs/workbench/contrib/terminal/common/terminal';
import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions'; import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions';
...@@ -1245,7 +1245,7 @@ export type IDebugSessionDto = IDebugSessionFullDto | DebugSessionUUID; ...@@ -1245,7 +1245,7 @@ export type IDebugSessionDto = IDebugSessionFullDto | DebugSessionUUID;
export interface ExtHostDebugServiceShape { export interface ExtHostDebugServiceShape {
$substituteVariables(folder: UriComponents | undefined, config: IConfig): Promise<IConfig>; $substituteVariables(folder: UriComponents | undefined, config: IConfig): Promise<IConfig>;
$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined>; $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined>;
$startDASession(handle: number, session: IDebugSessionDto): Promise<void>; $startDASession(handle: number, session: IDebugSessionDto): Promise<void>;
$stopDASession(handle: number): Promise<void>; $stopDASession(handle: number): Promise<void>;
$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void; $sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
......
...@@ -20,7 +20,7 @@ import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstract ...@@ -20,7 +20,7 @@ import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstract
import { IExtHostWorkspaceProvider } from 'vs/workbench/api/common/extHostWorkspace'; import { IExtHostWorkspaceProvider } from 'vs/workbench/api/common/extHostWorkspace';
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService'; import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors'; import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { ITerminalSettings, IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor } from 'vs/workbench/contrib/debug/common/debug'; import { IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor } from 'vs/workbench/contrib/debug/common/debug';
import { hasChildProcesses, prepareCommand, runInExternalTerminal } from 'vs/workbench/contrib/debug/node/terminals'; import { hasChildProcesses, prepareCommand, runInExternalTerminal } from 'vs/workbench/contrib/debug/node/terminals';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver'; import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
...@@ -318,7 +318,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -318,7 +318,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
// RPC methods (ExtHostDebugServiceShape) // RPC methods (ExtHostDebugServiceShape)
public $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> { public async $runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
if (args.kind === 'integrated') { if (args.kind === 'integrated') {
...@@ -350,9 +350,12 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -350,9 +350,12 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
terminal.show(); terminal.show();
return this._integratedTerminalInstance.processId.then(shellProcessId => { return this._integratedTerminalInstance.processId.then(async shellProcessId => {
const configProvider = await this._configurationService.getConfigProvider();
const shell = this._terminalService.getDefaultShell(configProvider);
const command = prepareCommand(args, shell, configProvider);
const command = prepareCommand(args, config);
terminal.sendText(command, true); terminal.sendText(command, true);
return shellProcessId; return shellProcessId;
...@@ -361,7 +364,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -361,7 +364,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
} else if (args.kind === 'external') { } else if (args.kind === 'external') {
runInExternalTerminal(args, config); runInExternalTerminal(args, await this._configurationService.getConfigProvider());
} }
return Promise.resolve(undefined); return Promise.resolve(undefined);
} }
......
...@@ -21,7 +21,7 @@ import { IFileService } from 'vs/platform/files/common/files'; ...@@ -21,7 +21,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ICommandService } from 'vs/platform/commands/common/commands'; import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, ITerminalSettings, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IDebugService } from 'vs/workbench/contrib/debug/common/debug'; import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory, IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { Debugger } from 'vs/workbench/contrib/debug/common/debugger'; import { Debugger } from 'vs/workbench/contrib/debug/common/debugger';
import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
...@@ -108,10 +108,10 @@ export class ConfigurationManager implements IConfigurationManager { ...@@ -108,10 +108,10 @@ export class ConfigurationManager implements IConfigurationManager {
return Promise.resolve(config); return Promise.resolve(config);
} }
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> { runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
let tl = this.debugAdapterFactories.get(debugType); let tl = this.debugAdapterFactories.get(debugType);
if (tl) { if (tl) {
return tl.runInTerminal(args, config); return tl.runInTerminal(args);
} }
return Promise.resolve(void 0); return Promise.resolve(void 0);
} }
......
...@@ -24,9 +24,7 @@ import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExte ...@@ -24,9 +24,7 @@ import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExte
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks'; import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { ITerminalConfiguration } from 'vs/workbench/contrib/terminal/common/terminal';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IExternalTerminalSettings } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
export const VIEWLET_ID = 'workbench.view.debug'; export const VIEWLET_ID = 'workbench.view.debug';
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID); export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID);
...@@ -573,12 +571,7 @@ export interface IDebugAdapterTrackerFactory { ...@@ -573,12 +571,7 @@ export interface IDebugAdapterTrackerFactory {
} }
export interface ITerminalLauncher { export interface ITerminalLauncher {
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined>; runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined>;
}
export interface ITerminalSettings {
external: IExternalTerminalSettings;
integrated: ITerminalConfiguration;
} }
export interface IConfigurationManager { export interface IConfigurationManager {
...@@ -623,7 +616,7 @@ export interface IConfigurationManager { ...@@ -623,7 +616,7 @@ export interface IConfigurationManager {
createDebugAdapter(session: IDebugSession): IDebugAdapter | undefined; createDebugAdapter(session: IDebugSession): IDebugAdapter | undefined;
substituteVariables(debugType: string, folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig>; substituteVariables(debugType: string, folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig>;
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined>; runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined>;
} }
export interface ILaunch { export interface ILaunch {
......
...@@ -9,7 +9,7 @@ import * as objects from 'vs/base/common/objects'; ...@@ -9,7 +9,7 @@ import * as objects from 'vs/base/common/objects';
import { isObject } from 'vs/base/common/types'; import { isObject } from 'vs/base/common/types';
import { IJSONSchema, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema'; import { IJSONSchema, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IConfig, IDebuggerContribution, INTERNAL_CONSOLE_OPTIONS_SCHEMA, IConfigurationManager, IDebugAdapter, ITerminalSettings, IDebugger, IDebugSession, IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug'; import { IConfig, IDebuggerContribution, INTERNAL_CONSOLE_OPTIONS_SCHEMA, IConfigurationManager, IDebugAdapter, IDebugger, IDebugSession, IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import * as ConfigurationResolverUtils from 'vs/workbench/services/configurationResolver/common/configurationResolverUtils'; import * as ConfigurationResolverUtils from 'vs/workbench/services/configurationResolver/common/configurationResolverUtils';
...@@ -108,8 +108,7 @@ export class Debugger implements IDebugger { ...@@ -108,8 +108,7 @@ export class Debugger implements IDebugger {
} }
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> { runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<number | undefined> {
const config = this.configurationService.getValue<ITerminalSettings>('terminal'); return this.configurationManager.runInTerminal(this.type, args);
return this.configurationManager.runInTerminal(this.type, args, config);
} }
get label(): string { get label(): string {
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
import * as cp from 'child_process'; import * as cp from 'child_process';
import * as env from 'vs/base/common/platform'; import * as env from 'vs/base/common/platform';
import { ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug';
import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal'; import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal';
import { WindowsExternalTerminalService, MacExternalTerminalService, LinuxExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/node/externalTerminalService'; import { WindowsExternalTerminalService, MacExternalTerminalService, LinuxExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/node/externalTerminalService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal'; import { IExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
import { ExtHostConfigProvider } from 'vs/workbench/api/common/extHostConfiguration';
let externalTerminalService: IExternalTerminalService | undefined = undefined; let externalTerminalService: IExternalTerminalService | undefined = undefined;
export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): void { export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestArguments, configProvider: ExtHostConfigProvider): void {
if (!externalTerminalService) { if (!externalTerminalService) {
if (env.isWindows) { if (env.isWindows) {
externalTerminalService = new WindowsExternalTerminalService(<IConfigurationService><unknown>undefined); externalTerminalService = new WindowsExternalTerminalService(<IConfigurationService><unknown>undefined);
...@@ -24,6 +24,7 @@ export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestAr ...@@ -24,6 +24,7 @@ export function runInExternalTerminal(args: DebugProtocol.RunInTerminalRequestAr
} }
} }
if (externalTerminalService) { if (externalTerminalService) {
const config = configProvider.getConfiguration('terminal');
externalTerminalService.runInTerminal(args.title!, args.cwd, args.args, args.env || {}, config.external || {}); externalTerminalService.runInTerminal(args.title!, args.cwd, args.args, args.env || {}, config.external || {});
} }
} }
...@@ -60,25 +61,26 @@ export function hasChildProcesses(processId: number): boolean { ...@@ -60,25 +61,26 @@ export function hasChildProcesses(processId: number): boolean {
const enum ShellType { cmd, powershell, bash } const enum ShellType { cmd, powershell, bash }
export function prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): string { export function prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments, shell: string, configProvider: ExtHostConfigProvider): string {
let shellType: ShellType; let shellType = env.isWindows ? ShellType.cmd : ShellType.bash; // pick a good default
if (shell) {
const config = configProvider.getConfiguration('terminal');
// get the shell configuration for the current platform // get the shell configuration for the current platform
let shell: string;
const shell_config = config.integrated.shell; const shell_config = config.integrated.shell;
if (env.isWindows) { if (env.isWindows) {
shell = shell_config.windows || getSystemShell(env.Platform.Windows); shell = shell_config.windows || getSystemShell(env.Platform.Windows);
shellType = ShellType.cmd;
} else if (env.isLinux) { } else if (env.isLinux) {
shell = shell_config.linux || getSystemShell(env.Platform.Linux); shell = shell_config.linux || getSystemShell(env.Platform.Linux);
shellType = ShellType.bash;
} else if (env.isMacintosh) { } else if (env.isMacintosh) {
shell = shell_config.osx || getSystemShell(env.Platform.Mac); shell = shell_config.osx || getSystemShell(env.Platform.Mac);
shellType = ShellType.bash;
} else { } else {
throw new Error('Unknown platform'); throw new Error('Unknown platform');
} }
}
// try to determine the shell type // try to determine the shell type
shell = shell.trim().toLowerCase(); shell = shell.trim().toLowerCase();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册