VS Code Terminal Automatic Replies

VS Code introduced a new cool feature that allows you to set up the terminal to auto-reply when a prompt is received.

Here I have a very simple script that needs a YES or NO input every time I run it.

Now I can tell the terminal to auto-reply with an answer for me.

Let’s find out!

Terminal Automatic Replies

Press down CTRL + SHIFT + P and type in ‘open settings‘ and open the settings.json file.

Now we need to tell the terminal that we want to use auto-reply for a specific message.

In my case, the message is a question: “Do you want to proceed?”.

When this message is prompted I want to auto-reply with “Yes”.

Run the script and see how the terminal auto-replies with the desired message.

Good to know

One rule of thumb is to be very specific when it comes to the message you want to auto-reply to.

I don’t know if you’ve noticed, but my message is not fully specified, which may mean that if there are other similar messages, the terminal will reply to all of them the same.

This can lead to unexpected errors.

But yeah, if used correctly, this feature can help you save some time by automating common responses.



Let me know what you think about this article through comments below, or on Twitter at @pelu_carol.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.



You may also like...