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


TypeScript idGenerator.defaultGenerator类代码示例

本文整理汇总了TypeScript中vs/base/common/idGenerator.defaultGenerator的典型用法代码示例。如果您正苦于以下问题:TypeScript defaultGenerator类的具体用法?TypeScript defaultGenerator怎么用?TypeScript defaultGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了defaultGenerator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();

			// {{SQL CARBON EDIT}} - Promise.all not returning the strValue properly in original code?
			const promise = value.then(strValue => {
				withInnerHTML.then(e => {
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}).catch(err => {
					// ignore
				});
			});

			// original VS Code source
			// const promise = Promise.all([value, withInnerHTML]).then(values => {
			// 	const strValue = values[0];
			// 	const span = element.querySelector(`div[data-code="${id}"]`);
			// 	if (span) {
			// 		span.innerHTML = strValue;
			// 	}
			// }).catch(err => {
			// 	// ignore
			// });

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:35,代码来源:htmlContentRenderer.ts

示例2:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer!(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();
			const promise = Promise.all([value, withInnerHTML]).then(values => {
				const strValue = values[0];
				const span = element.querySelector(`div[data-code="${id}"]`);
				if (span) {
					span.innerHTML = strValue;
				}
			}).catch(err => {
				// ignore
			});

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
开发者ID:DonJayamanne,项目名称:vscode,代码行数:21,代码来源:htmlContentRenderer.ts

示例3:

			renderer.code = (code, lang) => {
				let value = options.codeBlockRenderer(lang, code);
				if (typeof value === 'string') {
					return value;
				}

				if (TPromise.is(value)) {
					// when code-block rendering is async we return sync
					// but update the node with the real result later.
					const id = defaultGenerator.nextId();
					TPromise.join([value, withInnerHTML]).done(values => {
						let [value] = values;
						let span = element.querySelector(`span[data-code="${id}"]`);
						if (span) {
							span.innerHTML = value;
						}
					}, err => {
						// ignore
					});
					return `<span data-code="${id}">${code}</span>`;
				}

				return code;
			};
开发者ID:Magicwalker,项目名称:vscode,代码行数:24,代码来源:htmlContentRenderer.ts

示例4:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			if (typeof value === 'string') {
				return value;
			}

			if (TPromise.is(value)) {
				// when code-block rendering is async we return sync
				// but update the node with the real result later.
				const id = defaultGenerator.nextId();
				TPromise.join([value, withInnerHTML]).done(values => {
					const strValue = values[0] as string;
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}, err => {
					// ignore
				});
				return `<div class="code" data-code="${id}">${escape(code)}</div>`;
			}

			return code;
		};
开发者ID:gokulakrishna9,项目名称:vscode,代码行数:24,代码来源:htmlContentRenderer.ts

示例5: constructor

	constructor(node: any, provider: TreeExplorerNodeProvider<any>) {
		this.id = defaultGenerator.nextId();
		this.label = provider.getLabel ? provider.getLabel(node) : node.toString();
		this.hasChildren = provider.getHasChildren ? provider.getHasChildren(node) : true;
		this.clickCommand = provider.getClickCommand ? provider.getClickCommand(node) : null;
	}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:6,代码来源:extHostTreeExplorers.ts


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