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


TypeScript amd.getPathFromAmdModule函数代码示例

本文整理汇总了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;未经允许,请勿转载。