I am trying to make use of vscode's window.showInformationMessage method during a command that takes a screenshot of the current screen. After the screenshot has been taken, I use
await window.showInformationMessage(`File saved to ${path}`,"Open", "Copy Path");
Which gives the user the option to either open their saved image in a file explorer or copy the path to the clipboard. However, if the user does not do anything when the Information Message dialog pops up, then this call never resolves. On top of that, the user can run the screenshot command as many times as they would like, and each time the code execution would halt, waiting for the promise to resolve.
I have used two different methods to solve this:
QUESTION 1: what is happening under the hood here? How can I run this command many times if node runs on a single thread? Is another thread being created for each command call or is there a new instance of the extension being created each time I call this command?
QUESTION 2: What is a good way to see all of this? I have used the debugger but it hasn't helped much.