本文整理汇总了TypeScript中vs/editor/common/viewLayout/viewLineRenderer.renderViewLine函数的典型用法代码示例。如果您正苦于以下问题:TypeScript renderViewLine函数的具体用法?TypeScript renderViewLine怎么用?TypeScript renderViewLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了renderViewLine函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('issue #11485: Visible whitespace conflicts with before decorator attachment', () => {
let lineContent = '\tbla';
let actual = renderViewLine(new RenderLineInput(
false,
lineContent,
false,
0,
[createPart(4, 3)],
[new LineDecoration(1, 2, 'before', true)],
4,
10,
-1,
'all',
false,
true
));
let expected = [
'<span>',
'<span class="vs-whitespace before">→ </span>',
'<span class="mtk3">bla</span>',
'</span>'
].join('');
assert.deepEqual(actual.html, expected);
});
示例2: _fakeColorize
function _fakeColorize(lines: string[], tabSize: number): string {
let html: string[] = [];
for (let i = 0, length = lines.length; i < length; i++) {
let line = lines[i];
let renderResult = renderViewLine(new RenderLineInput(
false,
line,
false,
0,
[new ViewLineToken(line.length, '')],
[],
tabSize,
0,
-1,
'none',
false
));
html = html.concat(renderResult.html);
html.push('<br/>');
}
return html.join('');
}
示例3: _actualColorize
function _actualColorize(lines: string[], tabSize: number, tokenizationSupport: ITokenizationSupport): string {
let html: string[] = [];
let state = tokenizationSupport.getInitialState();
for (let i = 0, length = lines.length; i < length; i++) {
let line = lines[i];
let tokenizeResult = tokenizationSupport.tokenize2(line, state, 0);
let lineTokens = new LineTokens(tokenizeResult.tokens, line);
let renderResult = renderViewLine(new RenderLineInput(
false,
line,
true/* check for RTL */,
0,
lineTokens.inflate(),
[],
tabSize,
0,
-1,
'none',
false,
false
));
html = html.concat(renderResult.html);
html.push('<br/>');
state = tokenizeResult.endState;
}
return html.join('');
}
示例4: _fakeColorize
function _fakeColorize(lines: string[], tabSize: number): string {
let html: string[] = [];
const defaultMetadata = (
(FontStyle.None << MetadataConsts.FONT_STYLE_OFFSET)
| (ColorId.DefaultForeground << MetadataConsts.FOREGROUND_OFFSET)
| (ColorId.DefaultBackground << MetadataConsts.BACKGROUND_OFFSET)
) >>> 0;
for (let i = 0, length = lines.length; i < length; i++) {
let line = lines[i];
let renderResult = renderViewLine(new RenderLineInput(
false,
line,
false,
0,
[new ViewLineToken(line.length, defaultMetadata)],
[],
tabSize,
0,
-1,
'none',
false,
false
));
html = html.concat(renderResult.html);
html.push('<br/>');
}
return html.join('');
}
示例5: createTestGetColumnOfLinePartOffset
function createTestGetColumnOfLinePartOffset(lineContent: string, tabSize: number, parts: ViewLineToken[], expectedPartLengths: number[]): (partIndex: number, partLength: number, offset: number, expected: number) => void {
let renderLineOutput = renderViewLine(new RenderLineInput(
false,
lineContent,
false,
0,
parts,
[],
tabSize,
10,
-1,
'none',
false,
false
));
const partLengths = renderLineOutput.characterMapping.getPartLengths();
let actualPartLengths: number[] = [];
for (let i = 0; i < partLengths.length; i++) {
actualPartLengths[i] = partLengths[i];
}
assert.deepEqual(actualPartLengths, expectedPartLengths, 'part lengths OK');
return (partIndex: number, partLength: number, offset: number, expected: number) => {
let charOffset = renderLineOutput.characterMapping.partDataToCharOffset(partIndex, partLength, offset);
let actual = charOffset + 1;
assert.equal(actual, expected, 'getColumnOfLinePartOffset for ' + partIndex + ' @ ' + offset);
};
}