microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.64k stars 29.04k forks source link

`onDidOpenTerminal` fires twice for send text #226893

Open justschen opened 1 month ago

justschen commented 1 month ago

Testing #226655

vscode.window.onDidOpenTerminal(e => {
            e.sendText('echo hi');
        }),

this ends up firing twice or an extra "echo hi" shows up

Screenshot 2024-08-27 at 2 26 06 PM

justschen commented 1 month ago

also it seems like e.shellIntegration?.executeCommand('echo hi'); does not work in onDidOpenTerminal

meganrogge commented 1 month ago

@justschen, it's not firing twice. The input is received before the prompt starts, so it gets written to the terminal. You can repro this if you create a terminal and type quickly like the below.

Image