mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -9,12 +9,12 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID, IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { MainContext, MainThreadDebugServiceShape, ExtHostDebugServiceShape, DebugSessionUUID, IMainContext, IBreakpointsDelta, ISourceBreakpointData, IFunctionBreakpointData } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import * as types from 'vs/workbench/api/node/extHostTypes';
|
||||
import { Disposable, Position, Location, SourceBreakpoint, FunctionBreakpoint } from 'vs/workbench/api/node/extHostTypes';
|
||||
|
||||
|
||||
export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
@@ -42,8 +42,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
private _onDidReceiveDebugSessionCustomEvent: Emitter<vscode.DebugSessionCustomEvent>;
|
||||
get onDidReceiveDebugSessionCustomEvent(): Event<vscode.DebugSessionCustomEvent> { return this._onDidReceiveDebugSessionCustomEvent.event; }
|
||||
|
||||
private _debugConsole: ExtHostDebugConsole;
|
||||
get debugConsole(): ExtHostDebugConsole { return this._debugConsole; }
|
||||
private _activeDebugConsole: ExtHostDebugConsole;
|
||||
get activeDebugConsole(): ExtHostDebugConsole { return this._activeDebugConsole; }
|
||||
|
||||
private _breakpoints: Map<string, vscode.Breakpoint>;
|
||||
private _breakpointEventsActive: boolean;
|
||||
|
||||
private _onDidChangeBreakpoints: Emitter<vscode.BreakpointsChangeEvent>;
|
||||
|
||||
|
||||
constructor(mainContext: IMainContext, workspace: ExtHostWorkspace) {
|
||||
@@ -60,19 +65,94 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
|
||||
this._debugServiceProxy = mainContext.get(MainContext.MainThreadDebugService);
|
||||
|
||||
this._debugConsole = new ExtHostDebugConsole(this._debugServiceProxy);
|
||||
this._onDidChangeBreakpoints = new Emitter<vscode.BreakpointsChangeEvent>({
|
||||
onFirstListenerAdd: () => {
|
||||
this.startBreakpoints();
|
||||
}
|
||||
});
|
||||
|
||||
this._activeDebugConsole = new ExtHostDebugConsole(this._debugServiceProxy);
|
||||
|
||||
this._breakpoints = new Map<string, vscode.Breakpoint>();
|
||||
this._breakpointEventsActive = false;
|
||||
}
|
||||
|
||||
private startBreakpoints() {
|
||||
if (!this._breakpointEventsActive) {
|
||||
this._breakpointEventsActive = true;
|
||||
this._debugServiceProxy.$startBreakpointEvents();
|
||||
}
|
||||
}
|
||||
|
||||
get onDidChangeBreakpoints(): Event<vscode.BreakpointsChangeEvent> {
|
||||
return this._onDidChangeBreakpoints.event;
|
||||
}
|
||||
|
||||
get breakpoints(): vscode.Breakpoint[] {
|
||||
|
||||
this.startBreakpoints();
|
||||
|
||||
const result: vscode.Breakpoint[] = [];
|
||||
this._breakpoints.forEach(bp => result.push(bp));
|
||||
return result;
|
||||
}
|
||||
|
||||
public $acceptBreakpointsDelta(delta: IBreakpointsDelta): void {
|
||||
|
||||
let a: vscode.Breakpoint[] = [];
|
||||
let r: vscode.Breakpoint[] = [];
|
||||
let c: vscode.Breakpoint[] = [];
|
||||
|
||||
if (delta.added) {
|
||||
a = delta.added.map(bpd => {
|
||||
const bp = this.fromWire(bpd);
|
||||
this._breakpoints.set(bpd.id, bp);
|
||||
return bp;
|
||||
});
|
||||
}
|
||||
|
||||
if (delta.removed) {
|
||||
r = delta.removed.map(id => {
|
||||
const bp = this._breakpoints.get(id);
|
||||
if (bp) {
|
||||
this._breakpoints.delete(id);
|
||||
}
|
||||
return bp;
|
||||
});
|
||||
}
|
||||
|
||||
if (delta.changed) {
|
||||
c = delta.changed.map(bpd => {
|
||||
const bp = this.fromWire(bpd);
|
||||
this._breakpoints.set(bpd.id, bp);
|
||||
return bp;
|
||||
});
|
||||
}
|
||||
|
||||
this._onDidChangeBreakpoints.fire(Object.freeze({
|
||||
added: Object.freeze<vscode.Breakpoint[]>(a || []),
|
||||
removed: Object.freeze<vscode.Breakpoint[]>(r || []),
|
||||
changed: Object.freeze<vscode.Breakpoint[]>(c || [])
|
||||
}));
|
||||
}
|
||||
|
||||
private fromWire(bp: ISourceBreakpointData | IFunctionBreakpointData): vscode.Breakpoint {
|
||||
if (bp.type === 'function') {
|
||||
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)));
|
||||
}
|
||||
|
||||
public registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable {
|
||||
if (!provider) {
|
||||
return new types.Disposable(() => { });
|
||||
return new Disposable(() => { });
|
||||
}
|
||||
|
||||
let handle = this.nextHandle();
|
||||
this._handlers.set(handle, provider);
|
||||
this._debugServiceProxy.$registerDebugConfigurationProvider(type, !!provider.provideDebugConfigurations, !!provider.resolveDebugConfiguration, handle);
|
||||
|
||||
return new types.Disposable(() => {
|
||||
return new Disposable(() => {
|
||||
this._handlers.delete(handle);
|
||||
this._debugServiceProxy.$unregisterDebugConfigurationProvider(handle);
|
||||
});
|
||||
@@ -89,7 +169,6 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
return asWinJsPromise(token => handler.provideDebugConfigurations(this.getFolder(folderUri), token));
|
||||
}
|
||||
|
||||
|
||||
public $resolveDebugConfiguration(handle: number, folderUri: URI | undefined, debugConfiguration: vscode.DebugConfiguration): TPromise<vscode.DebugConfiguration> {
|
||||
let handler = this._handlers.get(handle);
|
||||
if (!handler) {
|
||||
|
||||
Reference in New Issue
Block a user