当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript viewLineRenderer.renderViewLine函数代码示例

本文整理汇总了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">&rarr;&nbsp;&nbsp;&nbsp;</span>',
			'<span class="mtk3">bla</span>',
			'</span>'
		].join('');

		assert.deepEqual(actual.html, expected);
	});
开发者ID:Chan-PH,项目名称:vscode,代码行数:28,代码来源:viewLineRenderer.test.ts

示例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('');
}
开发者ID:diarmaidm,项目名称:vscode,代码行数:26,代码来源:colorizer.ts

示例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('');
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:31,代码来源:colorizer.ts

示例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('');
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:33,代码来源:colorizer.ts

示例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);
		};
	}
开发者ID:Chan-PH,项目名称:vscode,代码行数:29,代码来源:viewLineRenderer.test.ts


注:本文中的vs/editor/common/viewLayout/viewLineRenderer.renderViewLine函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。