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


TypeScript base.TPromise.then方法代码示例

本文整理汇总了TypeScript中vs/base/common/winjs.base.TPromise.then方法的典型用法代码示例。如果您正苦于以下问题:TypeScript base.TPromise.then方法的具体用法?TypeScript base.TPromise.then怎么用?TypeScript base.TPromise.then使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/base/common/winjs.base.TPromise的用法示例。


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

示例1: activateById

	public activateById(extensionId: string): TPromise<void> {
		return this._onReady.then(() => {
			let desc = ExtensionsRegistry.getExtensionDescription(extensionId);
			if (!desc) {
				throw new Error('Extension `' + extensionId + '` is not known');
			}

			return this._activateExtensions([desc], 0);
		});
	}
开发者ID:asotog,项目名称:vscode,代码行数:10,代码来源:abstractExtensionService.ts

示例2: triggerAutoSuggest

	private triggerAutoSuggest(marker: IMarker): void {
		if (this.enableAutoQuckFix && this.state === QuickFixSuggestState.NOT_ACTIVE) {
			this.triggerAutoSuggestPromise = TPromise.timeout(this.autoSuggestDelay);
			this.triggerAutoSuggestPromise.then(() => {
				this.triggerAutoSuggestPromise = null;
				if (marker === this.lastMarker) {
					this.triggerDialog(true, this.editor.getPosition());
				}
			});
		}
	}
开发者ID:13572293130,项目名称:vscode,代码行数:11,代码来源:quickFixModel.ts

示例3: main

export function main(argv: string[]): TPromise<void> {
	let args: ParsedArgs;

	try {
		args = parseCLIProcessArgv(argv);
	} catch (err) {
		console.error(err.message);
		return TPromise.as(null);
	}

	if (args.help) {
		console.log(buildHelpMessage(product.nameLong, product.applicationName, pkg.version));
	} else if (args.version) {
		console.log(`${pkg.version}\n${product.commit}`);
	} else if (shouldSpawnCliProcess(args)) {
		const mainCli = new TPromise<IMainCli>(c => require(['vs/code/node/cliProcessMain'], c));
		return mainCli.then(cli => cli.main(args));
	} else {
		const env = assign({}, process.env, {
			// this will signal Code that it was spawned from this module
			'VSCODE_CLI': '1',
			'ELECTRON_NO_ATTACH_CONSOLE': '1'
		});

		delete env['ELECTRON_RUN_AS_NODE'];

		if (args.verbose) {
			env['ELECTRON_ENABLE_LOGGING'] = '1';
		}

		const options = {
			detached: true,
			env,
		};

		if (!args.verbose) {
			options['stdio'] = 'ignore';
		}

		const child = spawn(process.execPath, argv.slice(2), options);

		if (args.verbose) {
			child.stdout.on('data', (data) => console.log(data.toString('utf8').trim()));
			child.stderr.on('data', (data) => console.log(data.toString('utf8').trim()));
		}

		if (args.wait || args.verbose) {
			return new TPromise<void>(c => child.once('exit', () => c(null)));
		}
	}

	return TPromise.as(null);
}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:53,代码来源:cli.ts

示例4:

		const result = new TPromise<void>((c, e, p) => {
			request.then(c, e, p).done(() => {
				if (!this.activeRequests) {
					return;
				}

				this.activeRequests.splice(this.activeRequests.indexOf(result), 1);

				if (this.activeRequests.length === 0) {
					this.disposeDelayer.trigger(() => this.disposeClient());
				}
			});
		}, () => request.cancel());
开发者ID:liunian,项目名称:vscode,代码行数:13,代码来源:ipc.cp.ts

示例5: constructor

	constructor(outer: TPromise<T>) {

		var completeCallback: ValueCallback,
			errorCallback: ErrorCallback,
			progressCallback: ProgressCallback;

		super((c, e, p) => {
			completeCallback = c,
			errorCallback = e;
			progressCallback = p;
		}, () => {
			// cancel this promise but not the
			// outer promise
			errorCallback(errors.canceled());
		});

		outer.then(completeCallback, errorCallback, progressCallback);
	}
开发者ID:inspiredjw,项目名称:VisualStudioCode,代码行数:18,代码来源:async.ts

示例6: getResults

	public getResults(input: string): TPromise<Model.QuickOpenModel> {
		return this.tasks.then((tasks) => {
			let entries: Model.QuickOpenEntry[] = [];
			if (tasks.length === 0) {
				return new Model.QuickOpenModel(entries);
			}
			tasks = tasks.sort((a, b) => {
				let aKind = a._source.kind;
				let bKind = b._source.kind;
				if (aKind === bKind) {
					return a.name.localeCompare(b.name);
				}
				if (aKind === TaskSourceKind.Workspace) {
					return -1;
				} else {
					return +1;
				}
			});
			let hasWorkspace: boolean = tasks[0]._source.kind === TaskSourceKind.Workspace;
			let hasExtension: boolean = tasks[tasks.length - 1]._source.kind === TaskSourceKind.Extension;
			let groupWorkspace = hasWorkspace && hasExtension;
			let groupExtension = groupWorkspace;
			let hadWorkspace = false;
			for (let task of tasks) {
				let highlights = Filters.matchesContiguousSubString(input, task.name);
				if (!highlights) {
					continue;
				}
				if (task._source.kind === TaskSourceKind.Workspace && groupWorkspace) {
					groupWorkspace = false;
					hadWorkspace = true;
					entries.push(new TaskGroupEntry(this.createEntry(this.taskService, task, highlights), nls.localize('workspace', 'From Workspace'), false));
				} else if (task._source.kind === TaskSourceKind.Extension && groupExtension) {
					groupExtension = false;
					entries.push(new TaskGroupEntry(this.createEntry(this.taskService, task, highlights), nls.localize('extension', 'From Extensions'), hadWorkspace));
				} else {
					entries.push(this.createEntry(this.taskService, task, highlights));
				}
			}
			return new Model.QuickOpenModel(entries);
		});
	}
开发者ID:jhasse,项目名称:vscode,代码行数:42,代码来源:quickOpen.ts

示例7: show

	show(fixes: TPromise<CodeAction[]>, at: { x: number; y: number } | IPosition) {

		const actions = fixes.then(value => {
			return value.map(({command}) => {
				return new Action(command.id, command.title, undefined, true, () => {
					return this._commandService.executeCommand(command.id, ...command.arguments);
				});
			});
		});

		this._contextMenuService.showContextMenu({
			getAnchor: () => {
				if (Position.isIPosition(at)) {
					at = this._toCoords(at);
				}
				return at;
			},
			getActions: () => actions,
			onHide: () => { this._visible = false; }
		});
	}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:21,代码来源:quickFixWidget.ts

示例8: main

export function main(args: string[]): TPromise<void> {
	const argv = parseArgs(args);

	if (argv.help) {
		console.log(helpMessage);
	} else if (argv.version) {
		console.log(pkg.version);
	} else if (shouldSpawnCliProcess(argv)) {
		const mainCli = new TPromise<IMainCli>(c => require(['vs/code/node/cliProcessMain'], c));
		return mainCli.then(cli => cli.main(argv));
	} else {
		const env = assign({}, process.env, {
			// this will signal Code that it was spawned from this module
			'VSCODE_CLI': '1',
			'ELECTRON_NO_ATTACH_CONSOLE': '1'
		});
		delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];

		let options = {
			detacted: true,
			env,
		};
		if (!argv.verbose) {
			options['stdio'] = 'ignore';
		}

		const child = spawn(process.execPath, args, options);

		if (argv.verbose) {
			child.stdout.on('data', (data) => console.log(data.toString('utf8').trim()));
			child.stderr.on('data', (data) => console.log(data.toString('utf8').trim()));
		}

		if (argv.wait || argv.verbose) {
			return new TPromise<void>(c => child.once('exit', () => c(null)));
		}
	}

	return TPromise.as(null);
}
开发者ID:ckapilla,项目名称:vscode,代码行数:40,代码来源:cli.ts

示例9: detectMimetypes

	public detectMimetypes(path: string, treeish?: string): TPromise<string[]> {
		return this.raw.then(raw => raw.detectMimetypes(path, treeish));
	}
开发者ID:sangohan,项目名称:KodeStudio,代码行数:3,代码来源:rawGitService.ts

示例10: sync

	public sync(): TPromise<IRawStatus> {
		return this.raw.then(raw => raw.sync());
	}
开发者ID:sangohan,项目名称:KodeStudio,代码行数:3,代码来源:rawGitService.ts


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