提交 4f3327d9 编写于 作者: A Alex Dima

Clarify usage of TextModel.isTooLargeForHavingAMode() (#30180)

上级 80cfe84e
......@@ -688,13 +688,6 @@ export interface ITextModel {
*/
isDisposed(): boolean;
/**
* No mode supports allowed on this model because it is simply too large.
* (even tokenization would cause too much memory pressure)
* @internal
*/
isTooLargeForHavingAMode(): boolean;
/**
* Only basic mode supports allowed on this model because it is simply too large.
* (tokenization is allowed and other basic supports)
......
......@@ -94,7 +94,7 @@ export class TextModel implements editorCommon.ITextModel {
protected _mightContainNonBasicASCII: boolean;
private _shouldSimplifyMode: boolean;
private _shouldDenyMode: boolean;
protected readonly _isTooLargeForTokenization: boolean;
constructor(rawTextSource: IRawTextSource, creationOptions: editorCommon.ITextModelCreationOptions) {
this._eventEmitter = new OrderGuaranteeEventEmitter();
......@@ -102,7 +102,11 @@ export class TextModel implements editorCommon.ITextModel {
const textModelData = TextModel.resolveCreationData(rawTextSource, creationOptions);
this._shouldSimplifyMode = (textModelData.text.length > TextModel.MODEL_SYNC_LIMIT);
this._shouldDenyMode = (textModelData.text.length > TextModel.MODEL_TOKENIZATION_LIMIT);
// !!! Make a decision in the ctor and permanently respect this decision !!!
// If a model is too large at construction time, it will never get tokenized,
// under no circumstances.
this._isTooLargeForTokenization = (textModelData.text.length > TextModel.MODEL_TOKENIZATION_LIMIT);
this._options = new editorCommon.TextModelResolvedOptions(textModelData.options);
this._constructLines(textModelData.text);
......@@ -117,11 +121,6 @@ export class TextModel implements editorCommon.ITextModel {
}
}
public isTooLargeForHavingAMode(): boolean {
this._assertNotDisposed();
return this._shouldDenyMode;
}
public isTooLargeForHavingARichMode(): boolean {
this._assertNotDisposed();
return this._shouldSimplifyMode;
......
......@@ -119,7 +119,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
}
this._tokenizationSupport = null;
if (!this.isTooLargeForHavingAMode()) {
if (!this._isTooLargeForTokenization) {
this._tokenizationSupport = TokenizationRegistry.get(this._languageIdentifier.language);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册