From c95d90d5575cac400b1cc18373998df9106d01c7 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 6 Jul 2017 16:52:33 +0200 Subject: [PATCH] Expose TextModel.isTooLargeForTokenization() (#30180) --- src/vs/editor/common/editorCommon.ts | 6 ++++++ src/vs/editor/common/model/textModel.ts | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index a6701dcf04716..313e090044b1a 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -695,6 +695,12 @@ export interface ITextModel { */ isTooLargeForHavingARichMode(): boolean; + /** + * The file is so large, that even tokenization is disabled. + * @internal + */ + isTooLargeForTokenization(): boolean; + /** * Search the model. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index 8be42e07af17b..4375667b53cb2 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -95,7 +95,7 @@ export class TextModel implements editorCommon.ITextModel { protected _mightContainRTL: boolean; protected _mightContainNonBasicASCII: boolean; - private _shouldSimplifyMode: boolean; + private readonly _shouldSimplifyMode: boolean; protected readonly _isTooLargeForTokenization: boolean; constructor(rawTextSource: IRawTextSource, creationOptions: editorCommon.ITextModelCreationOptions) { @@ -131,10 +131,13 @@ export class TextModel implements editorCommon.ITextModel { } public isTooLargeForHavingARichMode(): boolean { - this._assertNotDisposed(); return this._shouldSimplifyMode; } + public isTooLargeForTokenization(): boolean { + return this._isTooLargeForTokenization; + } + public getOptions(): editorCommon.TextModelResolvedOptions { this._assertNotDisposed(); return this._options;