diff --git a/src/vs/editor/common/services/bulkEdit.ts b/src/vs/editor/common/services/bulkEdit.ts index 4dc674d4e5d..0143ef864ab 100644 --- a/src/vs/editor/common/services/bulkEdit.ts +++ b/src/vs/editor/common/services/bulkEdit.ts @@ -40,13 +40,13 @@ class ChangeRecorder { public start(): IRecording { - var changes: IStringDictionary = Object.create(null); + const changes: IStringDictionary = Object.create(null); - var stop = this._eventService.addListener2(FileEventType.FILE_CHANGES, (event: FileChangesEvent) => { + const stop = this._eventService.addListener2(FileEventType.FILE_CHANGES, (event: FileChangesEvent) => { event.changes.forEach(change => { - var key = String(change.resource), - array = changes[key]; + const key = String(change.resource); + let array = changes[key]; if (!array) { changes[key] = array = []; @@ -78,7 +78,7 @@ class EditTask { } public addEdit(edit: IResourceEdit): void { - var range: IRange; + let range: IRange; if (!edit.range) { range = this._model.getFullModelRange(); } else { @@ -98,8 +98,8 @@ class EditTask { } protected _getInitialSelections(): Selection[] { - var firstRange = this._edits[0].range; - var initialSelection = new Selection( + const firstRange = this._edits[0].range; + const initialSelection = new Selection( firstRange.startLineNumber, firstRange.startColumn, firstRange.endLineNumber, @@ -109,11 +109,11 @@ class EditTask { } private _getEndCursorSelections(inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[] { - var relevantEditIndex = 0; - for (var i = 0; i < inverseEditOperations.length; i++) { - var editRange = inverseEditOperations[i].range; - for (var j = 0; j < this._initialSelections.length; j++) { - var selectionRange = this._initialSelections[j]; + let relevantEditIndex = 0; + for (let i = 0; i < inverseEditOperations.length; i++) { + const editRange = inverseEditOperations[i].range; + for (let j = 0; j < this._initialSelections.length; j++) { + const selectionRange = this._initialSelections[j]; if (Range.areIntersectingOrTouching(editRange, selectionRange)) { relevantEditIndex = i; break; @@ -121,7 +121,7 @@ class EditTask { } } - var srcRange = inverseEditOperations[relevantEditIndex].range; + const srcRange = inverseEditOperations[relevantEditIndex].range; this._endCursorSelection = new Selection( srcRange.endLineNumber, srcRange.endColumn, @@ -185,7 +185,7 @@ class BulkEditModel { } private _addEdit(edit: IResourceEdit): void { - var array = this._edits[edit.resource.toString()]; + let array = this._edits[edit.resource.toString()]; if (!array) { this._edits[edit.resource.toString()] = array = []; this._numberOfResourcesToModify += 1; @@ -201,20 +201,20 @@ class BulkEditModel { } this._tasks = []; - var promises: TPromise[] = []; + const promises: TPromise[] = []; if (this.progress) { this.progress.total(this._numberOfResourcesToModify * 2); } forEach(this._edits, entry => { - var promise = this._textModelResolverService.resolve(URI.parse(entry.key)).then(model => { + const promise = this._textModelResolverService.resolve(URI.parse(entry.key)).then(model => { if (!model || !model.textEditorModel) { throw new Error(`Cannot load file ${entry.key}`); } - var textEditorModel = model.textEditorModel, - task: EditTask; + const textEditorModel = model.textEditorModel; + let task: EditTask; if (this._sourceModel && textEditorModel.uri.toString() === this._sourceModel.toString()) { this._sourceModelTask = new SourceModelEditTask(textEditorModel, this._sourceSelections); @@ -238,7 +238,7 @@ class BulkEditModel { public apply(): Selection { this._tasks.forEach(task => this.applyTask(task)); - var r: Selection = null; + let r: Selection = null; if (this._sourceModelTask) { r = this._sourceModelTask.getEndCursorSelection(); } diff --git a/src/vs/editor/common/services/resolverService.ts b/src/vs/editor/common/services/resolverService.ts index e0275e77c9a..e3116160fc5 100644 --- a/src/vs/editor/common/services/resolverService.ts +++ b/src/vs/editor/common/services/resolverService.ts @@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import URI from 'vs/base/common/uri'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IModel } from 'vs/editor/common/editorCommon'; -import { ITextEditorModel } from 'vs/platform/editor/common/editor'; +import { ITextEditorModel as IBaseTextEditorModel } from 'vs/platform/editor/common/editor'; import { IDisposable } from 'vs/base/common/lifecycle'; export const ITextModelResolverService = createDecorator('textModelResolverService'); @@ -35,4 +35,12 @@ export interface ITextModelContentProvider { * Given a resource, return the content of the resource as IModel. */ provideTextContent(resource: URI): TPromise; +} + +export interface ITextEditorModel extends IBaseTextEditorModel { + + /** + * Provides access to the underlying IModel. + */ + textEditorModel: IModel; } \ No newline at end of file diff --git a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts index 882e1b798f6..3df5bc33b45 100644 --- a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts @@ -322,7 +322,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC this.textModelResolverService.resolve(result.uri).then(model => { let hoverMessage: MarkedString; if (model && model.textEditorModel) { - const editorModel = model.textEditorModel; + const editorModel = model.textEditorModel; let from = Math.max(1, result.range.startLineNumber); let to: number; diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts index 76db5789f2b..9d5e770208c 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesModel.ts @@ -138,7 +138,7 @@ export class FileReferences { if (!model) { throw new Error(); } - this._preview = new FilePreview(model.textEditorModel); + this._preview = new FilePreview(model.textEditorModel); this._resolved = true; return this; diff --git a/src/vs/platform/extensionManagement/node/extensionManagementUtil.ts b/src/vs/platform/extensionManagement/node/extensionManagementUtil.ts index a39a3cb2b31..5b08344f3f8 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementUtil.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementUtil.ts @@ -13,7 +13,7 @@ export function extensionEquals(one: IExtensionIdentity, other: IExtensionIdenti return one.publisher === other.publisher && one.name === other.name; } -export function getTelemetryData(extension: ILocalExtension | IGalleryExtension): any { +export function getTelemetryData(extension: ILocalExtension | IGalleryExtension) { const local = extension as ILocalExtension; const gallery = extension as IGalleryExtension; diff --git a/src/vs/workbench/api/node/mainThreadSaveParticipant.ts b/src/vs/workbench/api/node/mainThreadSaveParticipant.ts index e07ed69d1da..8e189a9d51d 100644 --- a/src/vs/workbench/api/node/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/node/mainThreadSaveParticipant.ts @@ -148,7 +148,7 @@ class FormatOnSaveParticipant implements INamedSaveParticpant { return; } - const model: IModel = editorModel.textEditorModel; + const model = editorModel.textEditorModel; const versionNow = model.getVersionId(); const {tabSize, insertSpaces} = model.getOptions(); diff --git a/src/vs/workbench/parts/html/browser/html.contribution.ts b/src/vs/workbench/parts/html/browser/html.contribution.ts index d180703b029..ec74f6ad9c9 100644 --- a/src/vs/workbench/parts/html/browser/html.contribution.ts +++ b/src/vs/workbench/parts/html/browser/html.contribution.ts @@ -17,7 +17,7 @@ import { EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; -import { isCommonCodeEditor, ICommonCodeEditor, IModel } from 'vs/editor/common/editorCommon'; +import { isCommonCodeEditor, ICommonCodeEditor } from 'vs/editor/common/editorCommon'; import { HtmlZoneController } from './htmlEditorZone'; import { ITextModelResolverService } from 'vs/editor/common/services/resolverService'; @@ -61,7 +61,7 @@ CommandsRegistry.registerCommand('_workbench.htmlZone', function (accessor: Serv } return accessor.get(ITextModelResolverService).resolve(params.resource).then(model => { - const contents = (model.textEditorModel).getValue(); + const contents = model.textEditorModel.getValue(); HtmlZoneController.getInstance(codeEditor).addZone(params.lineNumber, contents); });