• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript amd.getPathFromAmdModule函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test

	test('Files: extraFiles only', function (done: () => void) {
		this.timeout(testTimeout);
		const engine = new FileSearchEngine({
			type: QueryType.File,
			folderQueries: [],
			extraFileResources: [
				URI.file(path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'site.css'))),
				URI.file(path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'examples', 'company.js'))),
				URI.file(path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'index.html')))
			],
			filePattern: '*.js'
		});

		let count = 0;
		let res: IRawFileMatch;
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
			assert.equal(path.basename(res.relativePath), 'company.js');
			done();
		});
	});
开发者ID:PKRoma,项目名称:vscode,代码行数:27,代码来源:search.test.ts


示例2: test

	test('Files: extraFiles only (with include)', function (done: () => void) {
		this.timeout(testTimeout);
		let engine = new FileSearchEngine({
			folderQueries: [],
			extraFiles: [
				path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'site.css')),
				path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'examples', 'company.js')),
				path.normalize(path.join(getPathFromAmdModule(require, './fixtures'), 'index.html'))
			],
			filePattern: '*.*',
			includePattern: { '**/*.css': true }
		});

		let count = 0;
		let res: IRawFileMatch;
		engine.search((result) => {
			if (result) {
				count++;
			}
			res = result;
		}, () => { }, (error) => {
			assert.ok(!error);
			assert.equal(count, 1);
			assert.equal(path.basename(res.relativePath), 'site.css');
			done();
		});
	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:27,代码来源:search.test.ts


示例3: exec

			exec('which ps', {}, (err, stdout, stderr) => {
				if (err || stderr) {
					if (process.platform !== 'linux') {
						reject(err || new Error(stderr.toString()));
					} else {
						const cmd = JSON.stringify(getPathFromAmdModule(require, 'vs/base/node/ps.sh'));
						exec(cmd, {}, (err, stdout, stderr) => {
							if (err || stderr) {
								reject(err || new Error(stderr.toString()));
							} else {
								parsePsOutput(stdout, addToTree);
								calculateLinuxCpuUsage();
							}
						});
					}
				} else {
					const ps = stdout.toString().trim();
					const args = '-ax -o pid=,ppid=,pcpu=,pmem=,command=';

					// Set numeric locale to ensure '.' is used as the decimal separator
					exec(`${ps} ${args}`, { maxBuffer: 1000 * 1024, env: { LC_NUMERIC: 'en_US.UTF-8' } }, (err, stdout, stderr) => {
						if (err || stderr) {
							reject(err || new Error(stderr.toString()));
						} else {
							parsePsOutput(stdout, addToTree);

							if (process.platform === 'linux') {
								calculateLinuxCpuUsage();
							} else {
								resolve(rootItem);
							}
						}
					});
				}
			});
开发者ID:PKRoma,项目名称:vscode,代码行数:35,代码来源:ps.ts


示例4: calculateLinuxCpuUsage

		} else {	// OS X & Linux
			function calculateLinuxCpuUsage() {
				// Flatten rootItem to get a list of all VSCode processes
				let processes = [rootItem];
				const pids: number[] = [];
				while (processes.length) {
					const process = processes.shift();
					if (process) {
						pids.push(process.pid);
						if (process.children) {
							processes = processes.concat(process.children);
						}
					}
				}

				// The cpu usage value reported on Linux is the average over the process lifetime,
				// recalculate the usage over a one second interval
				// JSON.stringify is needed to escape spaces, https://github.com/nodejs/node/issues/6803
				let cmd = JSON.stringify(getPathFromAmdModule(require, 'vs/base/node/cpuUsage.sh'));
				cmd += ' ' + pids.join(' ');

				exec(cmd, {}, (err, stdout, stderr) => {
					if (err || stderr) {
						reject(err || new Error(stderr.toString()));
					} else {
						const cpuUsage = stdout.toString().split('\n');
						for (let i = 0; i < pids.length; i++) {
							const processInfo = map.get(pids[i])!;
							processInfo.load = parseFloat(cpuUsage[i]);
						}

						resolve(rootItem);
					}
				});
			}
开发者ID:PKRoma,项目名称:vscode,代码行数:35,代码来源:ps.ts


示例5: test

	test('readToMatchingString - empty', function () {
		const file = getPathFromAmdModule(require, './fixtures/empty.txt');

		return stream.readToMatchingString(file, '\n', 10, 100).then((result: string) => {
			assert.equal(result, null);
		});
	});
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:7,代码来源:stream.test.ts


示例6: test

	test('detectEncodingFromBuffer (QWOFF saved as TXT)', function () {
		const file = getPathFromAmdModule(require, './fixtures/some.qwoff.txt');
		return readExactlyByFile(file, 512).then(buffer => {
			const mimes = encoding.detectEncodingFromBuffer(buffer);
			assert.equal(mimes.seemsBinary, true);
		});
	});
开发者ID:developers23,项目名称:vscode,代码行数:7,代码来源:encoding.test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript arrays.coalesce函数代码示例发布时间:2022-05-25
下一篇:
TypeScript actions.IActionRunner类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap