當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript window.onDidChangeTerminalDimensions方法代碼示例

本文整理匯總了TypeScript中vscode.window.onDidChangeTerminalDimensions方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript window.onDidChangeTerminalDimensions方法的具體用法?TypeScript window.onDidChangeTerminalDimensions怎麽用?TypeScript window.onDidChangeTerminalDimensions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.window的用法示例。


在下文中一共展示了window.onDidChangeTerminalDimensions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: timeout

			const reg1 = window.onDidChangeTerminalDimensions(async (event: TerminalDimensionsChangeEvent) => {
				assert.equal(event.terminal, terminal1);
				assert.equal(typeof event.dimensions.columns, 'number');
				assert.equal(typeof event.dimensions.rows, 'number');
				assert.ok(event.dimensions.columns > 0);
				assert.ok(event.dimensions.rows > 0);
				reg1.dispose();
				let terminal2: Terminal;
				const reg2 = window.onDidOpenTerminal((newTerminal) => {
					// This is guarantees to fire before dimensions change event
					if (newTerminal !== terminal1) {
						terminal2 = newTerminal;
						reg2.dispose();
					}
				});
				let firstCalled = false;
				let secondCalled = false;
				const reg3 = window.onDidChangeTerminalDimensions((event: TerminalDimensionsChangeEvent) => {
					if (event.terminal === terminal1) {
						// The original terminal should fire dimension change after a split
						firstCalled = true;
					} else if (event.terminal !== terminal1) {
						// The new split terminal should fire dimension change
						secondCalled = true;
					}
					if (firstCalled && secondCalled) {
						terminal1.dispose();
						terminal2.dispose();
						reg3.dispose();
						done();
					}
				});
				await timeout(500);
				commands.executeCommand('workbench.action.terminal.split');
			});
開發者ID:joelday,項目名稱:vscode,代碼行數:35,代碼來源:window.test.ts


注:本文中的vscode.window.onDidChangeTerminalDimensions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。