提交 cdb80f4d 编写于 作者: M Martin Aeschlimann

Merge branch 'master' of https://github.com/Microsoft/vscode

......@@ -98,7 +98,7 @@ class CreateBranchItem implements QuickPickItem {
get label(): string { return localize('create branch', '$(plus) Create new branch'); }
get description(): string { return ''; }
get shouldAlwaysShow(): boolean { return true; }
get alwaysShow(): boolean { return true; }
async run(repository: Repository): Promise<void> {
await this.cc.branch(repository);
......
......@@ -83,6 +83,20 @@
"command": "merge-conflict.compare"
}
],
"menus": {
"scm/resourceState/context": [
{
"command": "merge-conflict.accept.all-current",
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "1_modification"
},
{
"command": "merge-conflict.accept.all-incoming",
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "1_modification"
}
]
},
"configuration": {
"title": "%config.title%",
"properties": {
......
......@@ -213,7 +213,7 @@ export abstract class EditorAction extends EditorCommand {
super.register();
}
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise<void> {
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Thenable<void> {
this.reportTelemetry(accessor, editor);
return this.run(accessor, editor, args || {});
}
......@@ -231,7 +231,7 @@ export abstract class EditorAction extends EditorCommand {
accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id, ...editor.getTelemetryData() });
}
public abstract run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise<void>;
public abstract run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Thenable<void>;
}
//#endregion EditorAction
......
......@@ -6,7 +6,6 @@
import * as nls from 'vs/nls';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { TPromise } from 'vs/base/common/winjs.base';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Position, IPosition } from 'vs/editor/common/core/position';
......@@ -117,7 +116,7 @@ let findReferencesCommand: ICommandHandler = (accessor: ServicesAccessor, resour
let references = createCancelablePromise(token => provideReferences(control.getModel(), Position.lift(position), token).then(references => new ReferencesModel(references)));
let range = new Range(position.lineNumber, position.column, position.lineNumber, position.column);
return TPromise.as(controller.toggleWidget(range, references, defaultReferenceSearchOptions));
return Promise.resolve(controller.toggleWidget(range, references, defaultReferenceSearchOptions));
});
};
......@@ -141,7 +140,7 @@ let showReferencesCommand: ICommandHandler = (accessor: ServicesAccessor, resour
return undefined;
}
return TPromise.as(controller.toggleWidget(
return Promise.resolve(controller.toggleWidget(
new Range(position.lineNumber, position.column, position.lineNumber, position.column),
createCancelablePromise(_ => Promise.resolve(new ReferencesModel(references))),
defaultReferenceSearchOptions)).then(() => true);
......
......@@ -7,7 +7,6 @@
import * as nls from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
......@@ -27,7 +26,7 @@ export const ctxReferenceSearchVisible = new RawContextKey<boolean>('referenceSe
export interface RequestOptions {
getMetaTitle(model: ReferencesModel): string;
onGoto?: (reference: Location) => TPromise<any>;
onGoto?: (reference: Location) => Thenable<any>;
}
export abstract class ReferencesController implements editorCommon.IEditorContribution {
......@@ -194,7 +193,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
this._requestIdPool += 1; // Cancel pending requests
}
private _gotoReference(ref: Location): TPromise<any> {
private _gotoReference(ref: Location): Thenable<any> {
this._widget.hide();
this._ignoreModelChangeEvent = true;
......
......@@ -11,7 +11,6 @@ import { IDisposable, dispose, IReference } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import { TPromise } from 'vs/base/common/winjs.base';
import { Range, IRange } from 'vs/editor/common/core/range';
import { Location } from 'vs/editor/common/modes';
import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService';
......@@ -128,13 +127,13 @@ export class FileReferences implements IDisposable {
}
}
resolve(textModelResolverService: ITextModelService): TPromise<FileReferences> {
resolve(textModelResolverService: ITextModelService): Promise<FileReferences> {
if (this._resolved) {
return TPromise.as(this);
return Promise.resolve(this);
}
return textModelResolverService.createModelReference(this._uri).then(modelReference => {
return Promise.resolve(textModelResolverService.createModelReference(this._uri).then(modelReference => {
const model = modelReference.object;
if (!model) {
......@@ -152,7 +151,7 @@ export class FileReferences implements IDisposable {
this._resolved = true;
this._loadFailure = err;
return this;
});
}));
}
dispose(): void {
......
......@@ -704,7 +704,7 @@ export class ReferenceWidget extends PeekViewWidget {
});
}
public setModel(newModel: ReferencesModel): TPromise<any> {
public setModel(newModel: ReferencesModel): Thenable<any> {
// clean up
this._disposeOnNewModel = dispose(this._disposeOnNewModel);
this._model = newModel;
......@@ -714,13 +714,13 @@ export class ReferenceWidget extends PeekViewWidget {
return undefined;
}
private _onNewModel(): TPromise<any> {
private _onNewModel(): Thenable<any> {
if (this._model.empty) {
this.setTitle('');
this._messageContainer.innerHTML = nls.localize('noResults', "No results");
dom.show(this._messageContainer);
return TPromise.as(void 0);
return Promise.resolve(void 0);
}
dom.hide(this._messageContainer);
......@@ -782,7 +782,7 @@ export class ReferenceWidget extends PeekViewWidget {
await this._tree.reveal(reference.parent);
}
return TPromise.join([promise, this._tree.reveal(reference)]).then(values => {
return Promise.all([promise, this._tree.reveal(reference)]).then(values => {
const ref = values[0];
if (!this._model) {
......
......@@ -7,7 +7,6 @@
import * as nls from 'vs/nls';
import * as arrays from 'vs/base/common/arrays';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { TPromise } from 'vs/base/common/winjs.base';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Range } from 'vs/editor/common/core/range';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
......@@ -66,7 +65,7 @@ class SmartSelectController implements IEditorContribution {
return SmartSelectController.ID;
}
public run(forward: boolean): TPromise<void> {
public run(forward: boolean): Promise<void> {
const selection = this.editor.getSelection();
const model = this.editor.getModel();
......@@ -78,9 +77,9 @@ class SmartSelectController implements IEditorContribution {
}
}
let promise: TPromise<void> = TPromise.as(null);
let promise: Promise<void> = Promise.resolve(null);
if (!this._state) {
promise = this._tokenSelectionSupport.getRangesToPosition(model.uri, selection.getStartPosition()).then((elements: ILogicalSelectionEntry[]) => {
promise = Promise.resolve(this._tokenSelectionSupport.getRangesToPositionSync(model.uri, selection.getStartPosition())).then((elements: ILogicalSelectionEntry[]) => {
if (arrays.isFalsyOrEmpty(elements)) {
return;
......@@ -156,7 +155,7 @@ abstract class AbstractSmartSelect extends EditorAction {
this._forward = forward;
}
public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
public run(accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> {
let controller = SmartSelectController.get(editor);
if (controller) {
return controller.run(this._forward);
......
......@@ -5,7 +5,6 @@
'use strict';
import { URI } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { Range } from 'vs/editor/common/core/range';
import { ITextModel } from 'vs/editor/common/model';
import { IModelService } from 'vs/editor/common/services/modelService';
......@@ -28,10 +27,6 @@ export class TokenSelectionSupport {
this._modelService = modelService;
}
public getRangesToPosition(resource: URI, position: Position): TPromise<ILogicalSelectionEntry[]> {
return TPromise.as(this.getRangesToPositionSync(resource, position));
}
public getRangesToPositionSync(resource: URI, position: Position): ILogicalSelectionEntry[] {
const model = this._modelService.getModel(resource);
let entries: ILogicalSelectionEntry[] = [];
......
......@@ -5,7 +5,6 @@
'use strict';
import * as assert from 'assert';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPosition } from 'vs/editor/common/core/position';
import { ISuggestResult, ISuggestSupport, ISuggestion, SuggestionKind } from 'vs/editor/common/modes';
import { CompletionModel } from 'vs/editor/contrib/suggest/completionModel';
......@@ -36,7 +35,7 @@ export function createSuggestItem(label: string, overwriteBefore: number, kind =
}
};
resolve(): TPromise<void> {
resolve(): Promise<void> {
return null;
}
};
......
......@@ -1081,7 +1081,7 @@ declare module 'vscode' {
/**
* Show this item always
*/
shouldAlwaysShow?: boolean;
alwaysShow?: boolean;
}
//#endregion
}
......@@ -470,7 +470,7 @@ export function createApiFactory(
return extHostUrls.registerUriHandler(extension.id, handler);
},
createQuickPick<T extends vscode.QuickPickItem>(): vscode.QuickPick<T> {
return extHostQuickOpen.createQuickPick(extension.id);
return extHostQuickOpen.createQuickPick(extension.id, extension.enableProposedApi);
},
createInputBox(): vscode.InputBox {
return extHostQuickOpen.createInputBox(extension.id);
......
......@@ -79,7 +79,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
detail = item.detail;
picked = item.picked;
if (enableProposedApi) {
alwaysShow = item.shouldAlwaysShow;
alwaysShow = item.alwaysShow;
}
}
pickItems.push({
......@@ -168,8 +168,8 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
// ---- QuickInput
createQuickPick<T extends QuickPickItem>(extensionId: string): QuickPick<T> {
const session = new ExtHostQuickPick(this._proxy, extensionId, () => this._sessions.delete(session._id));
createQuickPick<T extends QuickPickItem>(extensionId: string, enableProposedApi: boolean): QuickPick<T> {
const session = new ExtHostQuickPick(this._proxy, extensionId, enableProposedApi, () => this._sessions.delete(session._id));
this._sessions.set(session._id, session);
return session;
}
......@@ -473,7 +473,7 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
private _selectedItems: T[] = [];
private _onDidChangeSelectionEmitter = new Emitter<T[]>();
constructor(proxy: MainThreadQuickOpenShape, extensionId: string, onDispose: () => void) {
constructor(proxy: MainThreadQuickOpenShape, extensionId: string, private _enableProposedApi: boolean, onDispose: () => void) {
super(proxy, extensionId, onDispose);
this._disposables.push(
this._onDidChangeActiveEmitter,
......@@ -500,7 +500,8 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
description: item.description,
handle: i,
detail: item.detail,
picked: item.picked
picked: item.picked,
alwaysShow: this._enableProposedApi ? item.alwaysShow : undefined
}))
});
}
......
......@@ -49,7 +49,6 @@ class ListElement implements IListElement {
saneLabel: string;
saneDescription?: string;
saneDetail?: string;
shouldAlwaysShow = false;
hidden = false;
private _onChecked = new Emitter<boolean>();
onChecked = this._onChecked.event;
......@@ -488,7 +487,7 @@ export class QuickInputList {
const descriptionHighlights = this.matchOnDescription ? matchesFuzzyOcticonAware(query, parseOcticons(element.saneDescription || '')) : undefined;
const detailHighlights = this.matchOnDetail ? matchesFuzzyOcticonAware(query, parseOcticons(element.saneDetail || '')) : undefined;
if (element.shouldAlwaysShow || labelHighlights || descriptionHighlights || detailHighlights) {
if (labelHighlights || descriptionHighlights || detailHighlights) {
element.labelHighlights = labelHighlights;
element.descriptionHighlights = descriptionHighlights;
element.detailHighlights = detailHighlights;
......
......@@ -54,7 +54,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
}
if (!session) {
return TPromise.wrapError<ITextModel>(new Error(localize('unable', "Unable to resolve the resource without a debug session")));
return Promise.reject(new Error(localize('unable', "Unable to resolve the resource without a debug session")));
}
const createErrModel = (message: string) => {
this.debugService.sourceIsNotAvailable(resource);
......
......@@ -49,7 +49,6 @@ import { DebugSession } from 'vs/workbench/parts/debug/electron-browser/debugSes
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, REPL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IReplElementSource, IEnablement, IBreakpoint, IBreakpointData, IExpression, ICompound, IGlobalConfig, IStackFrame, AdapterEndEvent } from 'vs/workbench/parts/debug/common/debug';
import { isExtensionHostDebugging } from 'vs/workbench/parts/debug/common/debugUtils';
import { Debugger } from 'vs/workbench/parts/debug/node/debugger';
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
......@@ -285,10 +284,10 @@ export class DebugService implements IDebugService {
const sessions = this.model.getSessions();
const alreadyRunningMessage = nls.localize('configurationAlreadyRunning', "There is already a debug configuration \"{0}\" running.", configOrName);
if (sessions.some(s => s.getName(false) === configOrName && (!launch || !launch.workspace || !s.root || s.root.uri.toString() === launch.workspace.uri.toString()))) {
return TPromise.wrapError(new Error(alreadyRunningMessage));
return Promise.reject(new Error(alreadyRunningMessage));
}
if (compound && compound.configurations && sessions.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) {
return TPromise.wrapError(new Error(alreadyRunningMessage));
return Promise.reject(new Error(alreadyRunningMessage));
}
} else if (typeof configOrName !== 'string') {
config = configOrName;
......@@ -297,7 +296,7 @@ export class DebugService implements IDebugService {
if (compound) {
// we are starting a compound debug, first do some error checking and than start each configuration in the compound
if (!compound.configurations) {
return TPromise.wrapError(new Error(nls.localize({ key: 'compoundMustHaveConfigurations', comment: ['compound indicates a "compounds" configuration item', '"configurations" is an attribute and should not be localized'] },
return Promise.reject(new Error(nls.localize({ key: 'compoundMustHaveConfigurations', comment: ['compound indicates a "compounds" configuration item', '"configurations" is an attribute and should not be localized'] },
"Compound must have \"configurations\" attribute set in order to start multiple configurations.")));
}
......@@ -316,7 +315,7 @@ export class DebugService implements IDebugService {
// If there are multiple launches containing the configuration give priority to the configuration in the current launch
launchForName = launch;
} else {
return TPromise.wrapError(new Error(launchesContainingName.length === 0 ? nls.localize('noConfigurationNameInWorkspace', "Could not find launch configuration '{0}' in the workspace.", name)
return Promise.reject(new Error(launchesContainingName.length === 0 ? nls.localize('noConfigurationNameInWorkspace', "Could not find launch configuration '{0}' in the workspace.", name)
: nls.localize('multipleConfigurationNamesInWorkspace', "There are multiple launch configurations '{0}' in the workspace. Use folder name to qualify the configuration.", name)));
}
} else if (configData.folder) {
......@@ -324,7 +323,7 @@ export class DebugService implements IDebugService {
if (launchesMatchingConfigData.length === 1) {
launchForName = launchesMatchingConfigData[0];
} else {
return TPromise.wrapError(new Error(nls.localize('noFolderWithName', "Can not find folder with name '{0}' for configuration '{1}' in compound '{2}'.", configData.folder, configData.name, compound.name)));
return Promise.reject(new Error(nls.localize('noFolderWithName', "Can not find folder with name '{0}' for configuration '{1}' in compound '{2}'.", configData.folder, configData.name, compound.name)));
}
}
......@@ -335,7 +334,7 @@ export class DebugService implements IDebugService {
if (configOrName && !config) {
const message = !!launch ? nls.localize('configMissing', "Configuration '{0}' is missing in 'launch.json'.", typeof configOrName === 'string' ? configOrName : JSON.stringify(configOrName)) :
nls.localize('launchJsonDoesNotExist', "'launch.json' does not exist.");
return TPromise.wrapError(new Error(message));
return Promise.reject(new Error(message));
}
return this.createSession(launch, config, unresolvedConfig, noDebug);
......@@ -346,7 +345,7 @@ export class DebugService implements IDebugService {
return success;
}, err => {
this.endInitializingState();
return TPromise.wrapError(err);
return Promise.reject(err);
});
}
......@@ -369,8 +368,8 @@ export class DebugService implements IDebugService {
config.noDebug = true;
}
const debuggerThenable: Thenable<Debugger> = type ? Promise.resolve(null) : this.configurationManager.guessDebugger();
return debuggerThenable.then(dbgr => type = dbgr && dbgr.type).then(() =>
const debuggerThenable: Thenable<void> = type ? Promise.resolve(null) : this.configurationManager.guessDebugger().then(dbgr => { type = dbgr && dbgr.type; });
return debuggerThenable.then(() =>
this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config).then(config => {
// a falsy config indicates an aborted launch
if (config && config.type) {
......@@ -495,7 +494,7 @@ export class DebugService implements IDebugService {
});
}).then(undefined, err => {
session.shutdown();
return TPromise.wrapError(err);
return Promise.reject(err);
});
}
......@@ -686,7 +685,7 @@ export class DebugService implements IDebugService {
return Promise.resolve(null);
}
if (!root) {
return TPromise.wrapError(new Error(nls.localize('invalidTaskReference', "Task '{0}' can not be referenced from a launch configuration that is in a different workspace folder.", typeof taskId === 'string' ? taskId : taskId.type)));
return Promise.reject(new Error(nls.localize('invalidTaskReference', "Task '{0}' can not be referenced from a launch configuration that is in a different workspace folder.", typeof taskId === 'string' ? taskId : taskId.type)));
}
// run a task before starting a debug session
return this.taskService.getTask(root, taskId).then(task => {
......@@ -694,7 +693,7 @@ export class DebugService implements IDebugService {
const errorMessage = typeof taskId === 'string'
? nls.localize('DebugTaskNotFoundWithTaskId', "Could not find the task '{0}'.", taskId)
: nls.localize('DebugTaskNotFound', "Could not find the specified task.");
return TPromise.wrapError(errors.create(errorMessage));
return Promise.reject(errors.create(errorMessage));
}
// If a task is missing the problem matcher the promise will never complete, so we need to have a workaround #35340
......
......@@ -169,7 +169,7 @@ export class DebugSession implements IDebugSession {
return void 0;
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
/**
......@@ -186,7 +186,7 @@ export class DebugSession implements IDebugSession {
return void 0;
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
/**
......@@ -198,7 +198,7 @@ export class DebugSession implements IDebugSession {
return void 0;
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
/**
......@@ -208,13 +208,13 @@ export class DebugSession implements IDebugSession {
if (this.raw) {
return this.raw.restart();
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
sendBreakpoints(modelUri: URI, breakpointsToSend: IBreakpoint[], sourceModified: boolean): TPromise<ActualBreakpoints | undefined> {
if (!this.raw) {
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
if (!this.raw.readyForBreakpoints) {
......@@ -271,7 +271,7 @@ export class DebugSession implements IDebugSession {
}
return Promise.resolve(undefined);
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): TPromise<any> {
......@@ -281,21 +281,21 @@ export class DebugSession implements IDebugSession {
}
return Promise.resolve(null);
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
customRequest(request: string, args: any): TPromise<DebugProtocol.Response> {
if (this.raw) {
return this.raw.custom(request, args);
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
stackTrace(threadId: number, startFrame: number, levels: number): TPromise<DebugProtocol.StackTraceResponse> {
if (this.raw) {
return this.raw.stackTrace({ threadId, startFrame, levels });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
exceptionInfo(threadId: number): TPromise<IExceptionInfo> {
......@@ -312,14 +312,14 @@ export class DebugSession implements IDebugSession {
return null;
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
scopes(frameId: number): TPromise<DebugProtocol.ScopesResponse> {
if (this.raw) {
return this.raw.scopes({ frameId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
variables(variablesReference: number, filter: 'indexed' | 'named', start: number, count: number): TPromise<DebugProtocol.VariablesResponse | undefined> {
......@@ -333,83 +333,83 @@ export class DebugSession implements IDebugSession {
if (this.raw) {
return this.raw.evaluate({ expression, frameId, context });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
restartFrame(frameId: number, threadId: number): TPromise<DebugProtocol.RestartFrameResponse> {
if (this.raw) {
return this.raw.restartFrame({ frameId }, threadId);
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
next(threadId: number): TPromise<DebugProtocol.NextResponse> {
if (this.raw) {
return this.raw.next({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
stepIn(threadId: number): TPromise<DebugProtocol.StepInResponse> {
if (this.raw) {
return this.raw.stepIn({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
stepOut(threadId: number): TPromise<DebugProtocol.StepOutResponse> {
if (this.raw) {
return this.raw.stepOut({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
stepBack(threadId: number): TPromise<DebugProtocol.StepBackResponse> {
if (this.raw) {
return this.raw.stepBack({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
continue(threadId: number): TPromise<DebugProtocol.ContinueResponse> {
if (this.raw) {
return this.raw.continue({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
reverseContinue(threadId: number): TPromise<DebugProtocol.ReverseContinueResponse> {
if (this.raw) {
return this.raw.reverseContinue({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
pause(threadId: number): TPromise<DebugProtocol.PauseResponse> {
if (this.raw) {
return this.raw.pause({ threadId });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
terminateThreads(threadIds?: number[]): TPromise<DebugProtocol.TerminateThreadsResponse> {
if (this.raw) {
return this.raw.terminateThreads({ threadIds });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
setVariable(variablesReference: number, name: string, value: string): TPromise<DebugProtocol.SetVariableResponse> {
if (this.raw) {
return this.raw.setVariable({ variablesReference, name, value });
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
loadSource(resource: URI): TPromise<DebugProtocol.SourceResponse> {
if (!this.raw) {
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
const source = this.getSourceForUri(resource);
......@@ -442,7 +442,7 @@ export class DebugSession implements IDebugSession {
return [];
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]> {
......@@ -472,7 +472,7 @@ export class DebugSession implements IDebugSession {
return result;
});
}
return TPromise.wrapError(new Error('no debug adapter'));
return Promise.reject(new Error('no debug adapter'));
}
//---- threads
......
......@@ -207,7 +207,7 @@ export class RawDebugSession {
return this.debugAdapter.startSession().then(() => {
this.startTime = new Date().getTime();
}, err => {
return TPromise.wrapError(err);
return Promise.reject(err);
});
}
......@@ -248,14 +248,14 @@ export class RawDebugSession {
}
return this.disconnect(restart);
}
return TPromise.wrapError(new Error('terminated not supported'));
return Promise.reject(new Error('terminated not supported'));
}
public restart(): TPromise<DebugProtocol.RestartResponse> {
if (this.capabilities.supportsRestartRequest) {
return this.send('restart', null);
}
return TPromise.wrapError(new Error('restart not supported'));
return Promise.reject(new Error('restart not supported'));
}
public next(args: DebugProtocol.NextArguments): TPromise<DebugProtocol.NextResponse> {
......@@ -297,14 +297,14 @@ export class RawDebugSession {
if (this.capabilities.supportsTerminateThreadsRequest) {
return this.send('terminateThreads', args);
}
return TPromise.wrapError(new Error('terminateThreads not supported'));
return Promise.reject(new Error('terminateThreads not supported'));
}
public setVariable(args: DebugProtocol.SetVariableArguments): TPromise<DebugProtocol.SetVariableResponse> {
if (this.capabilities.supportsSetVariable) {
return this.send<DebugProtocol.SetVariableResponse>('setVariable', args);
}
return TPromise.wrapError(new Error('setVariable not supported'));
return Promise.reject(new Error('setVariable not supported'));
}
public restartFrame(args: DebugProtocol.RestartFrameArguments, threadId: number): TPromise<DebugProtocol.RestartFrameResponse> {
......@@ -314,14 +314,14 @@ export class RawDebugSession {
return response;
});
}
return TPromise.wrapError(new Error('restartFrame not supported'));
return Promise.reject(new Error('restartFrame not supported'));
}
public completions(args: DebugProtocol.CompletionsArguments): TPromise<DebugProtocol.CompletionsResponse> {
if (this.capabilities.supportsCompletionsRequest) {
return this.send<DebugProtocol.CompletionsResponse>('completions', args);
}
return TPromise.wrapError(new Error('completions not supported'));
return Promise.reject(new Error('completions not supported'));
}
public setBreakpoints(args: DebugProtocol.SetBreakpointsArguments): TPromise<DebugProtocol.SetBreakpointsResponse> {
......@@ -332,7 +332,7 @@ export class RawDebugSession {
if (this.capabilities.supportsFunctionBreakpoints) {
return this.send<DebugProtocol.SetFunctionBreakpointsResponse>('setFunctionBreakpoints', args);
}
return TPromise.wrapError(new Error('setFunctionBreakpoints not supported'));
return Promise.reject(new Error('setFunctionBreakpoints not supported'));
}
public setExceptionBreakpoints(args: DebugProtocol.SetExceptionBreakpointsArguments): TPromise<DebugProtocol.SetExceptionBreakpointsResponse> {
......@@ -343,7 +343,7 @@ export class RawDebugSession {
if (this.capabilities.supportsConfigurationDoneRequest) {
return this.send('configurationDone', null);
}
return TPromise.wrapError(new Error('configurationDone not supported'));
return Promise.reject(new Error('configurationDone not supported'));
}
public stackTrace(args: DebugProtocol.StackTraceArguments): TPromise<DebugProtocol.StackTraceResponse> {
......@@ -354,7 +354,7 @@ export class RawDebugSession {
if (this.capabilities.supportsExceptionInfoRequest) {
return this.send<DebugProtocol.ExceptionInfoResponse>('exceptionInfo', args);
}
return TPromise.wrapError(new Error('exceptionInfo not supported'));
return Promise.reject(new Error('exceptionInfo not supported'));
}
public scopes(args: DebugProtocol.ScopesArguments): TPromise<DebugProtocol.ScopesResponse> {
......@@ -373,7 +373,7 @@ export class RawDebugSession {
if (this.capabilities.supportsLoadedSourcesRequest) {
return this.send<DebugProtocol.LoadedSourcesResponse>('loadedSources', args);
}
return TPromise.wrapError(new Error('loadedSources not supported'));
return Promise.reject(new Error('loadedSources not supported'));
}
public threads(): TPromise<DebugProtocol.ThreadsResponse> {
......@@ -393,7 +393,7 @@ export class RawDebugSession {
return response;
});
}
return TPromise.wrapError(new Error('stepBack not supported'));
return Promise.reject(new Error('stepBack not supported'));
}
public reverseContinue(args: DebugProtocol.ReverseContinueArguments): TPromise<DebugProtocol.ReverseContinueResponse> {
......@@ -405,7 +405,7 @@ export class RawDebugSession {
return response;
});
}
return TPromise.wrapError(new Error('reverseContinue not supported'));
return Promise.reject(new Error('reverseContinue not supported'));
}
public custom(request: string, args: any): TPromise<DebugProtocol.Response> {
......@@ -516,7 +516,7 @@ export class RawDebugSession {
errorDispatch(response);
}
}, timeout);
}).then(response => response, err => TPromise.wrapError(this.handleErrorResponse(err)));
}).then(response => response, err => Promise.reject(this.handleErrorResponse(err)));
}
private handleErrorResponse(errorResponse: DebugProtocol.Response): Error {
......
......@@ -60,7 +60,7 @@ export class Debugger implements IDebugger {
// a "debugServer" attribute in the launch config takes precedence
if (typeof config.debugServer === 'number') {
return TPromise.wrap(<IDebugAdapterServer>{
return Promise.resolve(<IDebugAdapterServer>{
type: 'server',
port: config.debugServer
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册