本文整理汇总了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');
}