本文整理匯總了TypeScript中vs/editor/common/editorCommon.ITokenizedModel.getLinesContent方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ITokenizedModel.getLinesContent方法的具體用法?TypeScript ITokenizedModel.getLinesContent怎麽用?TypeScript ITokenizedModel.getLinesContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/editorCommon.ITokenizedModel
的用法示例。
在下文中一共展示了ITokenizedModel.getLinesContent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getIndentationEditOperations
function getIndentationEditOperations(model: ITokenizedModel, builder: IEditOperationBuilder, tabSize: number, tabsToSpaces: boolean): void {
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
// Model is empty
return;
}
let spaces = '';
for (let i = 0; i < tabSize; i++) {
spaces += ' ';
}
const content = model.getLinesContent();
for (let i = 0; i < content.length; i++) {
let lastIndentationColumn = model.getLineFirstNonWhitespaceColumn(i + 1);
if (lastIndentationColumn === 0) {
lastIndentationColumn = model.getLineMaxColumn(i + 1);
}
const text = (tabsToSpaces ? content[i].substr(0, lastIndentationColumn).replace(/\t/ig, spaces) :
content[i].substr(0, lastIndentationColumn).replace(new RegExp(spaces, 'gi'), '\t')) +
content[i].substr(lastIndentationColumn);
builder.addEditOperation(new Range(i + 1, 1, i + 1, model.getLineMaxColumn(i + 1)), text);
}
}