提交 33697437 编写于 作者: I isidor

debug: use TPromise, not Promise

上级 e23b397a
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import errors = require('vs/base/common/errors'); import errors = require('vs/base/common/errors');
import { Promise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import dom = require('vs/base/browser/dom'); import dom = require('vs/base/browser/dom');
import { IAction } from 'vs/base/common/actions'; import { IAction } from 'vs/base/common/actions';
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
...@@ -61,7 +61,7 @@ export class SelectConfigActionItem extends BaseActionItem { ...@@ -61,7 +61,7 @@ export class SelectConfigActionItem extends BaseActionItem {
} }
} }
private setOptions(): Promise { private setOptions(): TPromise<any> {
let previousSelectedIndex = this.select.selectedIndex; let previousSelectedIndex = this.select.selectedIndex;
this.select.options.length = 0; this.select.options.length = 0;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls'); import nls = require('vs/nls');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import { CommonKeybindings } from 'vs/base/common/keyCodes'; import { CommonKeybindings } from 'vs/base/common/keyCodes';
import paths = require('vs/base/common/paths'); import paths = require('vs/base/common/paths');
...@@ -193,7 +193,7 @@ export class CallStackDataSource implements tree.IDataSource { ...@@ -193,7 +193,7 @@ export class CallStackDataSource implements tree.IDataSource {
return element instanceof model.Model || element instanceof model.Thread; return element instanceof model.Model || element instanceof model.Thread;
} }
public getChildren(tree: tree.ITree, element: any): Promise { public getChildren(tree: tree.ITree, element: any): TPromise<any> {
if (element instanceof model.Thread) { if (element instanceof model.Thread) {
return TPromise.as((<model.Thread> element).callStack); return TPromise.as((<model.Thread> element).callStack);
} }
...@@ -211,7 +211,7 @@ export class CallStackDataSource implements tree.IDataSource { ...@@ -211,7 +211,7 @@ export class CallStackDataSource implements tree.IDataSource {
} }
} }
public getParent(tree: tree.ITree, element: any): Promise { public getParent(tree: tree.ITree, element: any): TPromise<any> {
return TPromise.as(null); return TPromise.as(null);
} }
} }
...@@ -335,7 +335,7 @@ export class VariablesActionProvider implements renderer.IActionProvider { ...@@ -335,7 +335,7 @@ export class VariablesActionProvider implements renderer.IActionProvider {
return element instanceof model.Variable; return element instanceof model.Variable;
} }
public getSecondaryActions(tree: tree.ITree, element: any): Promise { public getSecondaryActions(tree: tree.ITree, element: any): TPromise<actions.IAction[]> {
let actions: actions.Action[] = []; let actions: actions.Action[] = [];
const variable = <model.Variable> element; const variable = <model.Variable> element;
actions.push(this.instantiationService.createInstance(debugactions.AddToWatchExpressionsAction, debugactions.AddToWatchExpressionsAction.ID, debugactions.AddToWatchExpressionsAction.LABEL, variable)); actions.push(this.instantiationService.createInstance(debugactions.AddToWatchExpressionsAction, debugactions.AddToWatchExpressionsAction.ID, debugactions.AddToWatchExpressionsAction.LABEL, variable));
...@@ -370,7 +370,7 @@ export class VariablesDataSource implements tree.IDataSource { ...@@ -370,7 +370,7 @@ export class VariablesDataSource implements tree.IDataSource {
return variable.reference !== 0 && !strings.equalsIgnoreCase(variable.value, 'null'); return variable.reference !== 0 && !strings.equalsIgnoreCase(variable.value, 'null');
} }
public getChildren(tree: tree.ITree, element: any): Promise { public getChildren(tree: tree.ITree, element: any): TPromise<any> {
if (element instanceof viewmodel.ViewModel) { if (element instanceof viewmodel.ViewModel) {
let focusedStackFrame = (<viewmodel.ViewModel> element).getFocusedStackFrame(); let focusedStackFrame = (<viewmodel.ViewModel> element).getFocusedStackFrame();
return focusedStackFrame ? focusedStackFrame.getScopes(this.debugService) : TPromise.as([]); return focusedStackFrame ? focusedStackFrame.getScopes(this.debugService) : TPromise.as([]);
...@@ -380,7 +380,7 @@ export class VariablesDataSource implements tree.IDataSource { ...@@ -380,7 +380,7 @@ export class VariablesDataSource implements tree.IDataSource {
return scope.getChildren(this.debugService); return scope.getChildren(this.debugService);
} }
public getParent(tree: tree.ITree, element: any): Promise { public getParent(tree: tree.ITree, element: any): TPromise<any> {
return TPromise.as(null); return TPromise.as(null);
} }
} }
...@@ -484,7 +484,7 @@ export class WatchExpressionsActionProvider implements renderer.IActionProvider ...@@ -484,7 +484,7 @@ export class WatchExpressionsActionProvider implements renderer.IActionProvider
return true; return true;
} }
public getActions(tree: tree.ITree, element: any): Promise { public getActions(tree: tree.ITree, element: any): TPromise<actions.IAction[]> {
return TPromise.as(this.getExpressionActions()); return TPromise.as(this.getExpressionActions());
} }
...@@ -492,7 +492,7 @@ export class WatchExpressionsActionProvider implements renderer.IActionProvider ...@@ -492,7 +492,7 @@ export class WatchExpressionsActionProvider implements renderer.IActionProvider
return [this.instantiationService.createInstance(debugactions.RemoveWatchExpressionAction, debugactions.RemoveWatchExpressionAction.ID, debugactions.RemoveWatchExpressionAction.LABEL)]; return [this.instantiationService.createInstance(debugactions.RemoveWatchExpressionAction, debugactions.RemoveWatchExpressionAction.ID, debugactions.RemoveWatchExpressionAction.LABEL)];
} }
public getSecondaryActions(tree: tree.ITree, element: any): Promise { public getSecondaryActions(tree: tree.ITree, element: any): TPromise<actions.IAction[]> {
const actions: actions.Action[] = []; const actions: actions.Action[] = [];
if (element instanceof model.Expression) { if (element instanceof model.Expression) {
const expression = <model.Expression> element; const expression = <model.Expression> element;
...@@ -544,7 +544,7 @@ export class WatchExpressionsDataSource implements tree.IDataSource { ...@@ -544,7 +544,7 @@ export class WatchExpressionsDataSource implements tree.IDataSource {
return watchExpression.reference !== 0 && !strings.equalsIgnoreCase(watchExpression.value, 'null'); return watchExpression.reference !== 0 && !strings.equalsIgnoreCase(watchExpression.value, 'null');
} }
public getChildren(tree: tree.ITree, element: any): Promise { public getChildren(tree: tree.ITree, element: any): TPromise<any> {
if (element instanceof model.Model) { if (element instanceof model.Model) {
return TPromise.as((<model.Model> element).getWatchExpressions()); return TPromise.as((<model.Model> element).getWatchExpressions());
} }
...@@ -553,7 +553,7 @@ export class WatchExpressionsDataSource implements tree.IDataSource { ...@@ -553,7 +553,7 @@ export class WatchExpressionsDataSource implements tree.IDataSource {
return expression.getChildren(this.debugService); return expression.getChildren(this.debugService);
} }
public getParent(tree: tree.ITree, element: any): Promise { public getParent(tree: tree.ITree, element: any): TPromise<any> {
return TPromise.as(null); return TPromise.as(null);
} }
} }
...@@ -765,14 +765,14 @@ export class BreakpointsDataSource implements tree.IDataSource { ...@@ -765,14 +765,14 @@ export class BreakpointsDataSource implements tree.IDataSource {
return element instanceof model.Model; return element instanceof model.Model;
} }
public getChildren(tree: tree.ITree, element: any): Promise { public getChildren(tree: tree.ITree, element: any): TPromise<any> {
const model = <model.Model> element; const model = <model.Model> element;
const exBreakpoints = <debug.IEnablement[]> model.getExceptionBreakpoints(); const exBreakpoints = <debug.IEnablement[]> model.getExceptionBreakpoints();
return TPromise.as(exBreakpoints.concat(model.getFunctionBreakpoints()).concat(model.getBreakpoints())); return TPromise.as(exBreakpoints.concat(model.getFunctionBreakpoints()).concat(model.getBreakpoints()));
} }
public getParent(tree: tree.ITree, element: any): Promise { public getParent(tree: tree.ITree, element: any): TPromise<any> {
return TPromise.as(null); return TPromise.as(null);
} }
} }
......
...@@ -7,7 +7,7 @@ import 'vs/css!./media/debugViewlet'; ...@@ -7,7 +7,7 @@ import 'vs/css!./media/debugViewlet';
import nls = require('vs/nls'); import nls = require('vs/nls');
import dom = require('vs/base/browser/dom'); import dom = require('vs/base/browser/dom');
import builder = require('vs/base/browser/builder'); import builder = require('vs/base/browser/builder');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import errors = require('vs/base/common/errors'); import errors = require('vs/base/common/errors');
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import events = require('vs/base/common/events'); import events = require('vs/base/common/events');
...@@ -487,9 +487,9 @@ export class DebugViewlet extends viewlet.Viewlet { ...@@ -487,9 +487,9 @@ export class DebugViewlet extends viewlet.Viewlet {
return TPromise.as(null); return TPromise.as(null);
} }
public setVisible(visible: boolean): TPromise<void> { public setVisible(visible: boolean): TPromise<any> {
return super.setVisible(visible).then(() => { return super.setVisible(visible).then(() => {
return Promise.join(this.views.map((view) => view.setVisible(visible))); return TPromise.join(this.views.map((view) => view.setVisible(visible)));
}); });
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'vs/css!./media/repl'; import 'vs/css!./media/repl';
import nls = require('vs/nls'); import nls = require('vs/nls');
import { TPromise, Promise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import errors = require('vs/base/common/errors'); import errors = require('vs/base/common/errors');
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import actions = require('vs/base/common/actions'); import actions = require('vs/base/common/actions');
...@@ -155,7 +155,7 @@ export class Repl extends Panel { ...@@ -155,7 +155,7 @@ export class Repl extends Panel {
this.replInput.focus(); this.replInput.focus();
} }
public reveal(element: debug.ITreeElement): Promise { public reveal(element: debug.ITreeElement): TPromise<void> {
return this.tree.reveal(element); return this.tree.reveal(element);
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls'); import nls = require('vs/nls');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import actions = require('vs/base/common/actions'); import actions = require('vs/base/common/actions');
import strings = require('vs/base/common/strings'); import strings = require('vs/base/common/strings');
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
...@@ -47,7 +47,7 @@ export class ReplExpressionsDataSource implements tree.IDataSource { ...@@ -47,7 +47,7 @@ export class ReplExpressionsDataSource implements tree.IDataSource {
return element instanceof model.Model || element.reference > 0 || (element instanceof model.KeyValueOutputElement && element.getChildren().length > 0); return element instanceof model.Model || element.reference > 0 || (element instanceof model.KeyValueOutputElement && element.getChildren().length > 0);
} }
public getChildren(tree: tree.ITree, element: any): Promise { public getChildren(tree: tree.ITree, element: any): TPromise<any> {
if (element instanceof model.Model) { if (element instanceof model.Model) {
return TPromise.as(element.getReplElements()); return TPromise.as(element.getReplElements());
} }
...@@ -61,7 +61,7 @@ export class ReplExpressionsDataSource implements tree.IDataSource { ...@@ -61,7 +61,7 @@ export class ReplExpressionsDataSource implements tree.IDataSource {
return (<debug.IExpression> element).getChildren(this.debugService); return (<debug.IExpression> element).getChildren(this.debugService);
} }
public getParent(tree: tree.ITree, element: any): Promise { public getParent(tree: tree.ITree, element: any): TPromise<any> {
return TPromise.as(null); return TPromise.as(null);
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import uri from 'vs/base/common/uri'; import uri from 'vs/base/common/uri';
import { TPromise, Promise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import ee = require('vs/base/common/eventEmitter'); import ee = require('vs/base/common/eventEmitter');
import severity from 'vs/base/common/severity'; import severity from 'vs/base/common/severity';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
...@@ -223,26 +223,26 @@ export interface IDebugService extends ee.IEventEmitter { ...@@ -223,26 +223,26 @@ export interface IDebugService extends ee.IEventEmitter {
canSetBreakpointsIn(model: editor.IModel, lineNumber: number): boolean; canSetBreakpointsIn(model: editor.IModel, lineNumber: number): boolean;
getConfigurationName(): string; getConfigurationName(): string;
setConfiguration(name: string): Promise; setConfiguration(name: string): TPromise<void>;
openConfigFile(sideBySide: boolean): TPromise<boolean>; openConfigFile(sideBySide: boolean): TPromise<boolean>;
loadLaunchConfig(): TPromise<IGlobalConfig>; loadLaunchConfig(): TPromise<IGlobalConfig>;
setFocusedStackFrameAndEvaluate(focusedStackFrame: IStackFrame): void; setFocusedStackFrameAndEvaluate(focusedStackFrame: IStackFrame): void;
setBreakpointsForModel(modelUri: uri, data: IRawBreakpoint[]): Promise; setBreakpointsForModel(modelUri: uri, data: IRawBreakpoint[]): TPromise<void>;
toggleBreakpoint(IRawBreakpoint): Promise; toggleBreakpoint(IRawBreakpoint): TPromise<void>;
enableOrDisableAllBreakpoints(enabled: boolean): Promise; enableOrDisableAllBreakpoints(enabled: boolean): TPromise<void>;
toggleEnablement(element: IEnablement): Promise; toggleEnablement(element: IEnablement): TPromise<void>;
toggleBreakpointsActivated(): Promise; toggleBreakpointsActivated(): TPromise<void>;
removeAllBreakpoints(): Promise; removeAllBreakpoints(): TPromise<any>;
sendAllBreakpoints(): Promise; sendAllBreakpoints(): TPromise<any>;
editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): Promise; editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): TPromise<void>;
addFunctionBreakpoint(functionName?: string): Promise; addFunctionBreakpoint(functionName?: string): TPromise<void>;
renameFunctionBreakpoint(id: string, newFunctionName: string): Promise; renameFunctionBreakpoint(id: string, newFunctionName: string): TPromise<void>;
removeFunctionBreakpoints(id?: string): Promise; removeFunctionBreakpoints(id?: string): TPromise<void>;
addReplExpression(name: string): Promise; addReplExpression(name: string): TPromise<void>;
clearReplExpressions(): void; clearReplExpressions(): void;
logToRepl(value: string, severity?: severity): void; logToRepl(value: string, severity?: severity): void;
...@@ -250,20 +250,20 @@ export interface IDebugService extends ee.IEventEmitter { ...@@ -250,20 +250,20 @@ export interface IDebugService extends ee.IEventEmitter {
appendReplOutput(value: string, severity?: severity): void; appendReplOutput(value: string, severity?: severity): void;
addWatchExpression(name?: string): Promise; addWatchExpression(name?: string): TPromise<void>;
renameWatchExpression(id: string, newName: string): Promise; renameWatchExpression(id: string, newName: string): TPromise<void>;
clearWatchExpressions(id?: string): void; clearWatchExpressions(id?: string): void;
createSession(): Promise; createSession(): TPromise<any>;
restartSession(): Promise; restartSession(): TPromise<any>;
rawAttach(port: number): Promise; rawAttach(port: number): TPromise<any>;
getActiveSession(): IRawDebugSession; getActiveSession(): IRawDebugSession;
getModel(): IModel; getModel(): IModel;
getViewModel(): IViewModel; getViewModel(): IViewModel;
openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): Promise; openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any>;
revealRepl(inBackground?:boolean): Promise; revealRepl(inBackground?:boolean): TPromise<void>;
} }
// utils // utils
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls'); import nls = require('vs/nls');
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import ee = require('vs/base/common/eventEmitter'); import ee = require('vs/base/common/eventEmitter');
...@@ -464,7 +464,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { ...@@ -464,7 +464,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return this.replElements; return this.replElements;
} }
public addReplExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, name: string): Promise { public addReplExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, name: string): TPromise<void> {
const expression = new Expression(name, true); const expression = new Expression(name, true);
this.replElements.push(expression); this.replElements.push(expression);
return evaluateExpression(session, stackFrame, expression, 'repl').then(() => return evaluateExpression(session, stackFrame, expression, 'repl').then(() =>
...@@ -533,7 +533,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { ...@@ -533,7 +533,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return this.watchExpressions; return this.watchExpressions;
} }
public addWatchExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, name: string): Promise { public addWatchExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, name: string): TPromise<void> {
const we = new Expression(name, false); const we = new Expression(name, false);
this.watchExpressions.push(we); this.watchExpressions.push(we);
if (!name) { if (!name) {
...@@ -544,7 +544,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { ...@@ -544,7 +544,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return this.evaluateWatchExpressions(session, stackFrame, we.getId()); return this.evaluateWatchExpressions(session, stackFrame, we.getId());
} }
public renameWatchExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, id: string, newName: string): Promise { public renameWatchExpression(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, id: string, newName: string): TPromise<void> {
const filtered = this.watchExpressions.filter(we => we.getId() === id); const filtered = this.watchExpressions.filter(we => we.getId() === id);
if (filtered.length === 1) { if (filtered.length === 1) {
filtered[0].name = newName; filtered[0].name = newName;
...@@ -556,7 +556,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { ...@@ -556,7 +556,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return TPromise.as(null); return TPromise.as(null);
} }
public evaluateWatchExpressions(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, id: string = null): Promise { public evaluateWatchExpressions(session: debug.IRawDebugSession, stackFrame: debug.IStackFrame, id: string = null): TPromise<void> {
if (id) { if (id) {
const filtered = this.watchExpressions.filter(we => we.getId() === id); const filtered = this.watchExpressions.filter(we => we.getId() === id);
if (filtered.length !== 1) { if (filtered.length !== 1) {
...@@ -568,7 +568,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { ...@@ -568,7 +568,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
}); });
} }
return Promise.join(this.watchExpressions.map(we => evaluateExpression(session, stackFrame, we, 'watch'))).then(() => { return TPromise.join(this.watchExpressions.map(we => evaluateExpression(session, stackFrame, we, 'watch'))).then(() => {
this.emit(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED); this.emit(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED);
}); });
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import nls = require('vs/nls'); import nls = require('vs/nls');
import actions = require('vs/base/common/actions'); import actions = require('vs/base/common/actions');
import lifecycle = require('vs/base/common/lifecycle'); import lifecycle = require('vs/base/common/lifecycle');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import editorCommon = require('vs/editor/common/editorCommon'); import editorCommon = require('vs/editor/common/editorCommon');
import editorbrowser = require('vs/editor/browser/editorBrowser'); import editorbrowser = require('vs/editor/browser/editorBrowser');
import { EditorAction, Behaviour } from 'vs/editor/common/editorAction'; import { EditorAction, Behaviour } from 'vs/editor/common/editorAction';
...@@ -48,7 +48,7 @@ export class AbstractDebugAction extends actions.Action { ...@@ -48,7 +48,7 @@ export class AbstractDebugAction extends actions.Action {
this.updateEnablement(); this.updateEnablement();
} }
public run(e?: any): Promise { public run(e?: any): TPromise<any> {
throw new Error('implement me'); throw new Error('implement me');
} }
...@@ -76,7 +76,7 @@ export class ConfigureAction extends AbstractDebugAction { ...@@ -76,7 +76,7 @@ export class ConfigureAction extends AbstractDebugAction {
super(id, label, 'debug-action configure', debugService, keybindingService); super(id, label, 'debug-action configure', debugService, keybindingService);
} }
public run(event?: any): Promise { public run(event?: any): TPromise<any> {
const sideBySide = !!(event && (event.ctrlKey || event.metaKey)); const sideBySide = !!(event && (event.ctrlKey || event.metaKey));
return this.debugService.openConfigFile(sideBySide); return this.debugService.openConfigFile(sideBySide);
} }
...@@ -90,7 +90,7 @@ export class SelectConfigAction extends AbstractDebugAction { ...@@ -90,7 +90,7 @@ export class SelectConfigAction extends AbstractDebugAction {
super(id, label, 'debug-action select-active-config', debugService, keybindingService); super(id, label, 'debug-action select-active-config', debugService, keybindingService);
} }
public run(configName: string): Promise { public run(configName: string): TPromise<any> {
return this.debugService.setConfiguration(configName); return this.debugService.setConfiguration(configName);
} }
...@@ -108,7 +108,7 @@ export class StartDebugAction extends AbstractDebugAction { ...@@ -108,7 +108,7 @@ export class StartDebugAction extends AbstractDebugAction {
this.updateEnablement(); this.updateEnablement();
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.createSession(); return this.debugService.createSession();
} }
...@@ -133,7 +133,7 @@ export class RestartDebugAction extends AbstractDebugAction { ...@@ -133,7 +133,7 @@ export class RestartDebugAction extends AbstractDebugAction {
})); }));
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.restartSession(); return this.debugService.restartSession();
} }
...@@ -150,7 +150,7 @@ export class StepOverDebugAction extends AbstractDebugAction { ...@@ -150,7 +150,7 @@ export class StepOverDebugAction extends AbstractDebugAction {
super(id, label, 'debug-action step-over', debugService, keybindingService); super(id, label, 'debug-action step-over', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.getActiveSession().next({ threadId: this.debugService.getViewModel().getFocusedThreadId() }); return this.debugService.getActiveSession().next({ threadId: this.debugService.getViewModel().getFocusedThreadId() });
} }
...@@ -167,7 +167,7 @@ export class StepIntoDebugAction extends AbstractDebugAction { ...@@ -167,7 +167,7 @@ export class StepIntoDebugAction extends AbstractDebugAction {
super(id, label, 'debug-action step-into', debugService, keybindingService); super(id, label, 'debug-action step-into', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.getActiveSession().stepIn({ threadId: this.debugService.getViewModel().getFocusedThreadId() }); return this.debugService.getActiveSession().stepIn({ threadId: this.debugService.getViewModel().getFocusedThreadId() });
} }
...@@ -184,7 +184,7 @@ export class StepOutDebugAction extends AbstractDebugAction { ...@@ -184,7 +184,7 @@ export class StepOutDebugAction extends AbstractDebugAction {
super(id, label, 'debug-action step-out', debugService, keybindingService); super(id, label, 'debug-action step-out', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.getActiveSession().stepOut({ threadId: this.debugService.getViewModel().getFocusedThreadId() }); return this.debugService.getActiveSession().stepOut({ threadId: this.debugService.getViewModel().getFocusedThreadId() });
} }
...@@ -208,7 +208,7 @@ export class StopDebugAction extends AbstractDebugAction { ...@@ -208,7 +208,7 @@ export class StopDebugAction extends AbstractDebugAction {
})); }));
} }
public run(): Promise { public run(): TPromise<any> {
var session = this.debugService.getActiveSession(); var session = this.debugService.getActiveSession();
return session ? session.disconnect(false, true) : TPromise.as(null); return session ? session.disconnect(false, true) : TPromise.as(null);
} }
...@@ -226,7 +226,7 @@ export class ContinueAction extends AbstractDebugAction { ...@@ -226,7 +226,7 @@ export class ContinueAction extends AbstractDebugAction {
super(id, label, 'debug-action continue', debugService, keybindingService); super(id, label, 'debug-action continue', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.getActiveSession().continue({ threadId: this.debugService.getViewModel().getFocusedThreadId() }); return this.debugService.getActiveSession().continue({ threadId: this.debugService.getViewModel().getFocusedThreadId() });
} }
...@@ -243,7 +243,7 @@ export class PauseAction extends AbstractDebugAction { ...@@ -243,7 +243,7 @@ export class PauseAction extends AbstractDebugAction {
super(id, label, 'debug-action pause', debugService, keybindingService); super(id, label, 'debug-action pause', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.getActiveSession().pause({ threadId: this.debugService.getViewModel().getFocusedThreadId() }); return this.debugService.getActiveSession().pause({ threadId: this.debugService.getViewModel().getFocusedThreadId() });
} }
...@@ -261,7 +261,7 @@ export class RemoveBreakpointAction extends AbstractDebugAction { ...@@ -261,7 +261,7 @@ export class RemoveBreakpointAction extends AbstractDebugAction {
this.updateEnablement(); this.updateEnablement();
} }
public run(breakpoint: debug.IBreakpoint): Promise { public run(breakpoint: debug.IBreakpoint): TPromise<any> {
return breakpoint instanceof model.Breakpoint ? this.debugService.toggleBreakpoint({ uri: breakpoint.source.uri, lineNumber: breakpoint.lineNumber }) return breakpoint instanceof model.Breakpoint ? this.debugService.toggleBreakpoint({ uri: breakpoint.source.uri, lineNumber: breakpoint.lineNumber })
: this.debugService.removeFunctionBreakpoints(breakpoint.getId()); : this.debugService.removeFunctionBreakpoints(breakpoint.getId());
} }
...@@ -276,8 +276,8 @@ export class RemoveAllBreakpointsAction extends AbstractDebugAction { ...@@ -276,8 +276,8 @@ export class RemoveAllBreakpointsAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED,() => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED,() => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
return Promise.join([this.debugService.removeAllBreakpoints(), this.debugService.removeFunctionBreakpoints()]); return TPromise.join([this.debugService.removeAllBreakpoints(), this.debugService.removeFunctionBreakpoints()]);
} }
protected isEnabled(): boolean { protected isEnabled(): boolean {
...@@ -293,7 +293,7 @@ export class ToggleEnablementAction extends AbstractDebugAction { ...@@ -293,7 +293,7 @@ export class ToggleEnablementAction extends AbstractDebugAction {
super(id, label, 'debug-action toggle-enablement', debugService, keybindingService); super(id, label, 'debug-action toggle-enablement', debugService, keybindingService);
} }
public run(element: debug.IEnablement): Promise { public run(element: debug.IEnablement): TPromise<any> {
return this.debugService.toggleEnablement(element); return this.debugService.toggleEnablement(element);
} }
} }
...@@ -307,7 +307,7 @@ export class EnableAllBreakpointsAction extends AbstractDebugAction { ...@@ -307,7 +307,7 @@ export class EnableAllBreakpointsAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.enableOrDisableAllBreakpoints(true); return this.debugService.enableOrDisableAllBreakpoints(true);
} }
...@@ -326,7 +326,7 @@ export class DisableAllBreakpointsAction extends AbstractDebugAction { ...@@ -326,7 +326,7 @@ export class DisableAllBreakpointsAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.enableOrDisableAllBreakpoints(false); return this.debugService.enableOrDisableAllBreakpoints(false);
} }
...@@ -353,7 +353,7 @@ export class ToggleBreakpointsActivatedAction extends AbstractDebugAction { ...@@ -353,7 +353,7 @@ export class ToggleBreakpointsActivatedAction extends AbstractDebugAction {
this.label = this.debugService.getModel().areBreakpointsActivated() ? ToggleBreakpointsActivatedAction.DEACTIVATE_LABEL : ToggleBreakpointsActivatedAction.ACTIVATE_LABEL; this.label = this.debugService.getModel().areBreakpointsActivated() ? ToggleBreakpointsActivatedAction.DEACTIVATE_LABEL : ToggleBreakpointsActivatedAction.ACTIVATE_LABEL;
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.toggleBreakpointsActivated(); return this.debugService.toggleBreakpointsActivated();
} }
} }
...@@ -367,7 +367,7 @@ export class ReapplyBreakpointsAction extends AbstractDebugAction { ...@@ -367,7 +367,7 @@ export class ReapplyBreakpointsAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED, () => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.sendAllBreakpoints(); return this.debugService.sendAllBreakpoints();
} }
...@@ -384,7 +384,7 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction { ...@@ -384,7 +384,7 @@ export class AddFunctionBreakpointAction extends AbstractDebugAction {
super(id, label, 'debug-action add-function-breakpoint', debugService, keybindingService); super(id, label, 'debug-action add-function-breakpoint', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
this.debugService.addFunctionBreakpoint(); this.debugService.addFunctionBreakpoint();
return TPromise.as(null); return TPromise.as(null);
} }
...@@ -398,7 +398,7 @@ export class AddConditionalBreakpointAction extends AbstractDebugAction { ...@@ -398,7 +398,7 @@ export class AddConditionalBreakpointAction extends AbstractDebugAction {
super(id, label, null, debugService, keybindingService); super(id, label, null, debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.editBreakpoint(this.editor, this.lineNumber); return this.debugService.editBreakpoint(this.editor, this.lineNumber);
} }
} }
...@@ -411,7 +411,7 @@ export class EditConditionalBreakpointAction extends AbstractDebugAction { ...@@ -411,7 +411,7 @@ export class EditConditionalBreakpointAction extends AbstractDebugAction {
super(id, label, null, debugService, keybindingService); super(id, label, null, debugService, keybindingService);
} }
public run(breakpoint: debug.IBreakpoint): Promise { public run(breakpoint: debug.IBreakpoint): TPromise<any> {
return this.debugService.editBreakpoint(this.editor, this.lineNumber); return this.debugService.editBreakpoint(this.editor, this.lineNumber);
} }
} }
...@@ -423,7 +423,7 @@ export class ToggleBreakpointAction extends EditorAction { ...@@ -423,7 +423,7 @@ export class ToggleBreakpointAction extends EditorAction {
super(descriptor, editor, Behaviour.TextFocus); super(descriptor, editor, Behaviour.TextFocus);
} }
public run(): TPromise<boolean> { public run(): TPromise<any> {
if (this.debugService.getState() !== debug.State.Disabled) { if (this.debugService.getState() !== debug.State.Disabled) {
const lineNumber = this.editor.getPosition().lineNumber; const lineNumber = this.editor.getPosition().lineNumber;
const modelUrl = this.editor.getModel().getAssociatedResource(); const modelUrl = this.editor.getModel().getAssociatedResource();
...@@ -443,7 +443,7 @@ export class EditorConditionalBreakpointAction extends EditorAction { ...@@ -443,7 +443,7 @@ export class EditorConditionalBreakpointAction extends EditorAction {
super(descriptor, editor, Behaviour.TextFocus); super(descriptor, editor, Behaviour.TextFocus);
} }
public run(): TPromise<boolean> { public run(): TPromise<any> {
if (this.debugService.getState() !== debug.State.Disabled) { if (this.debugService.getState() !== debug.State.Disabled) {
const lineNumber = this.editor.getPosition().lineNumber; const lineNumber = this.editor.getPosition().lineNumber;
if (this.debugService.canSetBreakpointsIn(this.editor.getModel(), lineNumber)) { if (this.debugService.canSetBreakpointsIn(this.editor.getModel(), lineNumber)) {
...@@ -463,7 +463,7 @@ export class CopyValueAction extends AbstractDebugAction { ...@@ -463,7 +463,7 @@ export class CopyValueAction extends AbstractDebugAction {
super(id, label, 'debug-action copy-value', debugService, keybindingService); super(id, label, 'debug-action copy-value', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
if (this.value instanceof model.Variable) { if (this.value instanceof model.Variable) {
const frameId = this.debugService.getViewModel().getFocusedStackFrame().frameId; const frameId = this.debugService.getViewModel().getFocusedStackFrame().frameId;
const session = this.debugService.getActiveSession(); const session = this.debugService.getActiveSession();
...@@ -529,7 +529,7 @@ export class AddWatchExpressionAction extends AbstractDebugAction { ...@@ -529,7 +529,7 @@ export class AddWatchExpressionAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, () => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, () => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.addWatchExpression(); return this.debugService.addWatchExpression();
} }
...@@ -545,7 +545,7 @@ export class SelectionToWatchExpressionsAction extends EditorAction { ...@@ -545,7 +545,7 @@ export class SelectionToWatchExpressionsAction extends EditorAction {
super(descriptor, editor, Behaviour.TextFocus); super(descriptor, editor, Behaviour.TextFocus);
} }
public run(): TPromise<boolean> { public run(): TPromise<any> {
const text = this.editor.getModel().getValueInRange(this.editor.getSelection()); const text = this.editor.getModel().getValueInRange(this.editor.getSelection());
return this.viewletService.openViewlet(debug.VIEWLET_ID).then(() => this.debugService.addWatchExpression(text)); return this.viewletService.openViewlet(debug.VIEWLET_ID).then(() => this.debugService.addWatchExpression(text));
} }
...@@ -569,7 +569,7 @@ export class SelectionToReplAction extends EditorAction { ...@@ -569,7 +569,7 @@ export class SelectionToReplAction extends EditorAction {
super(descriptor, editor, Behaviour.TextFocus); super(descriptor, editor, Behaviour.TextFocus);
} }
public run(): TPromise<boolean> { public run(): TPromise<any> {
const text = this.editor.getModel().getValueInRange(this.editor.getSelection()); const text = this.editor.getModel().getValueInRange(this.editor.getSelection());
return this.debugService.addReplExpression(text).then(() => this.debugService.revealRepl()); return this.debugService.addReplExpression(text).then(() => this.debugService.revealRepl());
} }
...@@ -592,7 +592,7 @@ export class AddToWatchExpressionsAction extends AbstractDebugAction { ...@@ -592,7 +592,7 @@ export class AddToWatchExpressionsAction extends AbstractDebugAction {
super(id, label, 'debug-action add-to-watch', debugService, keybindingService); super(id, label, 'debug-action add-to-watch', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
return this.debugService.addWatchExpression(model.getFullExpressionName(this.expression, this.debugService.getActiveSession().getType())); return this.debugService.addWatchExpression(model.getFullExpressionName(this.expression, this.debugService.getActiveSession().getType()));
} }
} }
...@@ -605,7 +605,7 @@ export class RenameWatchExpressionAction extends AbstractDebugAction { ...@@ -605,7 +605,7 @@ export class RenameWatchExpressionAction extends AbstractDebugAction {
super(id, label, 'debug-action rename', debugService, keybindingService); super(id, label, 'debug-action rename', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
this.debugService.getViewModel().setSelectedExpression(this.expression); this.debugService.getViewModel().setSelectedExpression(this.expression);
return TPromise.as(null); return TPromise.as(null);
} }
...@@ -619,7 +619,7 @@ export class RemoveWatchExpressionAction extends AbstractDebugAction { ...@@ -619,7 +619,7 @@ export class RemoveWatchExpressionAction extends AbstractDebugAction {
super(id, label, 'debug-action remove', debugService, keybindingService); super(id, label, 'debug-action remove', debugService, keybindingService);
} }
public run(expression: model.Expression): Promise { public run(expression: model.Expression): TPromise<any> {
this.debugService.clearWatchExpressions(expression.getId()); this.debugService.clearWatchExpressions(expression.getId());
return TPromise.as(null); return TPromise.as(null);
} }
...@@ -634,7 +634,7 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction { ...@@ -634,7 +634,7 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, () => this.updateEnablement())); this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, () => this.updateEnablement()));
} }
public run(): Promise { public run(): TPromise<any> {
this.debugService.clearWatchExpressions(); this.debugService.clearWatchExpressions();
return TPromise.as(null); return TPromise.as(null);
} }
...@@ -652,7 +652,7 @@ export class ClearReplAction extends AbstractDebugAction { ...@@ -652,7 +652,7 @@ export class ClearReplAction extends AbstractDebugAction {
super(id, label, 'debug-action clear-repl', debugService, keybindingService); super(id, label, 'debug-action clear-repl', debugService, keybindingService);
} }
public run(): Promise { public run(): TPromise<any> {
this.debugService.clearReplExpressions(); this.debugService.clearReplExpressions();
// focus back to repl // focus back to repl
...@@ -674,7 +674,7 @@ export class ToggleReplAction extends AbstractDebugAction { ...@@ -674,7 +674,7 @@ export class ToggleReplAction extends AbstractDebugAction {
this.enabled = this.debugService.getState() !== debug.State.Disabled; this.enabled = this.debugService.getState() !== debug.State.Disabled;
} }
public run(): Promise { public run(): TPromise<any> {
const panel = this.panelService.getActivePanel(); const panel = this.panelService.getActivePanel();
if (panel && panel.getId() === debug.REPL_ID) { if (panel && panel.getId() === debug.REPL_ID) {
this.partService.setPanelHidden(true); this.partService.setPanelHidden(true);
......
...@@ -13,7 +13,7 @@ import arrays = require('vs/base/common/arrays'); ...@@ -13,7 +13,7 @@ import arrays = require('vs/base/common/arrays');
import types = require('vs/base/common/types'); import types = require('vs/base/common/types');
import errors = require('vs/base/common/errors'); import errors = require('vs/base/common/errors');
import severity from 'vs/base/common/severity'; import severity from 'vs/base/common/severity';
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import editor = require('vs/editor/common/editorCommon'); import editor = require('vs/editor/common/editorCommon');
import editorbrowser = require('vs/editor/browser/editorBrowser'); import editorbrowser = require('vs/editor/browser/editorBrowser');
import { IKeybindingService, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybindingService'; import { IKeybindingService, IKeybindingContextKey } from 'vs/platform/keybinding/common/keybindingService';
...@@ -302,8 +302,8 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -302,8 +302,8 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.revealRepl(true /* in background */).done(null, errors.onUnexpectedError); this.revealRepl(true /* in background */).done(null, errors.onUnexpectedError);
} }
private getThreadData(threadId: number): Promise { private getThreadData(threadId: number): TPromise<void> {
return this.model.getThreads()[threadId] ? TPromise.as(true) : return this.model.getThreads()[threadId] ? TPromise.as(undefined) :
this.session.threads().then((response: DebugProtocol.ThreadsResponse) => { this.session.threads().then((response: DebugProtocol.ThreadsResponse) => {
const thread = response.body.threads.filter(t => t.id === threadId).pop(); const thread = response.body.threads.filter(t => t.id === threadId).pop();
if (!thread) { if (!thread) {
...@@ -383,7 +383,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -383,7 +383,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
} }
} }
public setBreakpointsForModel(modelUri: uri, rawData: debug.IRawBreakpoint[]): Promise { public setBreakpointsForModel(modelUri: uri, rawData: debug.IRawBreakpoint[]): TPromise<void> {
this.model.removeBreakpoints( this.model.removeBreakpoints(
this.model.getBreakpoints().filter(bp => bp.source.uri.toString() === modelUri.toString())); this.model.getBreakpoints().filter(bp => bp.source.uri.toString() === modelUri.toString()));
this.model.addBreakpoints(rawData); this.model.addBreakpoints(rawData);
...@@ -391,7 +391,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -391,7 +391,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return this.sendBreakpoints(modelUri); return this.sendBreakpoints(modelUri);
} }
public toggleBreakpoint(rawBreakpoint: debug.IRawBreakpoint): Promise { public toggleBreakpoint(rawBreakpoint: debug.IRawBreakpoint): TPromise<void> {
const breakpoint = this.model.getBreakpoints().filter(bp => bp.lineNumber === rawBreakpoint.lineNumber && bp.source.uri.toString() === rawBreakpoint.uri.toString()).pop(); const breakpoint = this.model.getBreakpoints().filter(bp => bp.lineNumber === rawBreakpoint.lineNumber && bp.source.uri.toString() === rawBreakpoint.uri.toString()).pop();
if (breakpoint) { if (breakpoint) {
this.model.removeBreakpoints([breakpoint]); this.model.removeBreakpoints([breakpoint]);
...@@ -402,36 +402,37 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -402,36 +402,37 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return this.sendBreakpoints(rawBreakpoint.uri); return this.sendBreakpoints(rawBreakpoint.uri);
} }
public enableOrDisableAllBreakpoints(enabled: boolean): Promise { public enableOrDisableAllBreakpoints(enabled: boolean): TPromise<void>{
this.model.enableOrDisableAllBreakpoints(enabled); this.model.enableOrDisableAllBreakpoints(enabled);
return this.sendAllBreakpoints(); return this.sendAllBreakpoints();
} }
public toggleEnablement(element: debug.IEnablement): Promise { public toggleEnablement(element: debug.IEnablement): TPromise<void> {
this.model.toggleEnablement(element); this.model.toggleEnablement(element);
if (element instanceof model.Breakpoint) { if (element instanceof model.Breakpoint) {
const breakpoint = <model.Breakpoint> element; const breakpoint = <model.Breakpoint> element;
return this.sendBreakpoints(breakpoint.source.uri); return this.sendBreakpoints(breakpoint.source.uri);
} else if (element instanceof model.FunctionBreakpoint) { } else if (element instanceof model.FunctionBreakpoint) {
return TPromise.as(null);
// TODO@Isidor send function breakpoints and return // TODO@Isidor send function breakpoints and return
} }
return this.sendExceptionBreakpoints(); return this.sendExceptionBreakpoints();
} }
public removeAllBreakpoints(): Promise { public removeAllBreakpoints(): TPromise<any> {
const urisToClear = arrays.distinct(this.model.getBreakpoints(), bp => bp.source.uri.toString()).map(bp => bp.source.uri); const urisToClear = arrays.distinct(this.model.getBreakpoints(), bp => bp.source.uri.toString()).map(bp => bp.source.uri);
this.model.removeBreakpoints(this.model.getBreakpoints()); this.model.removeBreakpoints(this.model.getBreakpoints());
return Promise.join(urisToClear.map(uri => this.sendBreakpoints(uri))); return TPromise.join(urisToClear.map(uri => this.sendBreakpoints(uri)));
} }
public toggleBreakpointsActivated(): Promise { public toggleBreakpointsActivated(): TPromise<void> {
this.model.toggleBreakpointsActivated(); this.model.toggleBreakpointsActivated();
return this.sendAllBreakpoints(); return this.sendAllBreakpoints();
} }
public editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): Promise { public editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): TPromise<void> {
if (BreakpointWidget.INSTANCE) { if (BreakpointWidget.INSTANCE) {
BreakpointWidget.INSTANCE.dispose(); BreakpointWidget.INSTANCE.dispose();
} }
...@@ -439,28 +440,28 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -439,28 +440,28 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.instantiationService.createInstance(BreakpointWidget, editor, lineNumber); this.instantiationService.createInstance(BreakpointWidget, editor, lineNumber);
BreakpointWidget.INSTANCE.show({ lineNumber, column: 1 }, 2); BreakpointWidget.INSTANCE.show({ lineNumber, column: 1 }, 2);
return TPromise.as(true); return TPromise.as(null);
} }
public addFunctionBreakpoint(functionName?: string): Promise { public addFunctionBreakpoint(functionName?: string): TPromise<void> {
this.model.addFunctionBreakpoint(functionName); this.model.addFunctionBreakpoint(functionName);
// TODO@Isidor send updated function breakpoints // TODO@Isidor send updated function breakpoints
return TPromise.as(true); return TPromise.as(null);
} }
public renameFunctionBreakpoint(id: string, newFunctionName: string): Promise { public renameFunctionBreakpoint(id: string, newFunctionName: string): TPromise<void> {
this.model.renameFunctionBreakpoint(id, newFunctionName); this.model.renameFunctionBreakpoint(id, newFunctionName);
// TODO@Isidor send updated function breakpoints // TODO@Isidor send updated function breakpoints
return TPromise.as(true); return TPromise.as(null);
} }
public removeFunctionBreakpoints(id?: string): Promise { public removeFunctionBreakpoints(id?: string): TPromise<void> {
this.model.removeFunctionBreakpoints(id); this.model.removeFunctionBreakpoints(id);
// TODO@Isidor send updated function breakpoints // TODO@Isidor send updated function breakpoints
return TPromise.as(true); return TPromise.as(null);
} }
public addReplExpression(name: string): Promise { public addReplExpression(name: string): TPromise<void> {
return this.model.addReplExpression(this.session, this.viewModel.getFocusedStackFrame(), name); return this.model.addReplExpression(this.session, this.viewModel.getFocusedStackFrame(), name);
} }
...@@ -478,11 +479,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -478,11 +479,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.model.clearReplExpressions(); this.model.clearReplExpressions();
} }
public addWatchExpression(name: string): Promise { public addWatchExpression(name: string): TPromise<void> {
return this.model.addWatchExpression(this.session, this.viewModel.getFocusedStackFrame(), name); return this.model.addWatchExpression(this.session, this.viewModel.getFocusedStackFrame(), name);
} }
public renameWatchExpression(id: string, newName: string): Promise { public renameWatchExpression(id: string, newName: string): TPromise<void> {
return this.model.renameWatchExpression(this.session, this.viewModel.getFocusedStackFrame(), id, newName); return this.model.renameWatchExpression(this.session, this.viewModel.getFocusedStackFrame(), id, newName);
} }
...@@ -490,7 +491,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -490,7 +491,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.model.clearWatchExpressions(id); this.model.clearWatchExpressions(id);
} }
public createSession(openViewlet = true): Promise { public createSession(openViewlet = true): TPromise<any> {
this.textFileService.saveAll().done(null, errors.onUnexpectedError); this.textFileService.saveAll().done(null, errors.onUnexpectedError);
this.clearReplExpressions(); this.clearReplExpressions();
...@@ -505,7 +506,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -505,7 +506,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
} }
if (!this.configurationManager.getAdapter()) { if (!this.configurationManager.getAdapter()) {
this.emit(debug.ServiceEvents.TYPE_NOT_SUPPORTED, configuration.type); this.emit(debug.ServiceEvents.TYPE_NOT_SUPPORTED, configuration.type);
return Promise.wrapError(new Error(nls.localize('debugTypeNotSupported', "Configured debug type {0} is not supported.", configuration.type))); return TPromise.wrapError(new Error(nls.localize('debugTypeNotSupported', "Configured debug type {0} is not supported.", configuration.type)));
} }
return this.runPreLaunchTask(configuration.preLaunchTask).then(() => { return this.runPreLaunchTask(configuration.preLaunchTask).then(() => {
...@@ -526,7 +527,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -526,7 +527,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}); });
} }
private doCreateSession(configuration: debug.IConfig, openViewlet: boolean): Promise { private doCreateSession(configuration: debug.IConfig, openViewlet: boolean): TPromise<any> {
this.session = new session.RawDebugSession(this.messageService, this.telemetryService, configuration.debugServer, this.configurationManager.getAdapter()); this.session = new session.RawDebugSession(this.messageService, this.telemetryService, configuration.debugServer, this.configurationManager.getAdapter());
this.registerSessionListeners(); this.registerSessionListeners();
...@@ -537,7 +538,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -537,7 +538,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
columnsStartAt1: true columnsStartAt1: true
}).then((result: DebugProtocol.InitializeResponse) => { }).then((result: DebugProtocol.InitializeResponse) => {
if (!this.session) { if (!this.session) {
return Promise.wrapError(new Error(nls.localize('debugAdapterCrash', "Debug adapter process has terminated unexpectedly"))); return TPromise.wrapError(new Error(nls.localize('debugAdapterCrash', "Debug adapter process has terminated unexpectedly")));
} }
this.setStateAndEmit(debug.State.Initializing); this.setStateAndEmit(debug.State.Initializing);
...@@ -559,13 +560,13 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -559,13 +560,13 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this.session.disconnect(); this.session.disconnect();
} }
return Promise.wrapError(errors.create(error.message, { actions: [CloseAction, this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL)] })); return TPromise.wrapError(errors.create(error.message, { actions: [CloseAction, this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL)] }));
}); });
} }
private runPreLaunchTask(taskName: string): Promise { private runPreLaunchTask(taskName: string): TPromise<void> {
if (!taskName) { if (!taskName) {
return TPromise.as(true); return TPromise.as(null);
} }
// run a task before starting a debug session // run a task before starting a debug session
...@@ -573,17 +574,17 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -573,17 +574,17 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
const filteredTasks = descriptions.filter(task => task.name === taskName); const filteredTasks = descriptions.filter(task => task.name === taskName);
if (filteredTasks.length !== 1) { if (filteredTasks.length !== 1) {
this.messageService.show(severity.Warning, nls.localize('DebugTaskNotFound', "Could not find a unique task \'{0}\'. Make sure the task exists and that it has a unique name.", taskName)); this.messageService.show(severity.Warning, nls.localize('DebugTaskNotFound', "Could not find a unique task \'{0}\'. Make sure the task exists and that it has a unique name.", taskName));
return TPromise.as(true); return TPromise.as(null);
} }
// task is already running - nothing to do. // task is already running - nothing to do.
if (this.lastTaskEvent && this.lastTaskEvent.taskName === taskName) { if (this.lastTaskEvent && this.lastTaskEvent.taskName === taskName) {
return TPromise.as(true); return TPromise.as(null);
} }
if (this.lastTaskEvent) { if (this.lastTaskEvent) {
// there is a different task running currently. // there is a different task running currently.
return Promise.wrapError(errors.create(nls.localize('differentTaskRunning', "There is a task {0} running. Can not run pre launch task {1}.", this.lastTaskEvent.taskName, taskName))); return TPromise.wrapError(errors.create(nls.localize('differentTaskRunning', "There is a task {0} running. Can not run pre launch task {1}.", this.lastTaskEvent.taskName, taskName)));
} }
// no task running, execute the preLaunchTask. // no task running, execute the preLaunchTask.
...@@ -607,7 +608,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -607,7 +608,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}); });
} }
public rawAttach(port: number): Promise { public rawAttach(port: number): TPromise<any> {
if (this.session) { if (this.session) {
if (!this.session.isAttach) { if (!this.session.isAttach) {
return this.session.attach({ port }); return this.session.attach({ port });
...@@ -627,11 +628,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -627,11 +628,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}, true); }, true);
} }
public restartSession(): Promise { public restartSession(): TPromise<any> {
return this.session ? this.session.disconnect(true).then(() => return this.session ? this.session.disconnect(true).then(() =>
new Promise(c => { new TPromise<void>(c => {
setTimeout(() => { setTimeout(() => {
this.createSession(false).then(() => c(true)); this.createSession(false).then(() => c(null));
}, 300); }, 300);
}) })
) : this.createSession(false); ) : this.createSession(false);
...@@ -680,7 +681,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -680,7 +681,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return this.viewModel; return this.viewModel;
} }
public openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): Promise { public openOrRevealEditor(source: Source, lineNumber: number, preserveFocus: boolean, sideBySide: boolean): TPromise<any> {
const visibleEditors = this.editorService.getVisibleEditors(); const visibleEditors = this.editorService.getVisibleEditors();
for (let i = 0; i < visibleEditors.length; i++) { for (let i = 0; i < visibleEditors.length; i++) {
const fileInput = wbeditorcommon.asFileEditorInput(visibleEditors[i].input); const fileInput = wbeditorcommon.asFileEditorInput(visibleEditors[i].input);
...@@ -734,14 +735,14 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -734,14 +735,14 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
); );
} }
private sourceIsUnavailable(source: Source, sideBySide: boolean): Promise { private sourceIsUnavailable(source: Source, sideBySide: boolean): TPromise<any> {
this.model.sourceIsUnavailable(source); this.model.sourceIsUnavailable(source);
const editorInput = this.getDebugStringEditorInput(source, nls.localize('debugSourceNotAvailable', "Source {0} is not available.", source.uri.fsPath), 'text/plain'); const editorInput = this.getDebugStringEditorInput(source, nls.localize('debugSourceNotAvailable', "Source {0} is not available.", source.uri.fsPath), 'text/plain');
return this.editorService.openEditor(editorInput, wbeditorcommon.TextEditorOptions.create({ preserveFocus: true }), sideBySide); return this.editorService.openEditor(editorInput, wbeditorcommon.TextEditorOptions.create({ preserveFocus: true }), sideBySide);
} }
public revealRepl(inBackground: boolean = false): Promise { public revealRepl(inBackground: boolean = false): TPromise<void> {
return this.panelService.openPanel(debug.REPL_ID, !inBackground).then((repl: Repl) => { return this.panelService.openPanel(debug.REPL_ID, !inBackground).then((repl: Repl) => {
const elements = this.model.getReplElements(); const elements = this.model.getReplElements();
if (!inBackground && elements.length > 0) { if (!inBackground && elements.length > 0) {
...@@ -758,7 +759,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -758,7 +759,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return this.configurationManager.getConfigurationName(); return this.configurationManager.getConfigurationName();
} }
public setConfiguration(name: string): Promise { public setConfiguration(name: string): TPromise<void> {
return this.configurationManager.setConfiguration(name); return this.configurationManager.setConfiguration(name);
} }
...@@ -782,13 +783,13 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -782,13 +783,13 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
} }
} }
public sendAllBreakpoints(): Promise { public sendAllBreakpoints(): TPromise<any> {
return Promise.join(arrays.distinct(this.model.getBreakpoints(), bp => bp.source.uri.toString()).map(bp => this.sendBreakpoints(bp.source.uri))); return TPromise.join(arrays.distinct(this.model.getBreakpoints(), bp => bp.source.uri.toString()).map(bp => this.sendBreakpoints(bp.source.uri)));
} }
private sendBreakpoints(modelUri: uri): Promise { private sendBreakpoints(modelUri: uri): TPromise<void> {
if (!this.session || !this.session.readyForBreakpoints) { if (!this.session || !this.session.readyForBreakpoints) {
return TPromise.as(null); return TPromise.as(undefined);
} }
const breakpointsToSend = arrays.distinct( const breakpointsToSend = arrays.distinct(
...@@ -809,9 +810,9 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService ...@@ -809,9 +810,9 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}); });
} }
private sendExceptionBreakpoints(): Promise { private sendExceptionBreakpoints(): TPromise<any> {
if (!this.session || !this.session.readyForBreakpoints) { if (!this.session || !this.session.readyForBreakpoints) {
return TPromise.as(null); return TPromise.as(undefined);
} }
const enabledExBreakpoints = this.model.getExceptionBreakpoints().filter(exb => exb.enabled); const enabledExBreakpoints = this.model.getExceptionBreakpoints().filter(exb => exb.enabled);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import path = require('path'); import path = require('path');
import nls = require('vs/nls'); import nls = require('vs/nls');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import objects = require('vs/base/common/objects'); import objects = require('vs/base/common/objects');
import uri from 'vs/base/common/uri'; import uri from 'vs/base/common/uri';
import { schemas } from 'vs/base/common/network'; import { schemas } from 'vs/base/common/network';
...@@ -223,7 +223,7 @@ export class ConfigurationManager { ...@@ -223,7 +223,7 @@ export class ConfigurationManager {
return this.adapters.filter(adapter => adapter.type === this.configuration.type).pop(); return this.adapters.filter(adapter => adapter.type === this.configuration.type).pop();
} }
public setConfiguration(name: string): Promise { public setConfiguration(name: string): TPromise<void> {
return this.loadLaunchConfig().then(config => { return this.loadLaunchConfig().then(config => {
if (!config || !config.configurations) { if (!config || !config.configurations) {
this.configuration = null; this.configuration = null;
...@@ -290,9 +290,9 @@ export class ConfigurationManager { ...@@ -290,9 +290,9 @@ export class ConfigurationManager {
}); });
} }
private massageInitialConfigurations(adapter: Adapter): Promise { private massageInitialConfigurations(adapter: Adapter): TPromise<void> {
if (!adapter || !adapter.initialConfigurations || adapter.type !== 'node') { if (!adapter || !adapter.initialConfigurations || adapter.type !== 'node') {
return TPromise.as(true); return TPromise.as(undefined);
} }
// check package.json for 'main' or 'scripts' so we generate a more pecise 'program' attribute in launch.json. // check package.json for 'main' or 'scripts' so we generate a more pecise 'program' attribute in launch.json.
......
...@@ -9,7 +9,7 @@ import fs = require('fs'); ...@@ -9,7 +9,7 @@ import fs = require('fs');
import net = require('net'); import net = require('net');
import platform = require('vs/base/common/platform'); import platform = require('vs/base/common/platform');
import errors = require('vs/base/common/errors'); import errors = require('vs/base/common/errors');
import { Promise, TPromise} from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import severity from 'vs/base/common/severity'; import severity from 'vs/base/common/severity';
import debug = require('vs/workbench/parts/debug/common/debug'); import debug = require('vs/workbench/parts/debug/common/debug');
import { Adapter } from 'vs/workbench/parts/debug/node/debugAdapter'; import { Adapter } from 'vs/workbench/parts/debug/node/debugAdapter';
...@@ -21,7 +21,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; ...@@ -21,7 +21,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSession { export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSession {
private serverProcess: cp.ChildProcess; private serverProcess: cp.ChildProcess;
private socket: net.Socket = null; private socket: net.Socket = null;
private cachedInitServer: Promise; private cachedInitServer: TPromise<void>;
private startTime: number; private startTime: number;
private stopServerPending: boolean; private stopServerPending: boolean;
public isAttach: boolean; public isAttach: boolean;
...@@ -36,7 +36,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -36,7 +36,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
super(); super();
} }
private initServer(): Promise { private initServer(): TPromise<void> {
if (this.cachedInitServer) { if (this.cachedInitServer) {
return this.cachedInitServer; return this.cachedInitServer;
} }
...@@ -46,7 +46,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -46,7 +46,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
this.startTime = new Date().getTime(); this.startTime = new Date().getTime();
}, err => { }, err => {
this.cachedInitServer = null; this.cachedInitServer = null;
return Promise.wrapError(err); return TPromise.wrapError(err);
} }
); );
...@@ -61,7 +61,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -61,7 +61,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
this.telemetryService.publicLog('debugProtocolErrorResponse', { error : message }); this.telemetryService.publicLog('debugProtocolErrorResponse', { error : message });
} }
return Promise.wrapError(new Error(message)); return TPromise.wrapError(new Error(message));
})); }));
} }
...@@ -176,8 +176,8 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -176,8 +176,8 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return this.adapter.type; return this.adapter.type;
} }
private connectServer(port: number): Promise { private connectServer(port: number): TPromise<void> {
return new Promise((c, e) => { return new TPromise<void>((c, e) => {
this.socket = net.createConnection(port, '127.0.0.1', () => { this.socket = net.createConnection(port, '127.0.0.1', () => {
this.connect(this.socket, <any>this.socket); this.connect(this.socket, <any>this.socket);
c(null); c(null);
...@@ -188,9 +188,9 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -188,9 +188,9 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
}); });
} }
private startServer(): Promise { private startServer(): TPromise<any> {
if (!this.adapter.program) { if (!this.adapter.program) {
return Promise.wrapError(new Error(nls.localize('noDebugAdapterExtensionInstalled', "No extension installed for '{0}' debugging.", this.adapter.type))); return TPromise.wrapError(new Error(nls.localize('noDebugAdapterExtensionInstalled', "No extension installed for '{0}' debugging.", this.adapter.type)));
} }
return this.getLaunchDetails().then(d => this.launchServer(d).then(() => { return this.getLaunchDetails().then(d => this.launchServer(d).then(() => {
...@@ -209,15 +209,15 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -209,15 +209,15 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
})); }));
} }
private launchServer(launch: { command: string, argv: string[] }): Promise { private launchServer(launch: { command: string, argv: string[] }): TPromise<void> {
return new Promise((c, e) => { return new TPromise<void>((c, e) => {
if (launch.command === 'node') { if (launch.command === 'node') {
stdfork.fork(launch.argv[0], launch.argv.slice(1), {}, (err, child) => { stdfork.fork(launch.argv[0], launch.argv.slice(1), {}, (err, child) => {
if (err) { if (err) {
e(new Error(nls.localize('unableToLaunchDebugAdapter', "Unable to launch debug adapter from {0}.", launch.argv[0]))); e(new Error(nls.localize('unableToLaunchDebugAdapter', "Unable to launch debug adapter from {0}.", launch.argv[0])));
} }
this.serverProcess = child; this.serverProcess = child;
c(true); c(null);
}); });
} else { } else {
this.serverProcess = cp.spawn(launch.command, launch.argv, { this.serverProcess = cp.spawn(launch.command, launch.argv, {
...@@ -227,12 +227,12 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -227,12 +227,12 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
'pipe' // stderr 'pipe' // stderr
], ],
}); });
c(true); c(null);
} }
}); });
} }
private stopServer(): Promise { private stopServer(): TPromise<any> {
if (this.socket !== null) { if (this.socket !== null) {
this.socket.end(); this.socket.end();
...@@ -241,17 +241,17 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -241,17 +241,17 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
} }
if (!this.serverProcess) { if (!this.serverProcess) {
return TPromise.as(undefined); return TPromise.as(null);
} }
this.stopServerPending = true; this.stopServerPending = true;
let ret: Promise; let ret: TPromise<void>;
// when killing a process in windows its child // when killing a process in windows its child
// processes are *not* killed but become root // processes are *not* killed but become root
// processes. Therefore we use TASKKILL.EXE // processes. Therefore we use TASKKILL.EXE
if (platform.isWindows) { if (platform.isWindows) {
ret = new Promise((c, e) => { ret = new TPromise<void>((c, e) => {
const killer = cp.exec(`taskkill /F /T /PID ${this.serverProcess.pid}`, function (err, stdout, stderr) { const killer = cp.exec(`taskkill /F /T /PID ${this.serverProcess.pid}`, function (err, stdout, stderr) {
if (err) { if (err) {
return e(err); return e(err);
...@@ -262,14 +262,14 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes ...@@ -262,14 +262,14 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
}); });
} else { } else {
this.serverProcess.kill('SIGTERM'); this.serverProcess.kill('SIGTERM');
ret = TPromise.as(undefined); ret = TPromise.as(null);
} }
return ret; return ret;
} }
private getLaunchDetails(): TPromise<{ command: string; argv: string[]; }> { private getLaunchDetails(): TPromise<{ command: string; argv: string[]; }> {
return new Promise((c, e) => { return new TPromise((c, e) => {
fs.exists(this.adapter.program, exists => { fs.exists(this.adapter.program, exists => {
if (exists) { if (exists) {
c(null); c(null);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import stream = require('stream'); import stream = require('stream');
import uuid = require('vs/base/common/uuid'); import uuid = require('vs/base/common/uuid');
import ee = require('vs/base/common/eventEmitter'); import ee = require('vs/base/common/eventEmitter');
import { Promise, TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import debug = require('vs/workbench/parts/debug/common/debug'); import debug = require('vs/workbench/parts/debug/common/debug');
export abstract class V8Protocol extends ee.EventEmitter { export abstract class V8Protocol extends ee.EventEmitter {
...@@ -71,7 +71,7 @@ export abstract class V8Protocol extends ee.EventEmitter { ...@@ -71,7 +71,7 @@ export abstract class V8Protocol extends ee.EventEmitter {
} }
protected send(command: string, args: any): TPromise<DebugProtocol.Response> { protected send(command: string, args: any): TPromise<DebugProtocol.Response> {
return new Promise((completeDispatch, errorDispatch) => { return new TPromise((completeDispatch, errorDispatch) => {
this.doSend(command, args, (result: DebugProtocol.Response) => { this.doSend(command, args, (result: DebugProtocol.Response) => {
if (result.success) { if (result.success) {
completeDispatch(result); completeDispatch(result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册