xterm@4.18.0-beta.4

Adds decoration API, fixes  #140308
This commit is contained in:
meganrogge 2022-02-10 12:40:33 -06:00
parent 80fd8b36ea
commit a365e5c3b1
No known key found for this signature in database
GPG key ID: 1367081C49377970
7 changed files with 164 additions and 25 deletions

View file

@ -85,12 +85,12 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "6.0.0",
"xterm": "4.18.0-beta.2",
"xterm": "4.18.0-beta.4",
"xterm-addon-search": "0.9.0-beta.10",
"xterm-addon-serialize": "0.7.0-beta.8",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24",
"xterm-headless": "4.18.0-beta.2",
"xterm-headless": "4.18.0-beta.4",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},

View file

@ -24,12 +24,12 @@
"vscode-proxy-agent": "^0.12.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "6.0.0",
"xterm": "4.18.0-beta.2",
"xterm": "4.18.0-beta.4",
"xterm-addon-search": "0.9.0-beta.10",
"xterm-addon-serialize": "0.7.0-beta.8",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24",
"xterm-headless": "4.18.0-beta.2",
"xterm-headless": "4.18.0-beta.4",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},

View file

@ -10,7 +10,7 @@
"tas-client-umd": "0.1.4",
"vscode-oniguruma": "1.6.1",
"vscode-textmate": "6.0.0",
"xterm": "4.18.0-beta.2",
"xterm": "4.18.0-beta.4",
"xterm-addon-search": "0.9.0-beta.10",
"xterm-addon-unicode11": "0.4.0-beta.3",
"xterm-addon-webgl": "0.12.0-beta.24"

View file

@ -128,7 +128,7 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==
xterm@4.18.0-beta.2:
version "4.18.0-beta.2"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.2.tgz#50e0de2ebe22fd1600e6d7fbc78136a843bb4c1d"
integrity sha512-fzsSI0xL3HuWBuw5o3xPcR8/R8tTpSd60hHtf0Z2ZrIXDRdniJMw+StOv/xZNp2CUY6LcSiF9MmM0ylgiLHbdw==
xterm@4.18.0-beta.4:
version "4.18.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.4.tgz#547faa85d8388f6f344d9589dca951177e9ecb23"
integrity sha512-+8uuHuyLTFKVIkRGELJnooR+VkEGBHL+04LXLqXtf8b52W2acUCFq2uL2gTGAIPKbrP14WDiF+dG1m7YctDKTQ==

View file

@ -928,15 +928,15 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==
xterm-headless@4.18.0-beta.2:
version "4.18.0-beta.2"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.18.0-beta.2.tgz#b930ac8a79626ef4443cd3ab1a86d1a96039fef8"
integrity sha512-V4CSLfjqE1/pV+3HEs8l0T5W3FORoVX2f17AIUTSsuXUunNXcpib+g6ExxnR9Nm5ztbYnmZIX8AA3mClpqO1OQ==
xterm-headless@4.18.0-beta.4:
version "4.18.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.18.0-beta.4.tgz#6083fdbcf6357756be0f21336cb99dae6fc81ed1"
integrity sha512-0wOzTHltRBZxYjvAGTsFthNS08hEZBdxDPnFMRSP3RgPEwUB/6nlK2q4/RKyWkLYm4XPuKKk8lrSE43awm/7WA==
xterm@4.18.0-beta.2:
version "4.18.0-beta.2"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.2.tgz#50e0de2ebe22fd1600e6d7fbc78136a843bb4c1d"
integrity sha512-fzsSI0xL3HuWBuw5o3xPcR8/R8tTpSd60hHtf0Z2ZrIXDRdniJMw+StOv/xZNp2CUY6LcSiF9MmM0ylgiLHbdw==
xterm@4.18.0-beta.4:
version "4.18.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.4.tgz#547faa85d8388f6f344d9589dca951177e9ecb23"
integrity sha512-+8uuHuyLTFKVIkRGELJnooR+VkEGBHL+04LXLqXtf8b52W2acUCFq2uL2gTGAIPKbrP14WDiF+dG1m7YctDKTQ==
yauzl@^2.9.2:
version "2.10.0"

View file

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Terminal } from 'xterm';
import { strictEqual } from 'assert';
import { timeout } from 'vs/base/common/async';
import * as sinon from 'sinon';
import { ShellIntegrationAddon } from 'vs/workbench/contrib/terminal/browser/xterm/shellIntegrationAddon';
import { ITerminalCapabilityStore, TerminalCapability } from 'vs/workbench/contrib/terminal/common/capabilities/capabilities';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
async function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise<void>((resolve, reject) => {
const failTimeout = timeout(2000);
failTimeout.then(() => reject('Writing to xterm is taking longer than 2 seconds'));
terminal.write(data, () => {
failTimeout.cancel();
resolve();
});
});
}
class TestShellIntegrationAddon extends ShellIntegrationAddon {
getCommandDetectionMock(terminal: Terminal): sinon.SinonMock {
const capability = super._createOrGetCommandDetection(terminal);
this.capabilities.add(TerminalCapability.CommandDetection, capability);
return sinon.mock(capability);
}
getCwdDectionMock(): sinon.SinonMock {
const capability = super._createOrGetCwdDetection();
this.capabilities.add(TerminalCapability.CwdDetection, capability);
return sinon.mock(capability);
}
}
suite('DecorationAddon', () => {
let xterm: Terminal;
let shellIntegrationAddon: TestShellIntegrationAddon;
let capabilities: ITerminalCapabilityStore;
setup(() => {
xterm = new Terminal({
cols: 80,
rows: 30
});
const instantiationService = new TestInstantiationService();
instantiationService.stub(ILogService, NullLogService);
shellIntegrationAddon = instantiationService.createInstance(TestShellIntegrationAddon);
xterm.loadAddon(shellIntegrationAddon);
capabilities = shellIntegrationAddon.capabilities;
});
suite('cwd detection', async () => {
test('should activate capability on the cwd sequence (OSC 1337 ; CurrentDir=<cwd> ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CwdDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CwdDetection), false);
await writeP(xterm, '\x1b]1337;CurrentDir=/foo\x07');
strictEqual(capabilities.has(TerminalCapability.CwdDetection), true);
});
test('should pass cwd sequence to the capability', async () => {
const mock = shellIntegrationAddon.getCwdDectionMock();
mock.expects('updateCwd').once().withExactArgs('/foo');
await writeP(xterm, '\x1b]1337;CurrentDir=/foo\x07');
mock.verify();
});
});
suite('command tracking', async () => {
test('should activate capability on the prompt start sequence (OSC 133 ; A ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, '\x1b]133;A\x07');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), true);
});
test('should pass prompt start sequence to the capability', async () => {
const mock = shellIntegrationAddon.getCommandDetectionMock(xterm);
mock.expects('handlePromptStart').once().withExactArgs();
await writeP(xterm, '\x1b]133;A\x07');
mock.verify();
});
test('should activate capability on the command start sequence (OSC 133 ; B ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, '\x1b]133;B\x07');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), true);
});
test('should pass command start sequence to the capability', async () => {
const mock = shellIntegrationAddon.getCommandDetectionMock(xterm);
mock.expects('handleCommandStart').once().withExactArgs();
await writeP(xterm, '\x1b]133;B\x07');
mock.verify();
});
test('should activate capability on the command executed sequence (OSC 133 ; C ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, '\x1b]133;C\x07');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), true);
});
test('should pass command executed sequence to the capability', async () => {
const mock = shellIntegrationAddon.getCommandDetectionMock(xterm);
mock.expects('handleCommandExecuted').once().withExactArgs();
await writeP(xterm, '\x1b]133;C\x07');
mock.verify();
});
test('should activate capability on the command finished sequence (OSC 133 ; D ; <ExitCode> ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, '\x1b]133;D;7\x07');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), true);
});
test('should pass command finished sequence to the capability', async () => {
const mock = shellIntegrationAddon.getCommandDetectionMock(xterm);
mock.expects('handleCommandFinished').once().withExactArgs(7);
await writeP(xterm, '\x1b]133;D;7\x07');
mock.verify();
});
test('should not activate capability on the cwd sequence (OSC 1337 ; CurrentDir=<cwd> ST)', async () => {
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, 'foo');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
await writeP(xterm, '\x1b]1337;CurrentDir=/foo\x07');
strictEqual(capabilities.has(TerminalCapability.CommandDetection), false);
});
test('should pass cwd sequence to the capability if it\'s initialized', async () => {
const mock = shellIntegrationAddon.getCommandDetectionMock(xterm);
mock.expects('setCwd').once().withExactArgs('/foo');
await writeP(xterm, '\x1b]1337;CurrentDir=/foo\x07');
mock.verify();
});
});
});

View file

@ -12368,15 +12368,15 @@ xterm-addon-webgl@0.12.0-beta.24:
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.24.tgz#5c17256933991856554c95c9bd1eaab42e9727a0"
integrity sha512-+wZxKReEOlfN9JRHyikoffA6Do61/THR7QY35ajkQo0lLutKr6hTd/TLTuZh0PhFVelgTgudpXqlP++Lc0WFIA==
xterm-headless@4.18.0-beta.2:
version "4.18.0-beta.2"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.18.0-beta.2.tgz#b930ac8a79626ef4443cd3ab1a86d1a96039fef8"
integrity sha512-V4CSLfjqE1/pV+3HEs8l0T5W3FORoVX2f17AIUTSsuXUunNXcpib+g6ExxnR9Nm5ztbYnmZIX8AA3mClpqO1OQ==
xterm-headless@4.18.0-beta.4:
version "4.18.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.18.0-beta.4.tgz#6083fdbcf6357756be0f21336cb99dae6fc81ed1"
integrity sha512-0wOzTHltRBZxYjvAGTsFthNS08hEZBdxDPnFMRSP3RgPEwUB/6nlK2q4/RKyWkLYm4XPuKKk8lrSE43awm/7WA==
xterm@4.18.0-beta.2:
version "4.18.0-beta.2"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.2.tgz#50e0de2ebe22fd1600e6d7fbc78136a843bb4c1d"
integrity sha512-fzsSI0xL3HuWBuw5o3xPcR8/R8tTpSd60hHtf0Z2ZrIXDRdniJMw+StOv/xZNp2CUY6LcSiF9MmM0ylgiLHbdw==
xterm@4.18.0-beta.4:
version "4.18.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.18.0-beta.4.tgz#547faa85d8388f6f344d9589dca951177e9ecb23"
integrity sha512-+8uuHuyLTFKVIkRGELJnooR+VkEGBHL+04LXLqXtf8b52W2acUCFq2uL2gTGAIPKbrP14WDiF+dG1m7YctDKTQ==
y18n@^3.2.1:
version "3.2.2"