本文整理匯總了TypeScript中vs/editor/common/viewLayout/viewLineParts.createLineParts函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createLineParts函數的具體用法?TypeScript createLineParts怎麽用?TypeScript createLineParts使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了createLineParts函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('createLineParts can handle unsorted inline decorations', () => {
let lineParts = createLineParts(
1,
1,
'Hello world',
4,
new ViewLineTokens([new ViewLineToken(0, '')], 0, 'Hello world'.length),
[
new InlineDecoration(new Range(1, 5, 1, 7), 'a'),
new InlineDecoration(new Range(1, 1, 1, 3), 'b'),
new InlineDecoration(new Range(1, 2, 1, 8), 'c'),
],
'none'
);
// 01234567890
// Hello world
// ----aa-----
// bb---------
// -cccccc----
assert.deepEqual(lineParts.parts, [
new ViewLineToken(0, ' b'),
new ViewLineToken(1, ' b c'),
new ViewLineToken(2, ' c'),
new ViewLineToken(4, ' a c'),
new ViewLineToken(6, ' c'),
new ViewLineToken(7, ''),
]);
});
示例2: testCreateLineParts
function testCreateLineParts(lineContent: string, tokens: ViewLineToken[], fauxIndentLength: number, renderWhitespace: 'none' | 'boundary' | 'all', expected: ViewLineToken[]): void {
let lineParts = createLineParts(1, 1, lineContent, 4, new ViewLineTokens(tokens, fauxIndentLength, lineContent.length), [], renderWhitespace);
let actual = lineParts.getParts();
assert.deepEqual(actual, expected);
}
示例3: testCreateLineParts
function testCreateLineParts(lineContent: string, tokens: ViewLineToken[], fauxIndentLength: number, renderWhitespace:boolean, indentGuides:number, expected:ViewLineToken[]): void {
let lineParts = createLineParts(1, 1, lineContent, 4, new ViewLineTokens(tokens, fauxIndentLength, lineContent.length), [], renderWhitespace, indentGuides);
let actual = lineParts.getParts();
assert.deepEqual(actual, expected);
}