'How to show a yes / no dialog from vs code extension api

I am developing a extension in vscode and at some point i need to ask confirmation from user for some code action.
I would like to prompt a dialog and get either yes or now, i am not able to find any method like confirm or alert in vscode api Can you some one help



Solution 1:[1]

Seems like you're looking for vscode.window.showInformationMessage witch takes two parameters message and ...items (for more info see API reference. Can be used as in this example:

vscode.window
  .showInformationMessage("Do you want to do this?", "Yes", "No")
  .then(answer => {
    if (answer === "Yes") {
      // Run function
    }
  })

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MartinT