thur
thur

Reputation: 1074

How to create a custom dialog in VSCode?

I'm developing an extension for VSCode, and I want to display a custom dialog to help the user configure an ini file.

Is it possible to create a custom dialog with labels and inputs?

Upvotes: 16

Views: 15949

Answers (1)

Llewey
Llewey

Reputation: 9222

You cannot create new UI elements, but if you want to get inputs from the user you can use code like below:

let options: InputBoxOptions = {
    prompt: "Label: ",
    placeHolder: "(placeholder)"
}

window.showInputBox(options).then(value => {
    if (!value) return;
    answer1 = value;
    // show the next dialog, etc.
});

This will use the same UI as the command palette (when you press Ctrl+P, or any of the other commands that open the input box at the top).

Upvotes: 23

Related Questions