在Visual Studio Code devcontainer上重建:保留VSC插件?

问题描述

对于docker或docker-compose devcontainer项目。 Dockerfile或docker-compose.yml文件的每次更改都需要Visual Studio Code重建。这也将删除所有已安装的VSC插件。当它甚至要求添加新的环境变量之类的内容时都要求进行重建时,这确实令人沮丧并浪费时间。

因此,有没有办法以某种方式/在某些地方将插件安装得能够重建?

解决方法

我自己弄清楚了。

有一个.devcontainer/devcontainer.json文件,其中包含以下部分:

    // Add the IDs of extensions you want installed when the container is created.
    "extensions": [
        "ms-python.python","ms-python.vscode-pylance","littlefoxteam.vscode-python-test-adapter"
    ],

安装后,可以在简介屏幕上找到扩展的ID。