本文整理匯總了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');
});