visual-studio-code - 如何从 vs 代码扩展 api 显示是/否对话框
问题描述
我正在开发 vscode 中的扩展,在某些时候我需要向用户确认某些代码操作。
我想提示一个对话框并得到是或现在,我无法在 vscode api 中找到任何方法,如确认或警报,你能帮忙吗
解决方案
好像您正在寻找vscode.window.showInformationMessage
女巫需要两个参数message
和...items
(有关更多信息,请参阅API 参考。可以在此示例中使用:
vscode.window
.showInformationMessage("Do you want to do this?", "Yes", "No")
.then(answer => {
if (answer === "Yes") {
// Run function
}
})
推荐阅读
- php - PHP下载而不是运行
- redis - Redis 启动服务器(如果通过 snap 安装)
- css - 我在 React Table 单元格中找不到导致 div 边距的原因
- amazon-ecs - 排错 ECS 容器日志到 sqs
- python - 为什么我的敌人移动脚本在 pygame 中不起作用
- javascript - 如何将所有对象组成一个数组并删除重复项?
- python - 打印不带单引号和括号的字符串
- jquery - 使用 jQuery Ajax 时,为什么一切都使用 POST 方法完成?我查了一下,并不能真正找到一个明确的答案
- mysql - 如何强制 MySql 不锁定触发器中使用的所有表
- javascript - 无法跨一对多查询属性 NestJS 和 TypeORM