首页 > 解决方案 > 创建了我自己的viewsContainer - 我可以包含来自其他viewsContainers 的视图吗?

问题描述

我们正在探索在新扩展中为 VS Code 创建自己的 viewContainer,并希望重用来自其他容器的视图,例如资源树、大纲和其他扩展中的其他视图。这可能吗?

例如,我无法找到大纲视图的视图 ID,但希望我能做类似的事情......

"contributes": {
    "viewsContainers": {
        "activitybar": [
            {
                "id": "custom-activity",
                "title": "My Uber-activity",
                "icon": "resources/custom-activity.svg"
            }
        ]
    },
    "views": {
        "custom-activity": [
            {
                "id": "vscode-resources",
                "name": "Resources"
            },
            {
                "id": "vscode-outline",
                "name": "Outline"
            },
            {
                "id": "my-fancy-view",
                "name": "New View"
            }
        ]
    }
}

这可能吗?是否有我们可以引用和重用的 VS Code 环境中已建立视图的已发布 ID 列表?

标签: visual-studio-codevscode-extensions

解决方案


这是一个有趣的问题。根据消息来源,大纲视图的 ID 很简单"outline"

export const OutlineViewId = 'outline';

嗯,好吧,让我们试试……

"views": {
    "custom-activity": [
        {
            "id": "outline",
            "name": "outline"
        }
    ]
}

好的,让我们点击我们的自定义视图容器......哦。

嗯,是的,我认为公平地说,目前支持此功能。我已将其报告为此处的问题。


推荐阅读