UNPKG

monaco-editor-core

Version:

A browser based code editor

21 lines (20 loc) 916 B
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { AbstractText } from '../core/textEdit.js'; import { TextLength } from '../core/textLength.js'; export class TextModelText extends AbstractText { constructor(_textModel) { super(); this._textModel = _textModel; } getValueOfRange(range) { return this._textModel.getValueInRange(range); } get length() { const lastLineNumber = this._textModel.getLineCount(); const lastLineLen = this._textModel.getLineLength(lastLineNumber); return new TextLength(lastLineNumber - 1, lastLineLen); } }