本文整理匯總了TypeScript中vs/editor/common/viewLayout/viewLineRenderer.renderViewLine2函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript renderViewLine2函數的具體用法?TypeScript renderViewLine2怎麽用?TypeScript renderViewLine2使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了renderViewLine2函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: renderViewLine
test('issue #33525: Long line with ligatures takes a long time to paint decorations - not possible', () => {
let actual = renderViewLine(new RenderLineInput(
false,
false,
'appenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatato',
false,
true,
false,
0,
createViewLineTokens([createPart(194, 3)]),
[],
4,
10,
10000,
'none',
false,
true
));
let expected = [
'<span>',
'<span class="mtk3">appenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatatoappenddatato</span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});
示例2: createViewLineTokens
test('issue #2255: Weird line rendering part 2', () => {
let lineText = ' \t\t\tcursorStyle:\t\t\t\t\t\t(prevOpts.cursorStyle !== newOpts.cursorStyle),';
let lineParts = createViewLineTokens([
createPart(4, 1), // 4 chars
createPart(16, 2), // 12 chars
createPart(22, 3), // 6 chars
createPart(23, 4), // 1 char
createPart(44, 5), // 21 chars
createPart(46, 6), // 2 chars
createPart(47, 7), // 1 char
createPart(67, 8), // 20 chars
createPart(68, 9), // 1 char
createPart(69, 10), // 2 chars
]);
let expectedOutput = [
'<span class="mtk1">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0</span>',
'<span class="mtk2">cursorStyle:</span>',
'<span class="mtk3">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0</span>',
'<span class="mtk4">(</span>',
'<span class="mtk5">prevOpts.cursorStyle\u00a0</span>',
'<span class="mtk6">!=</span>',
'<span class="mtk7">=</span>',
'<span class="mtk8">\u00a0newOpts.cursorStyle</span>',
'<span class="mtk9">)</span>',
'<span class="mtk10">,</span>',
].join('');
let expectedOffsetsArr = [
[0, 1, 4, 8], // 4 chars
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], // 12 chars
[0, 4, 8, 12, 16, 20], // 6 chars
[0], // 1 char
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], // 21 chars
[0, 1], // 2 chars
[0], // 1 char
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], // 20 chars
[0], // 1 char
[0, 1] // 2 chars
];
let _actual = renderViewLine(new RenderLineInput(
false,
lineText,
false,
true,
false,
0,
lineParts,
[],
4,
10,
-1,
'none',
false,
false
));
assert.equal(_actual.html, '<span>' + expectedOutput + '</span>');
assertCharacterMapping(_actual.characterMapping, expectedOffsetsArr, [12, 12, 24, 1, 21, 2, 1, 20, 1, 1]);
});
示例3: renderViewLine
test('issue #42700: Hindi characters are not being rendered properly', () => {
let actual = renderViewLine(new RenderLineInput(
true,
' ा༠ŕ¤ŕ¤¸ŕ¤ž ŕ¤ŕĽŕ¤Żŕ¤ž च༠ŕ¤ŕĽ चऎञर༠ŕ¤
ŕ¤ŕ¤Śŕ¤° ŕ¤ŕĽ च༠ŕ¤ŕ¤° एञचर ŕ¤ŕĽ चŕĽŕĽ¤ ŕ¤ŕ¤żŕ¤¸ŕ¤ŕĽ ाŕ¤ŕ¤š स༠चऎ सए चŕĽŕ¤ŕĽ¤ ŕ¤ŕ¤żŕ¤¸ŕ¤¨ŕĽ ŕ¤ŕ¤¸ सŕĽŕ¤ˇŕĽŕ¤ŕ¤ż ŕ¤ŕĽ रŕ¤ŕ¤¨ŕ¤ž ŕ¤ŕĽ चŕĽŕĽ¤',
false,
false,
false,
0,
createViewLineTokens([createPart(105, 3)]),
[],
4,
10,
10000,
'none',
false,
false
));
let expected = [
'<span>',
'<span class="mtk3">\u00a0ाŕĽ\u00a0ŕ¤ŕ¤¸ŕ¤ž\u00a0ŕ¤ŕĽŕ¤Żŕ¤ž\u00a0चŕĽ\u00a0ŕ¤ŕĽ\u00a0चऎञरŕĽ\u00a0ŕ¤
ŕ¤ŕ¤Śŕ¤°\u00a0ŕ¤ŕĽ\u00a0चŕĽ\u00a0ŕ¤ŕ¤°\u00a0एञचर\u00a0ŕ¤ŕĽ\u00a0चŕĽŕĽ¤\u00a0ŕ¤ŕ¤żŕ¤¸ŕ¤ŕĽ\u00a0ाŕ¤ŕ¤š\u00a0सŕĽ\u00a0चऎ\u00a0सए\u00a0चŕĽŕ¤ŕĽ¤\u00a0ŕ¤ŕ¤żŕ¤¸ŕ¤¨ŕĽ\u00a0ŕ¤ŕ¤¸\u00a0सŕĽŕ¤ˇŕĽŕ¤ŕ¤ż\u00a0ŕ¤ŕĽ\u00a0रŕ¤ŕ¤¨ŕ¤ž\u00a0ŕ¤ŕĽ\u00a0चŕĽŕĽ¤</span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});
示例4: renderViewLine
test('issue #32436: Non-monospace font + visible whitespace + After decorator causes line to "jump"', () => {
let lineContent = '\tbla';
let actual = renderViewLine(new RenderLineInput(
false,
lineContent,
false,
true,
false,
0,
createViewLineTokens([createPart(4, 3)]),
[new LineDecoration(2, 3, 'before', InlineDecorationType.Before)],
4,
10,
-1,
'all',
false,
true
));
let expected = [
'<span>',
'<span class="vs-whitespace" style="width:40px">\u2192\u00a0\u00a0\u00a0</span>',
'<span class="mtk3 before">b</span>',
'<span class="mtk3">la</span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});
示例5: LineDecoration
test('issue #38935: GitLens end-of-line blame no longer rendering', () => {
let actual = renderViewLine(new RenderLineInput(
true,
'\t}',
false,
true,
false,
0,
createViewLineTokens([createPart(2, 3)]),
[
new LineDecoration(3, 3, 'ced-TextEditorDecorationType2-5e9b9b3f-3 ced-TextEditorDecorationType2-3', InlineDecorationType.Before),
new LineDecoration(3, 3, 'ced-TextEditorDecorationType2-5e9b9b3f-4 ced-TextEditorDecorationType2-4', InlineDecorationType.After),
],
4,
10,
10000,
'none',
false,
false
));
let expected = [
'<span>',
'<span class="mtk3">\u00a0\u00a0\u00a0\u00a0}</span>',
'<span class="ced-TextEditorDecorationType2-5e9b9b3f-3 ced-TextEditorDecorationType2-3 ced-TextEditorDecorationType2-5e9b9b3f-4 ced-TextEditorDecorationType2-4"></span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});
示例6: tabs
test('issue #22832: Consider fullwidth characters when rendering tabs (render whitespace)', () => {
let actual = renderViewLine(new RenderLineInput(
true,
'asd = "ćŚ"\t\t#asd',
false,
false,
false,
0,
createViewLineTokens([createPart(15, 3)]),
[],
4,
10,
10000,
'all',
false,
false
));
let expected = [
'<span>',
'<span class="mtk3">asd</span>',
'<span class="vs-whitespace">\u00b7</span>',
'<span class="mtk3">=</span>',
'<span class="vs-whitespace">\u00b7</span>',
'<span class="mtk3">"ćŚ"</span>',
'<span class="vs-whitespace">\u2192\u00a0\u2192\u00a0\u00a0\u00a0</span>',
'<span class="mtk3">#asd</span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});