本文整理匯總了TypeScript中vs/editor/common/model/textModel.TextModel.getLineDecorations方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TextModel.getLineDecorations方法的具體用法?TypeScript TextModel.getLineDecorations怎麽用?TypeScript TextModel.getLineDecorations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/model/textModel.TextModel
的用法示例。
在下文中一共展示了TextModel.getLineDecorations方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('full line decoration', () => {
addDecoration(thisModel, 1, 1, 2, 1, 'myType');
let line1Decorations = thisModel.getLineDecorations(1);
assert.equal(line1Decorations.length, 1);
assert.equal(line1Decorations[0].options.className, 'myType');
let line2Decorations = thisModel.getLineDecorations(1);
assert.equal(line2Decorations.length, 1);
assert.equal(line2Decorations[0].options.className, 'myType');
lineHasNoDecorations(thisModel, 3);
lineHasNoDecorations(thisModel, 4);
lineHasNoDecorations(thisModel, 5);
});
示例2: test
test('multiple line decoration', () => {
addDecoration(thisModel, 1, 2, 3, 2, 'myType');
var line1Decorations = thisModel.getLineDecorations(1);
assert.equal(line1Decorations.length, 1);
assert.equal(line1Decorations[0].options.className, 'myType');
var line2Decorations = thisModel.getLineDecorations(1);
assert.equal(line2Decorations.length, 1);
assert.equal(line2Decorations[0].options.className, 'myType');
var line3Decorations = thisModel.getLineDecorations(1);
assert.equal(line3Decorations.length, 1);
assert.equal(line3Decorations[0].options.className, 'myType');
lineHasNoDecorations(thisModel, 4);
lineHasNoDecorations(thisModel, 5);
});
示例3: lineHasDecorations
function lineHasDecorations(model: TextModel, lineNumber: number, decorations: { start: number; end: number; className: string; }[]) {
let lineDecorations = [];
let decs = model.getLineDecorations(lineNumber);
for (let i = 0, len = decs.length; i < len; i++) {
lineDecorations.push({
start: decs[i].range.startColumn,
end: decs[i].range.endColumn,
className: decs[i].options.className
});
}
assert.deepEqual(lineDecorations, decorations, 'Line decorations');
}