Expose shell type to extensions (#238071)

* copy everything from #237624

* try to better word notes in proposed.d.ts

* why is test being so flaky

* try sending one more text

* strictEqual only on isInteractedWith always fails

* update the name as recommended

* embed to make sure we are selecting event we are interested in as recommended

* add node as part of TerminalShellType

* getting type ..extHostTypes.TerminalShellType.Bash is not comparable to type ..vscode.TerminalShellType.Bash

* just use one enum?

* figured out how to get from extHostTypes

* clean up
This commit is contained in:
Anthony Kim
2025-01-17 16:19:02 -05:00
committed by GitHub
parent bc0427374f
commit 57e4810cae
10 changed files with 142 additions and 11 deletions

View File

@@ -231,19 +231,40 @@ import { assertNoRpc, poll } from '../utils';
});
});
test('onDidChangeTerminalState should fire after writing to a terminal', async () => {
test('onDidChangeTerminalState should fire with isInteractedWith after writing to a terminal', async () => {
const terminal = window.createTerminal();
deepStrictEqual(terminal.state, { isInteractedWith: false });
strictEqual(terminal.state.isInteractedWith, false);
const eventState = await new Promise<TerminalState>(r => {
disposables.push(window.onDidChangeTerminalState(e => {
if (e === terminal) {
if (e === terminal && e.state.isInteractedWith) {
r(e.state);
}
}));
terminal.sendText('test');
});
deepStrictEqual(eventState, { isInteractedWith: true });
deepStrictEqual(terminal.state, { isInteractedWith: true });
strictEqual(eventState.isInteractedWith, true);
await new Promise<void>(r => {
disposables.push(window.onDidCloseTerminal(t => {
if (t === terminal) {
r();
}
}));
terminal.dispose();
});
});
test('onDidChangeTerminalState should fire with shellType when created', async () => {
const terminal = window.createTerminal();
if (terminal.state.shellType) {
return;
}
await new Promise<void>(r => {
disposables.push(window.onDidChangeTerminalState(e => {
if (e === terminal && e.state.shellType) {
r();
}
}));
});
await new Promise<void>(r => {
disposables.push(window.onDidCloseTerminal(t => {
if (t === terminal) {