提交 c3b31c04 编写于 作者: I isidor

debug: remove type and label from IDebuggerContribution

fixes #46550
上级 3bc224fb
...@@ -404,8 +404,6 @@ export interface IAdapterExecutable { ...@@ -404,8 +404,6 @@ export interface IAdapterExecutable {
} }
export interface IPlatformSpecificAdapterContribution { export interface IPlatformSpecificAdapterContribution {
type?: string; // TODO: doesn't belong here
label?: string; // TODO: doesn't belong here
program?: string; program?: string;
args?: string[]; args?: string[];
runtime?: string; runtime?: string;
...@@ -413,9 +411,8 @@ export interface IPlatformSpecificAdapterContribution { ...@@ -413,9 +411,8 @@ export interface IPlatformSpecificAdapterContribution {
} }
export interface IDebuggerContribution extends IPlatformSpecificAdapterContribution { export interface IDebuggerContribution extends IPlatformSpecificAdapterContribution {
// type: string; // TODO: host from IPlatformSpecificAdapterContribution type?: string;
// label?: string; // TODO: host from IPlatformSpecificAdapterContribution label?: string;
// debug adapter executable // debug adapter executable
adapterExecutableCommand?: string; adapterExecutableCommand?: string;
win?: IPlatformSpecificAdapterContribution; win?: IPlatformSpecificAdapterContribution;
......
...@@ -16,14 +16,14 @@ import { Emitter, Event } from 'vs/base/common/event'; ...@@ -16,14 +16,14 @@ import { Emitter, Event } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import * as debug from 'vs/workbench/parts/debug/common/debug';
import { IOutputService } from 'vs/workbench/parts/output/common/output'; import { IOutputService } from 'vs/workbench/parts/output/common/output';
import { IDebugAdapter, IAdapterExecutable, IDebuggerContribution, IPlatformSpecificAdapterContribution } from 'vs/workbench/parts/debug/common/debug';
/** /**
* Abstract implementation of the low level API for a debug adapter. * Abstract implementation of the low level API for a debug adapter.
* Missing is how this API communicates with the debug adapter. * Missing is how this API communicates with the debug adapter.
*/ */
export abstract class AbstractDebugAdapter implements debug.IDebugAdapter { export abstract class AbstractDebugAdapter implements IDebugAdapter {
private sequence: number; private sequence: number;
private pendingRequests: Map<number, (e: DebugProtocol.Response) => void>; private pendingRequests: Map<number, (e: DebugProtocol.Response) => void>;
...@@ -57,14 +57,14 @@ export abstract class AbstractDebugAdapter implements debug.IDebugAdapter { ...@@ -57,14 +57,14 @@ export abstract class AbstractDebugAdapter implements debug.IDebugAdapter {
return this._onExit.event; return this._onExit.event;
} }
public onEvent(callback: (event: DebugProtocol.Event) => void) { public onEvent(callback: (event: DebugProtocol.Event) => void): void {
if (this.eventCallback) { if (this.eventCallback) {
this._onError.fire(new Error(`attempt to set more than one 'Event' callback`)); this._onError.fire(new Error(`attempt to set more than one 'Event' callback`));
} }
this.eventCallback = callback; this.eventCallback = callback;
} }
public onRequest(callback: (request: DebugProtocol.Request) => void) { public onRequest(callback: (request: DebugProtocol.Request) => void): void {
if (this.requestCallback) { if (this.requestCallback) {
this._onError.fire(new Error(`attempt to set more than one 'Request' callback`)); this._onError.fire(new Error(`attempt to set more than one 'Request' callback`));
} }
...@@ -96,7 +96,7 @@ export abstract class AbstractDebugAdapter implements debug.IDebugAdapter { ...@@ -96,7 +96,7 @@ export abstract class AbstractDebugAdapter implements debug.IDebugAdapter {
} }
} }
public acceptMessage(message: DebugProtocol.ProtocolMessage) { public acceptMessage(message: DebugProtocol.ProtocolMessage): void {
switch (message.type) { switch (message.type) {
case 'event': case 'event':
if (this.eventCallback) { if (this.eventCallback) {
...@@ -219,7 +219,7 @@ export class DebugAdapter extends StreamDebugAdapter { ...@@ -219,7 +219,7 @@ export class DebugAdapter extends StreamDebugAdapter {
private _serverProcess: cp.ChildProcess; private _serverProcess: cp.ChildProcess;
constructor(private _debugType: string, private _adapterExecutable: debug.IAdapterExecutable | null, extensionDescriptions: IExtensionDescription[], private _outputService?: IOutputService) { constructor(private _debugType: string, private _adapterExecutable: IAdapterExecutable | null, extensionDescriptions: IExtensionDescription[], private _outputService?: IOutputService) {
super(); super();
if (!this._adapterExecutable) { if (!this._adapterExecutable) {
...@@ -306,61 +306,61 @@ export class DebugAdapter extends StreamDebugAdapter { ...@@ -306,61 +306,61 @@ export class DebugAdapter extends StreamDebugAdapter {
} }
} }
private static extract(dbg: debug.IDebuggerContribution, extensionFolderPath: string) { private static extract(contribution: IDebuggerContribution, extensionFolderPath: string): IDebuggerContribution {
if (!dbg) { if (!contribution) {
return undefined; return undefined;
} }
let x: debug.IDebuggerContribution = {}; let result: IDebuggerContribution = {};
if (dbg.runtime) { if (contribution.runtime) {
if (dbg.runtime.indexOf('./') === 0) { // TODO if (contribution.runtime.indexOf('./') === 0) { // TODO
x.runtime = paths.join(extensionFolderPath, dbg.runtime); result.runtime = paths.join(extensionFolderPath, contribution.runtime);
} else { } else {
x.runtime = dbg.runtime; result.runtime = contribution.runtime;
} }
} }
if (dbg.runtimeArgs) { if (contribution.runtimeArgs) {
x.runtimeArgs = dbg.runtimeArgs; result.runtimeArgs = contribution.runtimeArgs;
} }
if (dbg.program) { if (contribution.program) {
if (!paths.isAbsolute(dbg.program)) { if (!paths.isAbsolute(contribution.program)) {
x.program = paths.join(extensionFolderPath, dbg.program); result.program = paths.join(extensionFolderPath, contribution.program);
} else { } else {
x.program = dbg.program; result.program = contribution.program;
} }
} }
if (dbg.args) { if (contribution.args) {
x.args = dbg.args; result.args = contribution.args;
} }
if (dbg.win) { if (contribution.win) {
x.win = DebugAdapter.extract(dbg.win, extensionFolderPath); result.win = DebugAdapter.extract(contribution.win, extensionFolderPath);
} }
if (dbg.winx86) { if (contribution.winx86) {
x.winx86 = DebugAdapter.extract(dbg.winx86, extensionFolderPath); result.winx86 = DebugAdapter.extract(contribution.winx86, extensionFolderPath);
} }
if (dbg.windows) { if (contribution.windows) {
x.windows = DebugAdapter.extract(dbg.windows, extensionFolderPath); result.windows = DebugAdapter.extract(contribution.windows, extensionFolderPath);
} }
if (dbg.osx) { if (contribution.osx) {
x.osx = DebugAdapter.extract(dbg.osx, extensionFolderPath); result.osx = DebugAdapter.extract(contribution.osx, extensionFolderPath);
} }
if (dbg.linux) { if (contribution.linux) {
x.linux = DebugAdapter.extract(dbg.linux, extensionFolderPath); result.linux = DebugAdapter.extract(contribution.linux, extensionFolderPath);
} }
return x; return result;
} }
static platformAdapterExecutable(extensionDescriptions: IExtensionDescription[], debugType: string): debug.IAdapterExecutable { static platformAdapterExecutable(extensionDescriptions: IExtensionDescription[], debugType: string): IAdapterExecutable {
let result: debug.IDebuggerContribution = {}; let result: IDebuggerContribution = {};
debugType = debugType.toLowerCase(); debugType = debugType.toLowerCase();
// merge all contributions into one // merge all contributions into one
for (const ed of extensionDescriptions) { for (const ed of extensionDescriptions) {
if (ed.contributes) { if (ed.contributes) {
const debuggers = <debug.IDebuggerContribution[]>ed.contributes['debuggers']; const debuggers = <IDebuggerContribution[]>ed.contributes['debuggers'];
if (debuggers && debuggers.length > 0) { if (debuggers && debuggers.length > 0) {
const dbgs = debuggers.filter(d => strings.equalsIgnoreCase(d.type, debugType)); const dbgs = debuggers.filter(d => strings.equalsIgnoreCase(d.type, debugType));
for (const dbg of dbgs) { for (const dbg of dbgs) {
...@@ -376,7 +376,7 @@ export class DebugAdapter extends StreamDebugAdapter { ...@@ -376,7 +376,7 @@ export class DebugAdapter extends StreamDebugAdapter {
} }
// select the right platform // select the right platform
let platformInfo: debug.IPlatformSpecificAdapterContribution; let platformInfo: IPlatformSpecificAdapterContribution;
if (platform.isWindows && !process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) { if (platform.isWindows && !process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) {
platformInfo = result.winx86 || result.win || result.windows; platformInfo = result.winx86 || result.win || result.windows;
} else if (platform.isWindows) { } else if (platform.isWindows) {
...@@ -410,7 +410,7 @@ export class DebugAdapter extends StreamDebugAdapter { ...@@ -410,7 +410,7 @@ export class DebugAdapter extends StreamDebugAdapter {
// path hooks helpers // path hooks helpers
export function convertToDAPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (source: DebugProtocol.Source) => void) { export function convertToDAPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (source: DebugProtocol.Source) => void): void {
convertPaths(msg, (toDA: boolean, source: DebugProtocol.Source | undefined) => { convertPaths(msg, (toDA: boolean, source: DebugProtocol.Source | undefined) => {
if (toDA && source) { if (toDA && source) {
fixSourcePaths(source); fixSourcePaths(source);
...@@ -418,7 +418,7 @@ export function convertToDAPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePa ...@@ -418,7 +418,7 @@ export function convertToDAPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePa
}); });
} }
export function convertToVSCPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (source: DebugProtocol.Source) => void) { export function convertToVSCPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (source: DebugProtocol.Source) => void): void {
convertPaths(msg, (toDA: boolean, source: DebugProtocol.Source | undefined) => { convertPaths(msg, (toDA: boolean, source: DebugProtocol.Source | undefined) => {
if (!toDA && source) { if (!toDA && source) {
fixSourcePaths(source); fixSourcePaths(source);
...@@ -426,7 +426,7 @@ export function convertToVSCPaths(msg: DebugProtocol.ProtocolMessage, fixSourceP ...@@ -426,7 +426,7 @@ export function convertToVSCPaths(msg: DebugProtocol.ProtocolMessage, fixSourceP
}); });
} }
function convertPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (toDA: boolean, source: DebugProtocol.Source | undefined) => void) { function convertPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (toDA: boolean, source: DebugProtocol.Source | undefined) => void): void {
switch (msg.type) { switch (msg.type) {
case 'event': case 'event':
const event = <DebugProtocol.Event>msg; const event = <DebugProtocol.Event>msg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册