mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Extract more code to textSource.ts
This commit is contained in:
@@ -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(); }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user