提交 fb61dd18 编写于 作者: A Andre Weinand

add config to vscode.DebugSession

上级 63b07c14
......@@ -571,9 +571,14 @@ declare module 'vscode' {
*/
export interface DebugSession {
/**
* The workspace folder of this DebugSession or undefined for a folderless setup.
* The workspace folder of this session or undefined for a folderless setup.
*/
readonly workspaceFolder: WorkspaceFolder | undefined;
/**
* The resolved debug configuration for the session.
*/
readonly configuration: DebugConfiguration;
}
/**
......@@ -658,11 +663,9 @@ declare module 'vscode' {
/**
* The optional method 'provideDebugAdapterTracker' is called at the start of a debug session to provide a tracker that gives access to the communication between VS Code and a Debug Adapter.
* @param session The [debug session](#DebugSession) for which the tracker will be used.
* @param folder The workspace folder from which the configuration originates from or undefined for a folderless setup.
* @param config The resolved debug configuration.
* @param token A cancellation token.
*/
provideDebugAdapterTracker?(session: DebugSession, config: DebugConfiguration, token?: CancellationToken): ProviderResult<DebugAdapterTracker>;
provideDebugAdapterTracker?(session: DebugSession, token?: CancellationToken): ProviderResult<DebugAdapterTracker>;
}
export interface DebugAdapterProvider {
......@@ -681,11 +684,10 @@ declare module 'vscode' {
* }
* @param session The [debug session](#DebugSession) for which the debug adapter will be used.
* @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists).
* @param config The resolved debug configuration.
* @param token A cancellation token.
* @return a [debug adapter's descriptor](#DebugAdapterDescriptor) or undefined.
*/
provideDebugAdapter(session: DebugSession, executable: DebugAdapterExecutable | undefined, config: DebugConfiguration, token?: CancellationToken): ProviderResult<DebugAdapterDescriptor>;
provideDebugAdapter(session: DebugSession, executable: DebugAdapterExecutable | undefined, token?: CancellationToken): ProviderResult<DebugAdapterDescriptor>;
}
/**
......
......@@ -26,6 +26,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
private _debugAdaptersHandleCounter = 1;
private _debugConfigurationProviders: Map<number, IDebugConfigurationProvider>;
private _debugAdapterProviders: Map<number, IDebugAdapterProvider>;
private _sessions: Set<DebugSessionUUID>;
constructor(
extHostContext: IExtHostContext,
......@@ -50,6 +51,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
this._debugAdapters = new Map();
this._debugConfigurationProviders = new Map();
this._debugAdapterProviders = new Map();
this._sessions = new Set();
}
public dispose(): void {
......@@ -58,9 +60,9 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
// interface IDebugAdapterProvider
createDebugAdapter(session: IDebugSession, config: IConfig): IDebugAdapter {
createDebugAdapter(session: IDebugSession): IDebugAdapter {
const handle = this._debugAdaptersHandleCounter++;
const da = new ExtensionHostDebugAdapter(handle, this._proxy, this.getSessionDto(session), config);
const da = new ExtensionHostDebugAdapter(handle, this._proxy, this.getSessionDto(session));
this._debugAdapters.set(handle, da);
return da;
}
......@@ -185,8 +187,8 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
const provider = <IDebugAdapterProvider>{
type: debugType,
provideDebugAdapter: (session, config) => {
return Promise.resolve(this._proxy.$provideDebugAdapter(handle, this.getSessionDto(session), config));
provideDebugAdapter: session => {
return Promise.resolve(this._proxy.$provideDebugAdapter(handle, this.getSessionDto(session)));
}
};
this._debugAdapterProviders.set(handle, provider);
......@@ -252,12 +254,19 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
private getSessionDto(session: IDebugSession): IDebugSessionDto {
if (session) {
return {
id: <DebugSessionUUID>session.getId(),
type: session.configuration.type,
name: session.configuration.name,
folderUri: session.root ? session.root.uri : undefined
};
const sessionID = <DebugSessionUUID>session.getId();
if (this._sessions.has(sessionID)) {
return sessionID;
} else {
this._sessions.add(sessionID);
return {
id: sessionID,
type: session.configuration.type,
name: session.configuration.name,
folderUri: session.root ? session.root.uri : undefined,
configuration: session.configuration
};
}
}
return undefined;
}
......@@ -298,7 +307,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
*/
class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
constructor(private _handle: number, private _proxy: ExtHostDebugServiceShape, private _sessionDto: IDebugSessionDto, private config: IConfig) {
constructor(private _handle: number, private _proxy: ExtHostDebugServiceShape, private _sessionDto: IDebugSessionDto) {
super();
}
......@@ -311,7 +320,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
}
public startSession(): Promise<void> {
return Promise.resolve(this._proxy.$startDASession(this._handle, this._sessionDto, this.config));
return Promise.resolve(this._proxy.$startDASession(this._handle, this._sessionDto));
}
public sendMessage(message: DebugProtocol.ProtocolMessage): void {
......
......@@ -964,23 +964,26 @@ export interface ISourceMultiBreakpointDto {
}[];
}
export interface IDebugSessionDto {
export interface IDebugSessionFullDto {
id: DebugSessionUUID;
type: string;
name: string;
folderUri: UriComponents | undefined;
configuration: IConfig;
}
export type IDebugSessionDto = IDebugSessionFullDto | DebugSessionUUID;
export interface ExtHostDebugServiceShape {
$substituteVariables(folder: UriComponents | undefined, config: IConfig): Thenable<IConfig>;
$runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Thenable<void>;
$startDASession(handle: number, session: IDebugSessionDto, debugConfiguration: IConfig): Thenable<void>;
$startDASession(handle: number, session: IDebugSessionDto): Thenable<void>;
$stopDASession(handle: number): Thenable<void>;
$sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): void;
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): Thenable<IConfig>;
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined): Thenable<IConfig[]>;
$legacyDebugAdapterExecutable(handle: number, folderUri: UriComponents | undefined): Thenable<IAdapterDescriptor>; // TODO@AW legacy
$provideDebugAdapter(handle: number, session: IDebugSessionDto, debugConfiguration: IConfig): Thenable<IAdapterDescriptor>;
$provideDebugAdapter(handle: number, session: IDebugSessionDto): Thenable<IAdapterDescriptor>;
$acceptDebugSessionStarted(session: IDebugSessionDto): void;
$acceptDebugSessionTerminated(session: IDebugSessionDto): void;
$acceptDebugSessionActiveChanged(session: IDebugSessionDto): void;
......
......@@ -364,10 +364,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return Promise.resolve(this._variableResolver.resolveAny(ws, config));
}
public $startDASession(handle: number, sessionDto: IDebugSessionDto, config: vscode.DebugConfiguration): Thenable<void> {
public $startDASession(debugAdapterHandle: number, sessionDto: IDebugSessionDto): Thenable<void> {
const mythis = this;
return this.getAdapterDescriptor(this.getAdapterProviderByType(config.type), sessionDto, config).then(x => {
const session = this.getSession(sessionDto);
return this.getAdapterDescriptor(this.getAdapterProviderByType(session.type), session).then(x => {
const adapter = this.convertToDto(x);
let da: AbstractDebugAdapter | undefined = undefined;
......@@ -379,7 +380,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
break;
case 'executable':
da = new ExecutableDebugAdapter(adapter, config.type);
da = new ExecutableDebugAdapter(adapter, session.type);
break;
case 'implementation':
......@@ -391,12 +392,12 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
if (da) {
this._debugAdapters.set(handle, da);
this._debugAdapters.set(debugAdapterHandle, da);
return this.getDebugAdapterTrackers(sessionDto, config).then(tracker => {
return this.getDebugAdapterTrackers(session).then(tracker => {
if (tracker) {
this._debugAdaptersTrackers.set(handle, tracker);
this._debugAdaptersTrackers.set(debugAdapterHandle, tracker);
}
da.onMessage(message => {
......@@ -408,19 +409,19 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
// DA -> VS Code
message = convertToVSCPaths(message, source => stringToUri(source));
mythis._debugServiceProxy.$acceptDAMessage(handle, message);
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
});
da.onError(err => {
if (tracker) {
tracker.debugAdapterError(err);
}
this._debugServiceProxy.$acceptDAError(handle, err.name, err.message, err.stack);
this._debugServiceProxy.$acceptDAError(debugAdapterHandle, err.name, err.message, err.stack);
});
da.onExit(code => {
if (tracker) {
tracker.debugAdapterExit(code, null);
}
this._debugServiceProxy.$acceptDAExit(handle, code, null);
this._debugServiceProxy.$acceptDAExit(debugAdapterHandle, code, null);
});
if (tracker) {
......@@ -435,33 +436,33 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
});
}
public $sendDAMessage(handle: number, message: DebugProtocol.ProtocolMessage): Promise<void> {
public $sendDAMessage(debugAdapterHandle: number, message: DebugProtocol.ProtocolMessage): Promise<void> {
// VS Code -> DA
message = convertToDAPaths(message, source => uriToString(source));
const tracker = this._debugAdaptersTrackers.get(handle);
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle); // TODO@AW: same handle?
if (tracker) {
tracker.toDebugAdapter(message);
}
const da = this._debugAdapters.get(handle);
const da = this._debugAdapters.get(debugAdapterHandle);
if (da) {
da.sendMessage(message);
}
return void 0;
}
public $stopDASession(handle: number): Thenable<void> {
public $stopDASession(debugAdapterHandle: number): Thenable<void> {
const tracker = this._debugAdaptersTrackers.get(handle);
this._debugAdaptersTrackers.delete(handle);
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle);
this._debugAdaptersTrackers.delete(debugAdapterHandle);
if (tracker) {
tracker.stopDebugAdapter();
}
const da = this._debugAdapters.get(handle);
this._debugAdapters.delete(handle);
const da = this._debugAdapters.get(debugAdapterHandle);
this._debugAdapters.delete(debugAdapterHandle);
if (da) {
return da.stopSession();
} else {
......@@ -530,8 +531,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
this.fireBreakpointChanges(a, r, c);
}
public $provideDebugConfigurations(handle: number, folderUri: UriComponents | undefined): Thenable<vscode.DebugConfiguration[]> {
let provider = this.getConfigProviderByHandle(handle);
public $provideDebugConfigurations(configProviderHandle: number, folderUri: UriComponents | undefined): Thenable<vscode.DebugConfiguration[]> {
let provider = this.getConfigProviderByHandle(configProviderHandle);
if (!provider) {
return Promise.reject(new Error('no handler found'));
}
......@@ -541,8 +542,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return asThenable(() => provider.provideDebugConfigurations(this.getFolder(folderUri), CancellationToken.None));
}
public $resolveDebugConfiguration(handle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): Thenable<vscode.DebugConfiguration> {
let provider = this.getConfigProviderByHandle(handle);
public $resolveDebugConfiguration(configProviderHandle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): Thenable<vscode.DebugConfiguration> {
let provider = this.getConfigProviderByHandle(configProviderHandle);
if (!provider) {
return Promise.reject(new Error('no handler found'));
}
......@@ -553,9 +554,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
// TODO@AW legacy
public $legacyDebugAdapterExecutable(handle: number, folderUri: UriComponents | undefined): Thenable<IAdapterDescriptor> {
let provider = this.getConfigProviderByHandle(handle);
public $legacyDebugAdapterExecutable(configProviderHandle: number, folderUri: UriComponents | undefined): Thenable<IAdapterDescriptor> {
let provider = this.getConfigProviderByHandle(configProviderHandle);
if (!provider) {
return Promise.reject(new Error('no handler found'));
}
......@@ -565,12 +565,12 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return asThenable(() => provider.debugAdapterExecutable(this.getFolder(folderUri), CancellationToken.None)).then(x => this.convertToDto(x));
}
public $provideDebugAdapter(handle: number, sessionDto: IDebugSessionDto, config: vscode.DebugConfiguration): Thenable<IAdapterDescriptor> {
let adapterProvider = this.getAdapterProviderByHandle(handle);
public $provideDebugAdapter(adapterProviderHandle: number, sessionDto: IDebugSessionDto): Thenable<IAdapterDescriptor> {
let adapterProvider = this.getAdapterProviderByHandle(adapterProviderHandle);
if (!adapterProvider) {
return Promise.reject(new Error('no handler found'));
}
return this.getAdapterDescriptor(adapterProvider, sessionDto, config).then(x => this.convertToDto(x));
return this.getAdapterDescriptor(adapterProvider, this.getSession(sessionDto)).then(x => this.convertToDto(x));
}
public $acceptDebugSessionStarted(sessionDto: IDebugSessionDto): void {
......@@ -580,8 +580,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
public $acceptDebugSessionTerminated(sessionDto: IDebugSessionDto): void {
this._onDidTerminateDebugSession.fire(this.getSession(sessionDto));
this._debugSessions.delete(sessionDto.id);
const session = this.getSession(sessionDto);
if (session) {
this._onDidTerminateDebugSession.fire(session);
this._debugSessions.delete(session.id);
}
}
public $acceptDebugSessionActiveChanged(sessionDto: IDebugSessionDto): void {
......@@ -668,14 +671,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return false;
}
private getDebugAdapterTrackers(sessionDto: IDebugSessionDto, config: vscode.DebugConfiguration): Promise<vscode.DebugAdapterTracker> {
const session = this.getSession(sessionDto);
private getDebugAdapterTrackers(session: ExtHostDebugSession): Promise<vscode.DebugAdapterTracker> {
const config = session.configuration;
const type = config.type;
const promises = this._configProviders
.filter(pair => pair.provider.provideDebugAdapterTracker && (pair.type === type || pair.type === '*'))
.map(pair => asThenable(() => pair.provider.provideDebugAdapterTracker(session, config, CancellationToken.None)).then(p => p).catch(err => null));
.map(pair => asThenable(() => pair.provider.provideDebugAdapterTracker(session, CancellationToken.None)).then(p => p).catch(err => null));
return Promise.race([
Promise.all(promises).then(trackers => {
......@@ -697,17 +699,16 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
});
}
private getAdapterDescriptor(adapterProvider: vscode.DebugAdapterProvider, sessionDto: IDebugSessionDto, config: vscode.DebugConfiguration): Thenable<vscode.DebugAdapterDescriptor> {
private getAdapterDescriptor(adapterProvider: vscode.DebugAdapterProvider, session: ExtHostDebugSession): Thenable<vscode.DebugAdapterDescriptor> {
// a "debugServer" attribute in the launch config takes precedence
if (typeof config.debugServer === 'number') {
return Promise.resolve(new DebugAdapterServer(config.debugServer));
const serverPort = session.configuration.debugServer;
if (typeof serverPort === 'number') {
return Promise.resolve(new DebugAdapterServer(serverPort));
}
const session = this.getSession(sessionDto);
// TODO@AW legacy
const pairs = this._configProviders.filter(p => p.type === config.type);
const pairs = this._configProviders.filter(p => p.type === session.type);
if (pairs.length > 0) {
if (pairs[0].provider.debugAdapterExecutable) {
return asThenable(() => pairs[0].provider.debugAdapterExecutable(session.workspaceFolder, CancellationToken.None));
......@@ -715,13 +716,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
if (adapterProvider) {
const adapterExecutable = ExecutableDebugAdapter.platformAdapterExecutable(this._extensionService.getAllExtensionDescriptions(), config.type);
return asThenable(() => adapterProvider.provideDebugAdapter(session, adapterExecutable, config, CancellationToken.None));
const adapterExecutable = ExecutableDebugAdapter.platformAdapterExecutable(this._extensionService.getAllExtensionDescriptions(), session.type);
return asThenable(() => adapterProvider.provideDebugAdapter(session, adapterExecutable, CancellationToken.None));
}
// try deprecated command based extension API "adapterExecutableCommand" to determine the executable
// TODO@AW legacy
const aex = this._aexCommands.get(config.type);
const aex = this._aexCommands.get(session.type);
if (aex) {
const folder = session.workspaceFolder;
const rootFolder = folder ? folder.uri.toString() : undefined;
......@@ -731,7 +732,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
// fallback: use executable information from package.json
return Promise.resolve(ExecutableDebugAdapter.platformAdapterExecutable(this._extensionService.getAllExtensionDescriptions(), config.type));
return Promise.resolve(ExecutableDebugAdapter.platformAdapterExecutable(this._extensionService.getAllExtensionDescriptions(), session.type));
}
private startBreakpoints() {
......@@ -753,12 +754,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
private getSession(dto: IDebugSessionDto): ExtHostDebugSession {
if (dto) {
let debugSession = this._debugSessions.get(dto.id);
if (!debugSession) {
debugSession = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, this.getFolder(dto.folderUri));
this._debugSessions.set(dto.id, debugSession);
if (typeof dto === 'string') {
return this._debugSessions.get(dto);
} else {
const debugSession = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, this.getFolder(dto.folderUri), dto.configuration);
this._debugSessions.set(debugSession.id, debugSession);
return debugSession;
}
return debugSession;
}
return undefined;
}
......@@ -779,7 +781,8 @@ export class ExtHostDebugSession implements vscode.DebugSession {
private _id: DebugSessionUUID,
private _type: string,
private _name: string,
private _workspaceFolder: vscode.WorkspaceFolder | undefined) {
private _workspaceFolder: vscode.WorkspaceFolder | undefined,
private _configuration: vscode.DebugConfiguration) {
}
public get id(): string {
......@@ -798,6 +801,10 @@ export class ExtHostDebugSession implements vscode.DebugSession {
return this._workspaceFolder;
}
public get configuration(): vscode.DebugConfiguration {
return this._configuration;
}
public customRequest(command: string, args: any): Thenable<any> {
return this._debugServiceProxy.$customDebugAdapterRequest(this._id, command, args);
}
......
......@@ -110,7 +110,7 @@ export interface IExpression extends IReplElement, IExpressionContainer {
}
export interface IDebugger {
createDebugAdapter(session: IDebugSession, config: IConfig, outputService: IOutputService): Promise<IDebugAdapter>;
createDebugAdapter(session: IDebugSession, outputService: IOutputService): Promise<IDebugAdapter>;
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments): Promise<void>;
getCustomTelemetryService(): Thenable<TelemetryService>;
}
......@@ -468,7 +468,7 @@ export interface IDebugAdapter extends IDisposable {
}
export interface IDebugAdapterFactory extends ITerminalLauncher {
createDebugAdapter(session: IDebugSession, config: IConfig): IDebugAdapter;
createDebugAdapter(session: IDebugSession): IDebugAdapter;
substituteVariables(folder: IWorkspaceFolder, config: IConfig): Promise<IConfig>;
}
......@@ -535,7 +535,7 @@ export interface IDebugConfigurationProvider {
export interface IDebugAdapterProvider {
readonly type: string;
provideDebugAdapter(session: IDebugSession, config: IConfig): Promise<IAdapterDescriptor>;
provideDebugAdapter(session: IDebugSession): Promise<IAdapterDescriptor>;
}
export interface ITerminalLauncher {
......@@ -592,10 +592,10 @@ export interface IConfigurationManager {
unregisterDebugAdapterProvider(debugConfigurationProvider: IDebugAdapterProvider): void;
resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: any): Thenable<any>;
provideDebugAdapter(session: IDebugSession, config: IConfig): Promise<IAdapterDescriptor | undefined>;
provideDebugAdapter(session: IDebugSession): Promise<IAdapterDescriptor | undefined>;
registerDebugAdapterFactory(debugTypes: string[], debugAdapterFactory: IDebugAdapterFactory): IDisposable;
createDebugAdapter(session: IDebugSession, config: IConfig): IDebugAdapter;
createDebugAdapter(session: IDebugSession): IDebugAdapter;
substituteVariables(debugType: string, folder: IWorkspaceFolder, config: IConfig): Promise<IConfig>;
runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<void>;
......
......@@ -92,10 +92,10 @@ export class ConfigurationManager implements IConfigurationManager {
};
}
public createDebugAdapter(session: IDebugSession, config: IConfig): IDebugAdapter {
let dap = this.debugAdapterFactories.get(config.type);
public createDebugAdapter(session: IDebugSession): IDebugAdapter {
let dap = this.debugAdapterFactories.get(session.configuration.type);
if (dap) {
return dap.createDebugAdapter(session, config);
return dap.createDebugAdapter(session);
}
return undefined;
}
......@@ -137,7 +137,9 @@ export class ConfigurationManager implements IConfigurationManager {
}
}
public provideDebugAdapter(session: IDebugSession, config: IConfig): Promise<IAdapterDescriptor | undefined> {
public provideDebugAdapter(session: IDebugSession): Promise<IAdapterDescriptor | undefined> {
const config = session.configuration;
// first try legacy proposed API: DebugConfigurationProvider.debugAdapterExecutable
const providers0 = this.configProviders.filter(p => p.type === config.type && p.debugAdapterExecutable);
......@@ -150,7 +152,7 @@ export class ConfigurationManager implements IConfigurationManager {
// try new proposed API
const providers = this.adapterProviders.filter(p => p.type === config.type && p.provideDebugAdapter);
if (providers.length === 1) {
return providers[0].provideDebugAdapter(session, config);
return providers[0].provideDebugAdapter(session);
} else {
// TODO@AW handle n > 1 case
}
......
......@@ -144,7 +144,7 @@ export class DebugSession implements IDebugSession {
return dbgr.getCustomTelemetryService().then(customTelemetryService => {
return dbgr.createDebugAdapter(this, this._configuration.resolved, this.outputService).then(debugAdapter => {
return dbgr.createDebugAdapter(this, this.outputService).then(debugAdapter => {
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService);
......
......@@ -42,11 +42,11 @@ export class Debugger implements IDebugger {
}
createDebugAdapter(session: IDebugSession, config: IConfig, outputService: IOutputService): Promise<IDebugAdapter> {
createDebugAdapter(session: IDebugSession, outputService: IOutputService): Promise<IDebugAdapter> {
if (this.inExtHost()) {
return Promise.resolve(this.configurationManager.createDebugAdapter(session, config));
return Promise.resolve(this.configurationManager.createDebugAdapter(session));
} else {
return this.getAdapterDescriptor(session, config).then(adapterDescriptor => {
return this.getAdapterDescriptor(session).then(adapterDescriptor => {
switch (adapterDescriptor.type) {
case 'executable':
return new ExecutableDebugAdapter(adapterDescriptor, this.type, outputService);
......@@ -54,7 +54,7 @@ export class Debugger implements IDebugger {
return new SocketDebugAdapter(adapterDescriptor);
case 'implementation':
// TODO@AW: this.inExtHost() should now return true
return Promise.resolve(this.configurationManager.createDebugAdapter(session, config));
return Promise.resolve(this.configurationManager.createDebugAdapter(session));
default:
throw new Error('Cannot create debug adapter.');
}
......@@ -62,18 +62,18 @@ export class Debugger implements IDebugger {
}
}
private getAdapterDescriptor(session: IDebugSession, config: IConfig): Promise<IAdapterDescriptor> {
private getAdapterDescriptor(session: IDebugSession): Promise<IAdapterDescriptor> {
// a "debugServer" attribute in the launch config takes precedence
if (typeof config.debugServer === 'number') {
if (typeof session.configuration.debugServer === 'number') {
return Promise.resolve(<IDebugAdapterServer>{
type: 'server',
port: config.debugServer
port: session.configuration.debugServer
});
}
// try the proposed and the deprecated "provideDebugAdapter" API
return this.configurationManager.provideDebugAdapter(session, config).then(adapter => {
return this.configurationManager.provideDebugAdapter(session).then(adapter => {
if (adapter) {
return adapter;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册