mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Go through an implementation switch for ITextBuffer
This commit is contained in:
@@ -11,10 +11,8 @@ import { Disposable } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as vscode from 'vscode';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { TextSource } from 'vs/editor/common/model/textSource';
|
||||
import { MainContext, ExtHostDocumentContentProvidersShape, MainThreadDocumentContentProvidersShape, IMainContext } from './extHost.protocol';
|
||||
import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors';
|
||||
import { DefaultEndOfLine } from 'vs/editor/common/model';
|
||||
|
||||
export class ExtHostDocumentContentProvider implements ExtHostDocumentContentProvidersShape {
|
||||
|
||||
@@ -56,10 +54,10 @@ export class ExtHostDocumentContentProvider implements ExtHostDocumentContentPro
|
||||
}
|
||||
|
||||
// create lines and compare
|
||||
const textSource = TextSource.fromString(value, DefaultEndOfLine.CRLF);
|
||||
const lines = value.split(/\r\n|\r|\n/);
|
||||
|
||||
// broadcast event when content changed
|
||||
if (!document.equalLines(textSource)) {
|
||||
if (!document.equalLines(lines)) {
|
||||
return this._proxy.$onVirtualDocumentChange(uri, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Range, Position, EndOfLine } from 'vs/workbench/api/node/extHostTypes';
|
||||
import * as vscode from 'vscode';
|
||||
import { getWordAtText, ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper';
|
||||
import { MainThreadDocumentsShape } from './extHost.protocol';
|
||||
import { ITextSource } from 'vs/editor/common/model/textSource';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
const _modeId2WordDefinition = new Map<string, RegExp>();
|
||||
@@ -50,7 +49,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
this._isDirty = false;
|
||||
}
|
||||
|
||||
equalLines({ lines }: ITextSource): boolean {
|
||||
equalLines(lines: string[]): boolean {
|
||||
const len = lines.length;
|
||||
if (len !== this._lines.length) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user