gpt4 book ai didi

visual-studio-code - VSCode 扩展 : How to programmatically show view container in panel

转载 作者:行者123 更新时间:2023-12-05 09:05:08 24 4
gpt4 key购买 nike

我正在编写一个 VSCode 扩展,它有一个 View 容器,其中添加了一个 WebviewView

"contributes": {
"commands": [
{
"command": "showView",
"title": "Show view"
}
],
"viewsContainers": {
"panel": [
{
"id": "mycontainer",
"title": "My Container",
"icon": "media/app.svg"
}
]
},
"views": {
"mycontainer": [
{
"type": "webview",
"id": "myview",
"name": "MyView"
}
]
}
},

showView命令中执行。我想以编程方式使 View myview 显示在 VSCode UI 中。如何做到这一点?

最佳答案

您可以通过使用 View 的 id 并执行 focus 命令来聚焦侧边栏中的 View :

vscode.commands.executeCommand("myview.focus")

关于visual-studio-code - VSCode 扩展 : How to programmatically show view container in panel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67683976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com