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

Remove usage of CustomMarshaller for DebugService (#40169)

上级 475ac42d
...@@ -143,8 +143,9 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape { ...@@ -143,8 +143,9 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
return TPromise.wrap<void>(undefined); return TPromise.wrap<void>(undefined);
} }
public $startDebugging(folderUri: uri | undefined, nameOrConfiguration: string | IConfig): TPromise<boolean> { public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig): TPromise<boolean> {
const folder = folderUri ? this.contextService.getWorkspace().folders.filter(wf => wf.uri.toString() === folderUri.toString()).pop() : undefined; const folderUriString = _folderUri ? uri.revive(_folderUri).toString() : undefined;
const folder = folderUriString ? this.contextService.getWorkspace().folders.filter(wf => wf.uri.toString() === folderUriString).pop() : undefined;
return this.debugService.startDebugging(folder, nameOrConfiguration).then(x => { return this.debugService.startDebugging(folder, nameOrConfiguration).then(x => {
return true; return true;
}, err => { }, err => {
......
...@@ -31,6 +31,7 @@ import * as modes from 'vs/editor/common/modes'; ...@@ -31,6 +31,7 @@ import * as modes from 'vs/editor/common/modes';
import { ITextSource } from 'vs/editor/common/model/textSource'; import { ITextSource } from 'vs/editor/common/model/textSource';
import { IConfigurationData, ConfigurationTarget, IConfigurationModel } from 'vs/platform/configuration/common/configuration'; import { IConfigurationData, ConfigurationTarget, IConfigurationModel } from 'vs/platform/configuration/common/configuration';
import { IConfig } from 'vs/workbench/parts/debug/common/debug';
import { IPickOpenEntry, IPickOptions } from 'vs/platform/quickOpen/common/quickOpen'; import { IPickOpenEntry, IPickOptions } from 'vs/platform/quickOpen/common/quickOpen';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles'; import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
...@@ -446,7 +447,7 @@ export type DebugSessionUUID = string; ...@@ -446,7 +447,7 @@ export type DebugSessionUUID = string;
export interface MainThreadDebugServiceShape extends IDisposable { export interface MainThreadDebugServiceShape extends IDisposable {
$registerDebugConfigurationProvider(type: string, hasProvideMethod: boolean, hasResolveMethod: boolean, handle: number): TPromise<any>; $registerDebugConfigurationProvider(type: string, hasProvideMethod: boolean, hasResolveMethod: boolean, handle: number): TPromise<any>;
$unregisterDebugConfigurationProvider(handle: number): TPromise<any>; $unregisterDebugConfigurationProvider(handle: number): TPromise<any>;
$startDebugging(folder: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise<boolean>; $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise<boolean>;
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise<any>; $customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise<any>;
$appendDebugConsole(value: string): TPromise<any>; $appendDebugConsole(value: string): TPromise<any>;
$startBreakpointEvents(): TPromise<any>; $startBreakpointEvents(): TPromise<any>;
...@@ -691,7 +692,7 @@ export interface IBreakpointData { ...@@ -691,7 +692,7 @@ export interface IBreakpointData {
export interface ISourceBreakpointData extends IBreakpointData { export interface ISourceBreakpointData extends IBreakpointData {
type: 'source'; type: 'source';
uri: URI; uri: UriComponents;
line: number; line: number;
character: number; character: number;
} }
...@@ -708,8 +709,8 @@ export interface IBreakpointsDelta { ...@@ -708,8 +709,8 @@ export interface IBreakpointsDelta {
} }
export interface ExtHostDebugServiceShape { export interface ExtHostDebugServiceShape {
$resolveDebugConfiguration(handle: number, folder: URI | undefined, debugConfiguration: any): TPromise<any>; $resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig): TPromise<IConfig>;
$provideDebugConfigurations(handle: number, folder: URI | undefined): TPromise<any[]>; $provideDebugConfigurations(handle: number, folder: UriComponents | undefined): TPromise<IConfig[]>;
$acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void; $acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void;
$acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void; $acceptDebugSessionTerminated(id: DebugSessionUUID, type: string, name: string): void;
$acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void; $acceptDebugSessionActiveChanged(id: DebugSessionUUID | undefined, type?: string, name?: string): void;
...@@ -733,7 +734,7 @@ export interface ExtHostWindowShape { ...@@ -733,7 +734,7 @@ export interface ExtHostWindowShape {
export const MainContext = { export const MainContext = {
MainThreadCommands: <ProxyIdentifier<MainThreadCommandsShape>>createMainId<MainThreadCommandsShape>('MainThreadCommands'), MainThreadCommands: <ProxyIdentifier<MainThreadCommandsShape>>createMainId<MainThreadCommandsShape>('MainThreadCommands'),
MainThreadConfiguration: createMainId<MainThreadConfigurationShape>('MainThreadConfiguration', ProxyType.CustomMarshaller), MainThreadConfiguration: createMainId<MainThreadConfigurationShape>('MainThreadConfiguration', ProxyType.CustomMarshaller),
MainThreadDebugService: createMainId<MainThreadDebugServiceShape>('MainThreadDebugService', ProxyType.CustomMarshaller), MainThreadDebugService: createMainId<MainThreadDebugServiceShape>('MainThreadDebugService'),
MainThreadDecorations: createMainId<MainThreadDecorationsShape>('MainThreadDecorations'), MainThreadDecorations: createMainId<MainThreadDecorationsShape>('MainThreadDecorations'),
MainThreadDiagnostics: createMainId<MainThreadDiagnosticsShape>('MainThreadDiagnostics'), MainThreadDiagnostics: createMainId<MainThreadDiagnosticsShape>('MainThreadDiagnostics'),
MainThreadDialogs: createMainId<MainThreadDiaglogsShape>('MainThreadDiaglogs'), MainThreadDialogs: createMainId<MainThreadDiaglogsShape>('MainThreadDiaglogs'),
...@@ -764,7 +765,7 @@ export const ExtHostContext = { ...@@ -764,7 +765,7 @@ export const ExtHostContext = {
ExtHostCommands: createExtId<ExtHostCommandsShape>('ExtHostCommands'), ExtHostCommands: createExtId<ExtHostCommandsShape>('ExtHostCommands'),
ExtHostConfiguration: createExtId<ExtHostConfigurationShape>('ExtHostConfiguration', ProxyType.CustomMarshaller), ExtHostConfiguration: createExtId<ExtHostConfigurationShape>('ExtHostConfiguration', ProxyType.CustomMarshaller),
ExtHostDiagnostics: createExtId<ExtHostDiagnosticsShape>('ExtHostDiagnostics'), ExtHostDiagnostics: createExtId<ExtHostDiagnosticsShape>('ExtHostDiagnostics'),
ExtHostDebugService: createExtId<ExtHostDebugServiceShape>('ExtHostDebugService', ProxyType.CustomMarshaller), ExtHostDebugService: createExtId<ExtHostDebugServiceShape>('ExtHostDebugService'),
ExtHostDecorations: createExtId<ExtHostDecorationsShape>('ExtHostDecorations'), ExtHostDecorations: createExtId<ExtHostDecorationsShape>('ExtHostDecorations'),
ExtHostDocumentsAndEditors: createExtId<ExtHostDocumentsAndEditorsShape>('ExtHostDocumentsAndEditors'), ExtHostDocumentsAndEditors: createExtId<ExtHostDocumentsAndEditorsShape>('ExtHostDocumentsAndEditors'),
ExtHostDocuments: createExtId<ExtHostDocumentsShape>('ExtHostDocuments'), ExtHostDocuments: createExtId<ExtHostDocumentsShape>('ExtHostDocuments'),
......
...@@ -11,7 +11,7 @@ import { MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, Deb ...@@ -11,7 +11,7 @@ import { MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, Deb
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace'; import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import URI from 'vs/base/common/uri'; import URI, { UriComponents } from 'vs/base/common/uri';
import { Disposable, Position, Location, SourceBreakpoint, FunctionBreakpoint } from 'vs/workbench/api/node/extHostTypes'; import { Disposable, Position, Location, SourceBreakpoint, FunctionBreakpoint } from 'vs/workbench/api/node/extHostTypes';
...@@ -138,7 +138,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -138,7 +138,8 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (bp.type === 'function') { if (bp.type === 'function') {
return new FunctionBreakpoint(bp.enabled, bp.condition, bp.hitCondition, bp.functionName); return new FunctionBreakpoint(bp.enabled, bp.condition, bp.hitCondition, bp.functionName);
} }
return new SourceBreakpoint(bp.enabled, bp.condition, bp.hitCondition, new Location(bp.uri, new Position(bp.line, bp.character))); const uri = URI.revive(bp.uri);
return new SourceBreakpoint(bp.enabled, bp.condition, bp.hitCondition, new Location(uri, new Position(bp.line, bp.character)));
} }
public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable { public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable {
...@@ -156,7 +157,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -156,7 +157,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}); });
} }
public $provideDebugConfigurations(handle: number, folderUri: URI | undefined): TPromise<vscode.DebugConfiguration[]> { public $provideDebugConfigurations(handle: number, folderUri: UriComponents | undefined): TPromise<vscode.DebugConfiguration[]> {
let handler = this._handlers.get(handle); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('no handler found')); return TPromise.wrapError<vscode.DebugConfiguration[]>(new Error('no handler found'));
...@@ -167,7 +168,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -167,7 +168,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return asWinJsPromise(token => handler.provideDebugConfigurations(this.getFolder(folderUri), token)); return asWinJsPromise(token => handler.provideDebugConfigurations(this.getFolder(folderUri), token));
} }
public $resolveDebugConfiguration(handle: number, folderUri: URI | undefined, debugConfiguration: vscode.DebugConfiguration): TPromise<vscode.DebugConfiguration> { public $resolveDebugConfiguration(handle: number, folderUri: UriComponents | undefined, debugConfiguration: vscode.DebugConfiguration): TPromise<vscode.DebugConfiguration> {
let handler = this._handlers.get(handle); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<vscode.DebugConfiguration>(new Error('no handler found')); return TPromise.wrapError<vscode.DebugConfiguration>(new Error('no handler found'));
...@@ -232,10 +233,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { ...@@ -232,10 +233,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
this._onDidReceiveDebugSessionCustomEvent.fire(ee); this._onDidReceiveDebugSessionCustomEvent.fire(ee);
} }
private getFolder(folderUri: URI | undefined) { private getFolder(_folderUri: UriComponents | undefined) {
if (folderUri) { if (_folderUri) {
const folderUriString = URI.revive(_folderUri).toString();
const folders = this._workspace.getWorkspaceFolders(); const folders = this._workspace.getWorkspaceFolders();
const found = folders.filter(f => f.uri.toString() === folderUri.toString()); const found = folders.filter(f => f.uri.toString() === folderUriString);
if (found && found.length > 0) { if (found && found.length > 0) {
return found[0]; return found[0];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册