Extract more code to textSource.ts

This commit is contained in:
Alex Dima
2017-03-02 16:45:06 +01:00
parent 220a10c28d
commit 668dc0675d
22 changed files with 131 additions and 119 deletions

View File

@@ -27,6 +27,7 @@ import { IWorkspace } from 'vs/platform/workspace/common/workspace';
import * as editorCommon from 'vs/editor/common/editorCommon';
import * as modes from 'vs/editor/common/modes';
import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { ITextSource } from 'vs/editor/common/model/textSource';
import { ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IWorkspaceConfigurationValues } from 'vs/workbench/services/configuration/common/configuration';
@@ -122,7 +123,7 @@ export abstract class MainThreadDocumentsShape {
$tryCreateDocument(options?: { language: string; }): TPromise<any> { throw ni(); }
$tryOpenDocument(uri: URI): TPromise<any> { throw ni(); }
$registerTextContentProvider(handle: number, scheme: string): void { throw ni(); }
$onVirtualDocumentChange(uri: URI, value: editorCommon.ITextSource): void { throw ni(); }
$onVirtualDocumentChange(uri: URI, value: ITextSource): void { throw ni(); }
$unregisterTextContentProvider(handle: number): void { throw ni(); }
$trySaveDocument(uri: URI): TPromise<boolean> { throw ni(); }
}

View File

@@ -20,6 +20,7 @@ import * as vscode from 'vscode';
import { asWinJsPromise } from 'vs/base/common/async';
import { getWordAtText, ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper';
import { MainContext, MainThreadDocumentsShape, ExtHostDocumentsShape, IModelAddedData } from './extHost.protocol';
import { ITextSource } from 'vs/editor/common/model/textSource';
const _modeId2WordDefinition = new Map<string, RegExp>();
@@ -263,7 +264,7 @@ export class ExtHostDocumentData extends MirrorModel2 {
super.dispose();
}
equalLines({lines}: editorCommon.ITextSource): boolean {
equalLines({lines}: ITextSource): boolean {
const len = lines.length;
if (len !== this._lines.length) {
return false;

View File

@@ -19,6 +19,7 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un
import { ExtHostContext, MainThreadDocumentsShape, ExtHostDocumentsShape } from './extHost.protocol';
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { ITextSource } from 'vs/editor/common/model/textSource';
export class MainThreadDocuments extends MainThreadDocumentsShape {
private _modelService: IModelService;
@@ -241,12 +242,12 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
}
}
$onVirtualDocumentChange(uri: URI, value: editorCommon.ITextSource): void {
$onVirtualDocumentChange(uri: URI, value: ITextSource): void {
const model = this._modelService.getModel(uri);
if (!model) {
return;
}
const raw: editorCommon.ITextSource = {
const raw: ITextSource = {
lines: value.lines,
length: value.length,
BOM: value.BOM,