本文整理匯總了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);
};
}