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


TypeScript extHostCommands.ExtHostCommands类代码示例

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


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

示例1: test

	test('dispose calls unregister', function () {

		let lastUnregister: string;

		const shape = new class extends mock<MainThreadCommandsShape>() {
			$registerCommand(id: string): void {
				//
			}
			$unregisterCommand(id: string): void {
				lastUnregister = id;
			}
		};

		const commands = new ExtHostCommands(SingleProxyRPCProtocol(shape), undefined, new NullLogService());
		commands.registerCommand(true, 'foo', (): any => { }).dispose();
		assert.equal(lastUnregister, 'foo');
		assert.equal(CommandsRegistry.getCommand('foo'), undefined);

	});
开发者ID:AllureFer,项目名称:vscode,代码行数:19,代码来源:extHostCommands.test.ts

示例2: test

	test('dispose calls unregister', function () {

		let lastUnregister: string;

		const shape = new class extends mock<MainThreadCommandsShape>() {
			$registerCommand(id: string): TPromise<any> {
				return undefined;
			}
			$unregisterCommand(id: string): TPromise<any> {
				lastUnregister = id;
				return undefined;
			}
		};

		const commands = new ExtHostCommands(OneGetThreadService(shape), undefined, new NoopLogService());
		commands.registerCommand('foo', (): any => { }).dispose();
		assert.equal(lastUnregister, 'foo');
		assert.equal(CommandsRegistry.getCommand('foo'), undefined);

	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:20,代码来源:extHostCommands.test.ts

示例3: open

	private open(data: OpenCommandPipeArgs, res: http.ServerResponse) {
		let { fileURIs, folderURIs, forceNewWindow, diffMode, addMode, forceReuseWindow, waitMarkerFilePath } = data;
		if (folderURIs && folderURIs.length || fileURIs && fileURIs.length) {
			const urisToOpen: IURIToOpen[] = [];
			this.collectURIToOpen(folderURIs, 'folder', urisToOpen);
			this.collectURIToOpen(fileURIs, 'file', urisToOpen);
			if (!forceReuseWindow && urisToOpen.some(o => o.typeHint === 'folder' || (o.typeHint === 'file' && hasWorkspaceFileExtension(o.uri.path)))) {
				forceNewWindow = true;
			}
			const waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : undefined;
			const windowOpenArgs: IOpenSettings = { forceNewWindow, diffMode, addMode, forceReuseWindow, waitMarkerFileURI };
			this._commands.executeCommand('_files.windowOpen', urisToOpen, windowOpenArgs);
		}
		res.writeHead(200);
		res.end();
	}
开发者ID:joelday,项目名称:vscode,代码行数:16,代码来源:extHostCLIServer.ts

示例4: getStatus

	private async getStatus(data: StatusPipeArgs, res: http.ServerResponse) {
		try {
			const status = await this._commands.executeCommand('_issues.getSystemStatus');
			res.writeHead(200);
			res.write(status);
			res.end();
		} catch (err) {
			res.writeHead(500);
			res.write(String(err), err => {
				if (err) {
					console.error(err);
				}
			});
			res.end();
		}
	}
开发者ID:joelday,项目名称:vscode,代码行数:16,代码来源:extHostCLIServer.ts


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