diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 2610a90d4c0cb3b39a8bada2cec8cbf07a23ab4d..43f4715eccfe3073b4c823a5eb5bc415f00bbda7 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -327,7 +327,7 @@ export class ExtHostApiCommands { return undefined; } if (value.rejectReason) { - return TPromise.wrapError(value.rejectReason); + return TPromise.wrapError(value.rejectReason); } let workspaceEdit = new types.WorkspaceEdit(); for (let edit of value.edits) { diff --git a/src/vs/workbench/api/node/extHostCommands.ts b/src/vs/workbench/api/node/extHostCommands.ts index 78834a3e35a9736912ae846db4eec279b04b6663..2095dac3b4aecc898e59c23a99937c2682b96894 100644 --- a/src/vs/workbench/api/node/extHostCommands.ts +++ b/src/vs/workbench/api/node/extHostCommands.ts @@ -76,7 +76,7 @@ export class ExtHostCommands extends ExtHostCommandsShape { if (this._commands.has(id)) { // we stay inside the extension host and support // to pass any kind of parameters around - return this.$executeContributedCommand(id, ...args); + return this.$executeContributedCommand(id, ...args); } else { // automagically convert some argument types @@ -96,7 +96,7 @@ export class ExtHostCommands extends ExtHostCommandsShape { } }); - return this._proxy.$executeCommand(id, args); + return this._proxy.$executeCommand(id, args); } } diff --git a/src/vs/workbench/api/node/extHostDocuments.ts b/src/vs/workbench/api/node/extHostDocuments.ts index 81b16769f409bfdb3b378e89e725f689e69fb998..918efad51f393221b98f414c11ae57f4cfb64a61 100644 --- a/src/vs/workbench/api/node/extHostDocuments.ts +++ b/src/vs/workbench/api/node/extHostDocuments.ts @@ -94,7 +94,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape { return this._documentsAndEditors.getDocument(uri.toString()); }, err => { this._documentLoader.delete(uri.toString()); - return TPromise.wrapError(err); + return TPromise.wrapError(err); }); this._documentLoader.set(uri.toString(), promise); } diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts index 902ab900223bd40d98c89b56d9170df03e989548..ae75796c7e288291e8d0ba758778c0e2d6d1e714 100644 --- a/src/vs/workbench/api/node/extHostExtensionService.ts +++ b/src/vs/workbench/api/node/extHostExtensionService.ts @@ -281,7 +281,7 @@ export class ExtHostExtensionService extends AbstractExtensionService { + protected _actualActivateExtension(extensionDescription: IExtensionDescription): TPromise { return this._doActualActivateExtension(extensionDescription).then((activatedExtension) => { this._proxy.$onExtensionActivated(extensionDescription.id); return activatedExtension; @@ -307,10 +307,10 @@ export class ExtHostExtensionService extends AbstractExtensionService { // Avoid failing with an array of errors, fail with a single error if (errors[0]) { - return TPromise.wrapError(errors[0]); + return TPromise.wrapError(errors[0]); } if (errors[1]) { - return TPromise.wrapError(errors[1]); + return TPromise.wrapError(errors[1]); } return undefined; }); @@ -355,7 +355,7 @@ function loadCommonJSModule(modulePath: string): TPromise { try { r = require.__$__nodeRequire(modulePath); } catch (e) { - return TPromise.wrapError(e); + return TPromise.wrapError(e); } return TPromise.as(r); } diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index b42acd2fa4aa7273f1f057ff97c047d080814a86..28f2b12d0edd0f04a927f17afc6e13708b9c4a7e 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -457,7 +457,7 @@ class RenameAdapter { rejectReason: err }; } - return TPromise.wrapError(err); + return TPromise.wrapError(err); }); } } @@ -716,7 +716,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape { private _withAdapter(handle: number, ctor: { new (...args: any[]): A }, callback: (adapter: A) => TPromise): TPromise { let adapter = this._adapter.get(handle); if (!(adapter instanceof ctor)) { - return TPromise.wrapError(new Error('no adapter found')); + return TPromise.wrapError(new Error('no adapter found')); } return callback(adapter); } diff --git a/src/vs/workbench/api/node/extHostSCM.ts b/src/vs/workbench/api/node/extHostSCM.ts index 6b621f709e1dd19e4635a7c651c2b6b62c25c64b..5c9a0c3304c5620ccbd8821798da3fa82c369910 100644 --- a/src/vs/workbench/api/node/extHostSCM.ts +++ b/src/vs/workbench/api/node/extHostSCM.ts @@ -310,7 +310,7 @@ export class ExtHostSCM { return sourceControl; } - $provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise { + $provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise { const sourceControl = this._sourceControls.get(sourceControlHandle); if (!sourceControl || !sourceControl.quickDiffProvider) { diff --git a/src/vs/workbench/api/node/extHostStorage.ts b/src/vs/workbench/api/node/extHostStorage.ts index 3419f823afe4547a5fbf9f0e4ed57e82fa59725e..80499005ff7ad9ab38942b14aac25cb0d4877599 100644 --- a/src/vs/workbench/api/node/extHostStorage.ts +++ b/src/vs/workbench/api/node/extHostStorage.ts @@ -17,7 +17,7 @@ export class ExtHostStorage { } getValue(shared: boolean, key: string, defaultValue?: T): TPromise { - return this._proxy.$getValue(shared, key).then(value => value || defaultValue); + return this._proxy.$getValue(shared, key).then(value => value || defaultValue); } setValue(shared: boolean, key: string, value: any): TPromise { diff --git a/src/vs/workbench/api/node/extHostTextEditor.ts b/src/vs/workbench/api/node/extHostTextEditor.ts index b323f70f0d28db4a499e4d6b6c77e9037f56add0..5134ebfa644298a12e2dcdb12900e207124df3fd 100644 --- a/src/vs/workbench/api/node/extHostTextEditor.ts +++ b/src/vs/workbench/api/node/extHostTextEditor.ts @@ -513,7 +513,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { private _runOnProxy(callback: () => TPromise, silent: boolean): TPromise { if (this._disposed) { if (!silent) { - return TPromise.wrapError(silent); + return TPromise.wrapError(silent); } else { console.warn('TextEditor is closed/disposed'); return TPromise.as(undefined); @@ -521,7 +521,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { } return callback().then(() => this, err => { if (!silent) { - return TPromise.wrapError(silent); + return TPromise.wrapError(silent); } console.warn(err); return undefined; diff --git a/src/vs/workbench/api/node/extHostTreeView.ts b/src/vs/workbench/api/node/extHostTreeView.ts index 7c341242f9b3a9dc930e8d3c20ff110d2d2e9e5e..e77761cb7a60a2f4a2fa1c38867d7cd4971c45f1 100644 --- a/src/vs/workbench/api/node/extHostTreeView.ts +++ b/src/vs/workbench/api/node/extHostTreeView.ts @@ -85,7 +85,7 @@ export class ExtHostTreeView extends ExtHostTreeViewShape { const provider = this._extNodeProviders[providerId]; if (!provider) { const errMessage = localize('treeExplorer.notRegistered', 'No TreeExplorerNodeProvider with id \'{0}\' registered.', providerId); - return TPromise.wrapError(errMessage); + return TPromise.wrapError(errMessage); } return asWinJsPromise(() => provider.provideRootNode()).then(extRootNode => { @@ -100,7 +100,7 @@ export class ExtHostTreeView extends ExtHostTreeViewShape { return internalRootNode; }, err => { const errMessage = localize('treeExplorer.failedToProvideRootNode', 'TreeExplorerNodeProvider \'{0}\' failed to provide root node.', providerId); - return TPromise.wrapError(errMessage); + return TPromise.wrapError(errMessage); }); } @@ -108,7 +108,7 @@ export class ExtHostTreeView extends ExtHostTreeViewShape { const provider = this._extNodeProviders[providerId]; if (!provider) { const errMessage = localize('treeExplorer.notRegistered', 'No TreeExplorerNodeProvider with id \'{0}\' registered.', providerId); - return TPromise.wrapError(errMessage); + return TPromise.wrapError(errMessage); } const extNodeMap = this._extNodeMaps[providerId]; diff --git a/src/vs/workbench/api/node/mainThreadEditors.ts b/src/vs/workbench/api/node/mainThreadEditors.ts index c02a563de80863ec422223bd319c17f6bdcd0175..97a8384ce740a5e387e00dd470e1ca7c2cef74eb 100644 --- a/src/vs/workbench/api/node/mainThreadEditors.ts +++ b/src/vs/workbench/api/node/mainThreadEditors.ts @@ -188,14 +188,14 @@ export class MainThreadEditors extends MainThreadEditorsShape { $tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): TPromise { if (!this._documentsAndEditors.getEditor(id)) { - return TPromise.wrapError('TextEditor disposed'); + return TPromise.wrapError('TextEditor disposed'); } return TPromise.as(this._documentsAndEditors.getEditor(id).applyEdits(modelVersionId, edits, opts)); } $tryInsertSnippet(id: string, template: string, ranges: IRange[], opts: IUndoStopOptions): TPromise { if (!this._documentsAndEditors.getEditor(id)) { - return TPromise.wrapError('TextEditor disposed'); + return TPromise.wrapError('TextEditor disposed'); } return TPromise.as(this._documentsAndEditors.getEditor(id).insertSnippet(template, ranges, opts)); } @@ -212,7 +212,7 @@ export class MainThreadEditors extends MainThreadEditorsShape { const editor = this._documentsAndEditors.getEditor(id); if (!editor) { - return TPromise.wrapError('No such TextEditor'); + return TPromise.wrapError('No such TextEditor'); } const codeEditor = editor.getCodeEditor(); diff --git a/src/vs/workbench/api/node/mainThreadQuickOpen.ts b/src/vs/workbench/api/node/mainThreadQuickOpen.ts index 31896782a4a6edc4bde9565731a7818229eed2b0..8e5664fcb0dba2ce43d3697a52e57c42a247257f 100644 --- a/src/vs/workbench/api/node/mainThreadQuickOpen.ts +++ b/src/vs/workbench/api/node/mainThreadQuickOpen.ts @@ -33,7 +33,7 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape { const myToken = ++this._token; - this._contents = new TPromise((c, e) => { + this._contents = new TPromise((c, e) => { this._doSetItems = (items) => { if (myToken === this._token) { c(items); diff --git a/src/vs/workbench/api/node/mainThreadStorage.ts b/src/vs/workbench/api/node/mainThreadStorage.ts index 911caaa5a94870a4eedb69d0b052828e2102ce34..2e8aba86eb9ace3e67ac5953855fb614642ce979 100644 --- a/src/vs/workbench/api/node/mainThreadStorage.ts +++ b/src/vs/workbench/api/node/mainThreadStorage.ts @@ -27,7 +27,7 @@ export class MainThreadStorage extends MainThreadStorageShape { value = JSON.parse(jsonValue); return TPromise.as(value); } catch (err) { - return TPromise.wrapError(err); + return TPromise.wrapError(err); } } diff --git a/src/vs/workbench/api/node/mainThreadWorkspace.ts b/src/vs/workbench/api/node/mainThreadWorkspace.ts index a05c930f263498e4f67d089dce5c7615ba43d755..e8566c751ce6812edd07881f435d8bf4ece58535 100644 --- a/src/vs/workbench/api/node/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/node/mainThreadWorkspace.ts @@ -5,6 +5,7 @@ 'use strict'; import { isPromiseCanceledError } from 'vs/base/common/errors'; +import URI from 'vs/base/common/uri'; import { ISearchService, QueryType } from 'vs/platform/search/common/search'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -45,7 +46,7 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape { this._textModelResolverService = textModelResolverService; } - $startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable { + $startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable { const workspace = this._contextService.getWorkspace(); if (!workspace) { return undefined; diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 8bfd5310387cd2786a8cc3d141eedee81896e085..198a8b34bf98e88fc84843521d9f68cfd6076e48 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -174,7 +174,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal let sidebarPosition = this.partService.getSideBarPosition(); let isSidebarVisible = this.partService.isVisible(Parts.SIDEBAR_PART); let newSashWidth = (sidebarPosition === Position.LEFT) ? this.startSidebarWidth + e.currentX - startX : this.startSidebarWidth - e.currentX + startX; - let promise = TPromise.as(null); + let promise = TPromise.as(null); // Sidebar visible if (isSidebarVisible) { @@ -213,7 +213,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal let doLayout = false; let isPanelVisible = this.partService.isVisible(Parts.PANEL_PART); let newSashHeight = this.startPanelHeight - (e.currentY - startY); - let promise = TPromise.as(null); + let promise = TPromise.as(null); // Panel visible if (isPanelVisible) { diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 90b6db7ec47b386c8a8be43df9fab946d97e650d..c7b22982d3a1e044ea00fd061c733d1bbf4ed56f 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -297,7 +297,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService // We need an editor descriptor for the input const descriptor = Registry.as(EditorExtensions.Editors).getEditor(input); if (!descriptor) { - return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', input))); + return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', input))); } // Opened to the side @@ -453,7 +453,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService return TPromise.as(arg); } - return TPromise.wrapError(arg); + return TPromise.wrapError(arg); }; const instantiateEditorPromise = editorInstantiationService.createInstance(descriptor).then(onInstantiate, onInstantiate); diff --git a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts index aebe6d07f7783924eb313aa324742e208d09e8f9..bd2b4a4ac036483aaaf9a3390e2b2b9309c094fa 100644 --- a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts +++ b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts @@ -134,7 +134,7 @@ export class SideBySideEditor extends BaseEditor { private _createEditor(editorInput: EditorInput, container: HTMLElement): TPromise { const descriptor = Registry.as(EditorExtensions.Editors).getEditor(editorInput); if (!descriptor) { - return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput))); + return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput))); } return this.instantiationService.createInstance(descriptor) .then((editor: BaseEditor) => { diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index 00e6d4eb0cd45bed52e0490a629926030b8aa902..de3cd35936931af6f764ed0ede2654ab86d7199a 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -200,7 +200,7 @@ export class QuickOpenController extends Component implements IQuickOpenService const newPick = message || defaultMessage; if (newPick !== currentPick) { currentPick = newPick; - resolve(new TPromise(init)); + resolve(new TPromise(init)); } return !message; @@ -324,7 +324,7 @@ export class QuickOpenController extends Component implements IQuickOpenService this.pickOpenWidget.layout(this.layoutDimensions); } - return new TPromise((complete, error, progress) => { + return new TPromise((complete, error, progress) => { // Detect cancellation while pick promise is loading this.pickOpenWidget.setCallbacks({ @@ -959,7 +959,7 @@ export class QuickOpenController extends Component implements IQuickOpenService }); } - return result.then(null, (error) => { + return result.then(null, (error) => { delete this.mapResolvedHandlersToPrefix[id]; return TPromise.wrapError('Unable to instantiate quick open handler ' + handler.moduleName + ' - ' + handler.ctorName + ': ' + JSON.stringify(error)); @@ -975,7 +975,7 @@ export class QuickOpenController extends Component implements IQuickOpenService } // Otherwise load and create - return this.mapResolvedHandlersToPrefix[id] = this.instantiationService.createInstance(handler); + return this.mapResolvedHandlersToPrefix[id] = this.instantiationService.createInstance(handler); } public layout(dimension: Dimension): void { diff --git a/src/vs/workbench/common/editor/resourceEditorInput.ts b/src/vs/workbench/common/editor/resourceEditorInput.ts index 9611a3eae64f235304281f43cfc2031d452ef494..b99b12ecd05e90263b5570fd8cf51fddf74b9db6 100644 --- a/src/vs/workbench/common/editor/resourceEditorInput.ts +++ b/src/vs/workbench/common/editor/resourceEditorInput.ts @@ -20,7 +20,7 @@ export class ResourceEditorInput extends EditorInput { static ID: string = 'workbench.editors.resourceEditorInput'; - private modelReference: TPromise>; + private modelReference: TPromise>; private resource: URI; private name: string; private description: string; @@ -86,7 +86,7 @@ export class ResourceEditorInput extends EditorInput { if (!(model instanceof ResourceEditorModel)) { ref.dispose(); this.modelReference = null; - return TPromise.wrapError(`Unexpected model for ResourceInput: ${this.resource}`); // TODO@Ben eventually also files should be supported, but we guard due to the dangerous dispose of the model in dispose() + return TPromise.wrapError(`Unexpected model for ResourceInput: ${this.resource}`); // TODO@Ben eventually also files should be supported, but we guard due to the dangerous dispose of the model in dispose() } return model; diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index cb53b2858d35df5b941a13d8403806d46e688e4f..a405f4f2c5317fdfb308098fdd2e116b9bcab0a8 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -260,7 +260,7 @@ export class WorkbenchShell { secondaryButton: nls.localize('prof.restart', "Restart") }); - let createIssue = TPromise.as(undefined); + let createIssue = TPromise.as(void 0); if (primaryButton) { const action = this.workbench.getInstantiationService().createInstance(ReportPerformanceIssueAction, ReportPerformanceIssueAction.ID, ReportPerformanceIssueAction.LABEL); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 2d4a6a61a4ab335b823199b9c7450095eb603da7..4621ddd167c91817213bcf79f82026b19b3d9f65 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -23,9 +23,8 @@ import { toErrorMessage } from 'vs/base/common/errorMessage'; import { Registry } from 'vs/platform/platform'; import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform'; import { IOptions } from 'vs/workbench/common/options'; -import { Position as EditorPosition, IResourceDiffInput, IUntitledResourceInput } from 'vs/platform/editor/common/editor'; +import { Position as EditorPosition, IResourceDiffInput, IUntitledResourceInput, IEditor } from 'vs/platform/editor/common/editor'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor'; import { HistoryService } from 'vs/workbench/services/history/browser/history'; import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart'; @@ -313,7 +312,7 @@ export class Workbench implements IPartService { // Load Editors const editorRestoreStopWatch = StopWatch.create(); compositeAndEditorPromises.push(this.resolveEditorsToOpen().then(inputs => { - let editorOpenPromise: TPromise; + let editorOpenPromise: TPromise; if (inputs.length) { editorOpenPromise = this.editorService.openEditors(inputs.map(input => { return { input, position: EditorPosition.ONE }; })); } else { @@ -698,7 +697,7 @@ export class Workbench implements IPartService { this.workbench.removeClass('nosidebar'); } - let promise = TPromise.as(null); + let promise = TPromise.as(null); // If sidebar becomes hidden, also hide the current active Viewlet if any if (hidden && this.sidebarPart.getActiveViewlet()) { promise = this.sidebarPart.hideActiveViewlet().then(() => { @@ -743,7 +742,7 @@ export class Workbench implements IPartService { this.workbench.removeClass('nopanel'); } - let promise = TPromise.as(null); + let promise = TPromise.as(null); // If panel part becomes hidden, also hide the current active panel if any if (hidden && this.panelPart.getActivePanel()) { promise = this.panelPart.hideActivePanel().then(() => { diff --git a/src/vs/workbench/parts/debug/browser/debugContentProvider.ts b/src/vs/workbench/parts/debug/browser/debugContentProvider.ts index a309d24734958de98a00aaa949610b0dd4a6f3dd..0ad6436765e0ac4e62b9dfbc0f2b1c3118e45064 100644 --- a/src/vs/workbench/parts/debug/browser/debugContentProvider.ts +++ b/src/vs/workbench/parts/debug/browser/debugContentProvider.ts @@ -33,7 +33,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC const process = this.debugService.getViewModel().focusedProcess; if (!process) { - return TPromise.wrapError(localize('unable', "Unable to resolve the resource without a debug session")); + return TPromise.wrapError(localize('unable', "Unable to resolve the resource without a debug session")); } const source = process.sources.get(resource.toString()); let rawSource: DebugProtocol.Source; diff --git a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts index fae65c54f6c09f8713efb119884487f8c1949391..f0d9a852f0287c5ac4bb63a29762c7d39c2605d7 100644 --- a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts +++ b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts @@ -149,9 +149,9 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { return this.send(request, args); } - protected send(command: string, args: any, cancelOnDisconnect = true): TPromise { + protected send(command: string, args: any, cancelOnDisconnect = true): TPromise { return this.initServer().then(() => { - const promise = super.send(command, args).then(response => response, (errorResponse: DebugProtocol.ErrorResponse) => { + const promise = super.send(command, args).then(response => response, (errorResponse: DebugProtocol.ErrorResponse) => { const error = errorResponse && errorResponse.body ? errorResponse.body.error : null; const errorMessage = errorResponse ? errorResponse.message : ''; const telemetryMessage = error ? debug.formatPII(error.format, true, error.variables) : errorMessage; @@ -165,7 +165,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { const userMessage = error ? debug.formatPII(error.format, false, error.variables) : errorMessage; if (error && error.url) { const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info"); - return TPromise.wrapError(errors.create(userMessage, { + return TPromise.wrapError(errors.create(userMessage, { actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => { window.open(error.url); return TPromise.as(null); @@ -173,7 +173,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { })); } - return errors.isPromiseCanceledError(errorResponse) ? undefined : TPromise.wrapError(new Error(userMessage)); + return errors.isPromiseCanceledError(errorResponse) ? undefined : TPromise.wrapError(new Error(userMessage)); }); if (cancelOnDisconnect) { @@ -260,7 +260,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public continue(args: DebugProtocol.ContinueArguments): TPromise { - return this.send('continue', args).then(response => { + return this.send('continue', args).then(response => { this.fireFakeContinued(args.threadId, this.allThreadsContinued); return response; }); @@ -271,7 +271,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public setVariable(args: DebugProtocol.SetVariableArguments): TPromise { - return this.send('setVariable', args); + return this.send('setVariable', args); } public restartFrame(args: DebugProtocol.RestartFrameArguments, threadId: number): TPromise { @@ -282,7 +282,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public completions(args: DebugProtocol.CompletionsArguments): TPromise { - return this.send('completions', args); + return this.send('completions', args); } public disconnect(restart = false, force = false): TPromise { @@ -307,15 +307,15 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public setBreakpoints(args: DebugProtocol.SetBreakpointsArguments): TPromise { - return this.send('setBreakpoints', args); + return this.send('setBreakpoints', args); } public setFunctionBreakpoints(args: DebugProtocol.SetFunctionBreakpointsArguments): TPromise { - return this.send('setFunctionBreakpoints', args); + return this.send('setFunctionBreakpoints', args); } public setExceptionBreakpoints(args: DebugProtocol.SetExceptionBreakpointsArguments): TPromise { - return this.send('setExceptionBreakpoints', args); + return this.send('setExceptionBreakpoints', args); } public configurationDone(): TPromise { @@ -323,31 +323,31 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public stackTrace(args: DebugProtocol.StackTraceArguments): TPromise { - return this.send('stackTrace', args); + return this.send('stackTrace', args); } public exceptionInfo(args: DebugProtocol.ExceptionInfoArguments): TPromise { - return this.send('exceptionInfo', args); + return this.send('exceptionInfo', args); } public scopes(args: DebugProtocol.ScopesArguments): TPromise { - return this.send('scopes', args); + return this.send('scopes', args); } public variables(args: DebugProtocol.VariablesArguments): TPromise { - return this.send('variables', args); + return this.send('variables', args); } public source(args: DebugProtocol.SourceArguments): TPromise { - return this.send('source', args); + return this.send('source', args); } public threads(): TPromise { - return this.send('threads', null); + return this.send('threads', null); } public evaluate(args: DebugProtocol.EvaluateArguments): TPromise { - return this.send('evaluate', args); + return this.send('evaluate', args); } public stepBack(args: DebugProtocol.StepBackArguments): TPromise { diff --git a/src/vs/workbench/parts/debug/node/v8Protocol.ts b/src/vs/workbench/parts/debug/node/v8Protocol.ts index 8c368528db6b8d380d0e159ffe4f8e3796493075..68a938cc11c685906dc6385bc51cb73662e8b56e 100644 --- a/src/vs/workbench/parts/debug/node/v8Protocol.ts +++ b/src/vs/workbench/parts/debug/node/v8Protocol.ts @@ -42,11 +42,11 @@ export abstract class V8Protocol { }); } - protected send(command: string, args: any): TPromise { + protected send(command: string, args: any): TPromise { let errorCallback; - return new TPromise((completeDispatch, errorDispatch) => { + return new TPromise((completeDispatch, errorDispatch) => { errorCallback = errorDispatch; - this.doSend(command, args, (result: DebugProtocol.Response) => { + this.doSend(command, args, (result: R) => { if (result.success) { completeDispatch(result); } else { diff --git a/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts b/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts index a0312dde3aef8bdb8ebec2dcb1cf218a0e3896a7..5eb64ac17908dfc2ed1db3b9c1dc7a050b7888c2 100644 --- a/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts +++ b/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts @@ -188,7 +188,7 @@ class Extension implements IExtension { return readFile(uri.fsPath, 'utf8'); } - return TPromise.wrapError('not available'); + return TPromise.wrapError('not available'); } getChangelog(): TPromise { @@ -199,7 +199,7 @@ class Extension implements IExtension { const changelogUrl = this.local && this.local.changelogUrl; if (!changelogUrl) { - return TPromise.wrapError('not available'); + return TPromise.wrapError('not available'); } const uri = URI.parse(changelogUrl); @@ -208,7 +208,7 @@ class Extension implements IExtension { return readFile(uri.fsPath, 'utf8'); } - return TPromise.wrapError('not available'); + return TPromise.wrapError('not available'); } get dependencies(): string[] { @@ -374,13 +374,13 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService { return TPromise.as(singlePagePager([])); } - return TPromise.wrapError(err); + return TPromise.wrapError>(err); }); } loadDependencies(extension: IExtension): TPromise { if (!extension.dependencies.length) { - return TPromise.wrap(null); + return TPromise.wrap(null); } return this.galleryService.getAllDependencies((extension).gallery) diff --git a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts index 5ff0267140de8333ca3fd26d02d66da05a3a05cd..ec7f682e99c5017a0d3e9ecca2457c5304fe82d2 100644 --- a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts @@ -162,7 +162,7 @@ export class TextFileEditor extends BaseTextEditor { // Offer to create a file from the error if we have a file not found and the name is valid if ((error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND && paths.isValidBasename(paths.basename(input.getResource().fsPath))) { - return TPromise.wrapError(errors.create(toErrorMessage(error), { + return TPromise.wrapError(errors.create(toErrorMessage(error), { actions: [ new Action('workbench.files.action.createMissingFile', nls.localize('createFile', "Create File"), null, true, () => { return this.fileService.updateContent(input.getResource(), '').then(() => { @@ -182,7 +182,7 @@ export class TextFileEditor extends BaseTextEditor { } // Otherwise make sure the error bubbles up - return TPromise.wrapError(error); + return TPromise.wrapError(error); }); } diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index c21b3c3217c712faf1e2038aca603222b5381549..42828e0851608eb8657399d912d0885bc15eb0e4 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -843,7 +843,7 @@ export class ImportFileAction extends BaseFileAction { // if the target exists and is dirty, make sure to revert it. otherwise the dirty contents // of the target file would replace the contents of the imported file. since we already // confirmed the overwrite before, this is OK. - let revertPromise = TPromise.as(null); + let revertPromise = TPromise.as(null); if (this.textFileService.isDirty(targetFile)) { revertPromise = this.textFileService.revertAll([targetFile], { soft: true }); } diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts index 08ca437acbbdc4d2d1522968b74f42ed06ee3b87..3a5216aff96e26e05c4322ffeaa43b6cc929b16d 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts @@ -265,7 +265,7 @@ export class ExplorerView extends CollapsibleViewletView { if (visible) { // If a refresh was requested and we are now visible, run it - let refreshPromise = TPromise.as(null); + let refreshPromise = TPromise.as(null); if (this.shouldRefresh) { refreshPromise = this.doRefresh(); this.shouldRefresh = false; // Reset flag diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts index 5944e3f51ac63d807bd87a6f1cda52a98f3fcd21..c397b67df37b55645f957a027d17944c7394af67 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts @@ -231,7 +231,9 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { } private resolveAsBinary(): TPromise { - return this.instantiationService.createInstance(BinaryEditorModel, this.resource, this.getName()).load(); + return this.instantiationService.createInstance(BinaryEditorModel, this.resource, this.getName()) + .load() + .then(x => x as BinaryEditorModel); } public isResolved(): boolean { diff --git a/src/vs/workbench/parts/git/node/git.lib.ts b/src/vs/workbench/parts/git/node/git.lib.ts index 7fcfca449208ba70edd510efd1db0731953ac14e..98fdbd0c5d4266baaa56f375600575b14c95e183 100644 --- a/src/vs/workbench/parts/git/node/git.lib.ts +++ b/src/vs/workbench/parts/git/node/git.lib.ts @@ -324,7 +324,7 @@ export class Repository { const child = this.show(object); if (!child.stdout) { - return TPromise.wrapError(localize('errorBuffer', "Can't open file from git")); + return TPromise.wrapError(localize('errorBuffer', "Can't open file from git")); } return detectMimesFromStream(child.stdout, null).then(result => { diff --git a/src/vs/workbench/parts/preferences/browser/preferencesService.ts b/src/vs/workbench/parts/preferences/browser/preferencesService.ts index 5f702d7240c10a903bfa7c9148163a193fe148bb..01b0038e7edd793be9ceb30dc3f9c75d70471b9a 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesService.ts @@ -271,11 +271,11 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => { if ((error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) { return this.fileService.updateContent(resource, contents).then(null, error => { - return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", labels.getPathLabel(resource, this.contextService), error))); + return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", labels.getPathLabel(resource, this.contextService), error))); }); } - return TPromise.wrapError(error); + return TPromise.wrapError(error); }); } diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 435e0dea1d72d7e54084ce3ad3381def850a894f..a00926d40bb52971720498221d62f4e1f3d947f6 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -174,7 +174,7 @@ export class FileService implements IFileService { // Guard early against attempts to resolve an invalid file path if (resource.scheme !== 'file' || !resource.fsPath) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: nls.localize('fileInvalidPath', "Invalid file resource ({0})", resource.toString()), fileOperationResult: FileOperationResult.FILE_INVALID_PATH }); @@ -185,7 +185,7 @@ export class FileService implements IFileService { // Return early if resource is a directory if (model.isDirectory) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: nls.localize('fileIsDirectoryError', "File is directory ({0})", absolutePath), fileOperationResult: FileOperationResult.FILE_IS_DIRECTORY }); @@ -193,14 +193,14 @@ export class FileService implements IFileService { // Return early if file not modified since if (options && options.etag && options.etag === model.etag) { - return TPromise.wrapError({ + return TPromise.wrapError({ fileOperationResult: FileOperationResult.FILE_NOT_MODIFIED_SINCE }); } // Return early if file is too large to load if (types.isNumber(model.size) && model.size > MAX_FILE_SIZE) { - return TPromise.wrapError({ + return TPromise.wrapError({ fileOperationResult: FileOperationResult.FILE_TOO_LARGE }); } @@ -212,7 +212,7 @@ export class FileService implements IFileService { // Return error early if client only accepts text and this is not text if (options && options.acceptTextOnly && !isText) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: nls.localize('fileBinaryError', "File seems to be binary and cannot be opened as text"), fileOperationResult: FileOperationResult.FILE_IS_BINARY }); @@ -242,7 +242,7 @@ export class FileService implements IFileService { // bubble up existing file operation results if (!types.isUndefinedOrNull((error).fileOperationResult)) { - return TPromise.wrapError(error); + return TPromise.wrapError(error); } // check if the file does not exist @@ -250,14 +250,14 @@ export class FileService implements IFileService { // Return if file not found if (!exists) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: nls.localize('fileNotFoundError', "File not found ({0})", absolutePath), fileOperationResult: FileOperationResult.FILE_NOT_FOUND }); } // otherwise just give up - return TPromise.wrapError(error); + return TPromise.wrapError(error); }); }); } @@ -427,16 +427,16 @@ export class FileService implements IFileService { // Return early with conflict if target exists and we are not told to overwrite if (exists && !isCaseRename && !overwrite) { - return TPromise.wrapError({ + return TPromise.wrapError({ fileOperationResult: FileOperationResult.FILE_MOVE_CONFLICT }); } // 2.) make sure target is deleted before we move/copy unless this is a case rename of the same file - let deleteTargetPromise = TPromise.as(null); + let deleteTargetPromise = TPromise.as(void 0); if (exists && !isCaseRename) { if (isEqualOrParent(sourcePath, targetPath, !isLinux /* ignorecase */)) { - return TPromise.wrapError(nls.localize('unableToMoveCopyError', "Unable to move/copy. File would replace folder it is contained in.")); // catch this corner case! + return TPromise.wrapError(nls.localize('unableToMoveCopyError', "Unable to move/copy. File would replace folder it is contained in.")); // catch this corner case! } deleteTargetPromise = this.del(uri.file(targetPath)); @@ -468,7 +468,7 @@ export class FileService implements IFileService { // 1.) resolve return pfs.stat(sourcePath).then(stat => { if (stat.isDirectory()) { - return TPromise.wrapError(nls.localize('foldersCopyError', "Folders cannot be copied into the workspace. Please select individual files to copy them.")); // for now we do not allow to import a folder into a workspace + return TPromise.wrapError(nls.localize('foldersCopyError', "Folders cannot be copied into the workspace. Please select individual files to copy them.")); // for now we do not allow to import a folder into a workspace } // 2.) copy @@ -528,7 +528,7 @@ export class FileService implements IFileService { // Return early if file is too large to load if (types.isNumber(model.size) && model.size > MAX_FILE_SIZE) { - return TPromise.wrapError({ + return TPromise.wrapError({ fileOperationResult: FileOperationResult.FILE_TOO_LARGE }); } @@ -615,7 +615,7 @@ export class FileService implements IFileService { if (exists) { return pfs.stat(absolutePath).then(stat => { if (stat.isDirectory()) { - return TPromise.wrapError(new Error('Expected file is actually a directory')); + return TPromise.wrapError(new Error('Expected file is actually a directory')); } // Dirty write prevention @@ -623,7 +623,7 @@ export class FileService implements IFileService { // Find out if content length has changed if (options.etag !== etag(stat.size, options.mtime)) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: 'File Modified Since', fileOperationResult: FileOperationResult.FILE_MODIFIED_SINCE }); @@ -635,7 +635,7 @@ export class FileService implements IFileService { // Throw if file is readonly and we are not instructed to overwrite if (readonly && !options.overwriteReadonly) { - return TPromise.wrapError({ + return TPromise.wrapError({ message: nls.localize('fileReadOnlyError', "File is Read Only"), fileOperationResult: FileOperationResult.FILE_READ_ONLY }); @@ -825,7 +825,7 @@ export class StatResolver { }); } - return new TPromise((c, e) => { + return new TPromise((c, e) => { // Load children this.resolveChildren(this.resource.fsPath, absoluteTargetPaths, options && options.resolveSingleChildDescendants, (children) => { diff --git a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts index b9ad9dd57a9260a291cea69055776c7fa90e22a8..6e0ad503e6bc06ebeb6b2152a87fc4b818e412fd 100644 --- a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts +++ b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts @@ -225,7 +225,7 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding // Target cannot be dirty if not writing into buffer if (this.textFileService.isDirty(this.resource)) { - return TPromise.wrapError(localize('errorKeybindingsFileDirty', "Unable to write because the file is dirty. Please save the **Keybindings** file and try again.")); + return TPromise.wrapError>(localize('errorKeybindingsFileDirty', "Unable to write because the file is dirty. Please save the **Keybindings** file and try again.")); } return this.resolveModelReference() @@ -235,11 +235,11 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding if (model.getValue()) { const parsed = this.parse(model); if (parsed.parseErrors.length) { - return TPromise.wrapError(localize('parseErrors', "Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.")); + return TPromise.wrapError>(localize('parseErrors', "Unable to write keybindings. Please open **Keybindings file** to correct errors/warnings in the file and try again.")); } if (parsed.result) { if (!isArray(parsed.result)) { - return TPromise.wrapError(localize('errorInvalidConfiguration', "Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again.")); + return TPromise.wrapError>(localize('errorInvalidConfiguration', "Unable to write keybindings. **Keybindings file** has an object which is not of type Array. Please open the file to clean up and try again.")); } } else { const content = EOL + '[]'; diff --git a/src/vs/workbench/services/search/node/worker/searchWorker.ts b/src/vs/workbench/services/search/node/worker/searchWorker.ts index 92e0b36f55e044d22a285988f2e4587907ad1247..fa8ff5e61fc6fec19187a1a003485dd9402f38ac 100644 --- a/src/vs/workbench/services/search/node/worker/searchWorker.ts +++ b/src/vs/workbench/services/search/node/worker/searchWorker.ts @@ -86,10 +86,10 @@ export class SearchWorkerEngine { private _searchBatch(args: ISearchWorkerSearchArgs, contentPattern: RegExp, fileEncoding: string): TPromise { if (this.isCanceled) { - return TPromise.wrap(null); + return TPromise.wrap(null); } - return new TPromise(batchDone => { + return new TPromise(batchDone => { const result: ISearchWorkerSearchResult = { matches: [], numMatches: 0, diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index b4ecea4cee08565f2f6dbad665acf7744236b159..234b9c8cc2df118bfdf9e5ec9a1fd4a29d91b3dd 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -347,7 +347,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil } // Otherwise bubble up the error - return TPromise.wrapError(error); + return TPromise.wrapError(error); } private loadWithContent(content: IRawTextContent | IContent, backup?: URI): TPromise { @@ -442,7 +442,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil }, error => { this.createTextEditorModelPromise = null; - return TPromise.wrapError(error); + return TPromise.wrapError(error); }); }); diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts index ad5f64328118ab46e83ae94c7e90e8a13be03329..9f4a1d25852628e9bce2516f38e19c382ad2ae30 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts @@ -240,7 +240,7 @@ export class TextFileEditorModelManager implements ITextFileEditorModelManager { // Remove from pending loads this.mapResourceToPendingModelLoaders.delete(resource); - return TPromise.wrapError(error); + return TPromise.wrapError(error); }); } diff --git a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts index a4dc91343d50b94b17c5e21f0252957ace2a5aa4..2f0e90e0248a4652a558eaf64b4208c264fefb29 100644 --- a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts +++ b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts @@ -85,7 +85,7 @@ class ResourceModelCollection extends ReferenceCollection { if (!model) { console.error(`Unable to open '${resource}' resource is not available.`); // TODO PII - return TPromise.wrapError('resource is not available'); + return TPromise.wrapError('resource is not available'); } return model; @@ -137,7 +137,7 @@ export class TextModelResolverService implements ITextModelResolverService { const cachedModel = this.modelService.getModel(resource); if (!cachedModel) { - return TPromise.wrapError('Cant resolve inmemory resource'); + return TPromise.wrapError>('Cant resolve inmemory resource'); } return TPromise.as(new ImmortalReference(this.instantiationService.createInstance(ResourceEditorModel, resource))); @@ -150,7 +150,7 @@ export class TextModelResolverService implements ITextModelResolverService { err => { ref.dispose(); - return TPromise.wrapError(err); + return TPromise.wrapError>(err); } ); } diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 7895d0433a5be72a9a9b380735ada114133f201d..d5d1d7cd65ab5fec792244696df1f1db4540a8ab 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -158,7 +158,7 @@ export class TestTextFileService extends TextFileService { const error = this.resolveTextContentError; this.resolveTextContentError = null; - return TPromise.wrapError(error); + return TPromise.wrapError(error); } return this.fileService.resolveContent(resource, options).then((content) => {