如何在 VSCode 中创建自定义对话框? [英] How to create a custom dialog in VSCode?
本文介绍了如何在 VSCode 中创建自定义对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为 VSCode 开发一个扩展,我想显示一个自定义对话框来帮助用户配置一个 ini 文件.
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?
推荐答案
你不能创建新的 UI 元素,但如果你想从用户那里获得输入,你可以使用如下代码:
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.
});
这将使用与命令面板相同的 UI(当您按 Ctrl+P 或任何其他打开顶部输入框的命令时).
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).
这篇关于如何在 VSCode 中创建自定义对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文