提交 3caba644 编写于 作者: A Andre Weinand

move handshake to eh

上级 4cb14a33
......@@ -34,6 +34,8 @@ import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { SignService } from 'vs/platform/sign/node/signService';
import { ISignService } from 'vs/platform/sign/common/sign';
export class ExtHostDebugService implements ExtHostDebugServiceShape {
......@@ -81,6 +83,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
private _integratedTerminalInstance?: vscode.Terminal;
private _terminalDisposedListener: IDisposable;
private _signService: ISignService;
constructor(mainContext: IMainContext,
private _workspaceService: IExtHostWorkspaceProvider,
......@@ -421,16 +425,45 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
this._debugAdaptersTrackers.set(debugAdapterHandle, tracker);
}
debugAdapter.onMessage(message => {
debugAdapter.onMessage(async message => {
if (tracker && tracker.onDidSendMessage) {
tracker.onDidSendMessage(message);
}
if (message.type === 'request' && (<DebugProtocol.Request>message).command === 'handshake') {
const request = <DebugProtocol.Request>message;
const response: DebugProtocol.Response = {
type: 'response',
seq: 0,
command: request.command,
request_seq: request.seq,
success: true
};
if (!this._signService) {
this._signService = new SignService();
}
// DA -> VS Code
message = convertToVSCPaths(message, true);
try {
const signature = await this._signService.sign(request.arguments.value);
response.body = {
signature: signature
};
debugAdapter.sendResponse(response);
} catch (e) {
response.success = false;
response.message = e.message;
debugAdapter.sendResponse(response);
}
} else {
if (tracker && tracker.onDidSendMessage) {
tracker.onDidSendMessage(message);
}
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
// DA -> VS Code
message = convertToVSCPaths(message, true);
mythis._debugServiceProxy.$acceptDAMessage(debugAdapterHandle, message);
}
});
debugAdapter.onError(err => {
if (tracker && tracker.onError) {
......
......@@ -31,7 +31,6 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ReplModel } from 'vs/workbench/contrib/debug/common/replModel';
import { onUnexpectedError } from 'vs/base/common/errors';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ISignService } from 'vs/platform/sign/common/sign';
export class DebugSession implements IDebugSession {
......@@ -66,7 +65,6 @@ export class DebugSession implements IDebugSession {
@IViewletService private readonly viewletService: IViewletService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@INotificationService private readonly notificationService: INotificationService,
@ISignService private readonly signService: ISignService,
@IProductService private readonly productService: IProductService,
@IWindowsService private readonly windowsService: IWindowsService
) {
......@@ -169,7 +167,7 @@ export class DebugSession implements IDebugSession {
return dbgr.createDebugAdapter(this).then(debugAdapter => {
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.signService, this.windowsService);
this.raw = new RawDebugSession(debugAdapter, dbgr, this.telemetryService, customTelemetryService, this.windowsService);
return this.raw!.start().then(() => {
......
......@@ -12,7 +12,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { formatPII, isUri } from 'vs/workbench/contrib/debug/common/debugUtils';
import { IDebugAdapter, IConfig, AdapterEndEvent, IDebugger } from 'vs/workbench/contrib/debug/common/debug';
import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
import { ISignService } from 'vs/platform/sign/common/sign';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { URI } from 'vs/base/common/uri';
......@@ -74,7 +73,6 @@ export class RawDebugSession {
dbgr: IDebugger,
private readonly telemetryService: ITelemetryService,
public readonly customTelemetryService: ITelemetryService | undefined,
private readonly signService: ISignService,
private readonly windowsService: IWindowsService
) {
......@@ -548,19 +546,6 @@ export class RawDebugSession {
safeSendResponse(response);
});
break;
case 'handshake':
try {
const signature = await this.signService.sign(request.arguments.value);
response.body = {
signature: signature
};
safeSendResponse(response);
} catch (e) {
response.success = false;
response.message = e.message;
safeSendResponse(response);
}
break;
default:
response.success = false;
response.message = `unknown request '${request.command}'`;
......
......@@ -15,7 +15,7 @@ import { ReplModel } from 'vs/workbench/contrib/debug/common/replModel';
import { IBreakpointUpdateData } from 'vs/workbench/contrib/debug/common/debug';
function createMockSession(model: DebugModel, name = 'mockSession', parentSession?: DebugSession | undefined): DebugSession {
return new DebugSession({ resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, parentSession, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
return new DebugSession({ resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, parentSession, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
}
suite('Debug - Model', () => {
......@@ -427,7 +427,7 @@ suite('Debug - Model', () => {
// Repl output
test('repl output', () => {
const session = new DebugSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
const session = new DebugSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!);
const repl = new ReplModel(session);
repl.appendToRepl('first line\n', severity.Error);
repl.appendToRepl('second line ', severity.Error);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册