mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user