I need to install a specific version of an extension when I attach via Remote SSH to my running container. This (initially) works as expected if I create a nameConfig
for the container before I attach to it.
{
"workspaceFolder": "/webapp/sites/www",
"extensions": [
"[email protected]",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance",
]
}
The problem is, after attachment, the nameConfig
is overwritten and the extension version number is stripped.
{
"workspaceFolder": "/webapp/sites/www",
"extensions": [
"ms-python.debugpy",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
Is there a way to prevent VS Code from stripping the version number (or from writing the nameConfig altogether)?
I’m running on macOS.
% code --version
1.92.2
fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
x64
I was expecting that custom nameConfig settings would be preserved.
2
Answers
I'm surprised pinning is not offically supported in some fashion. A workaround that has solved my particular issue without any negative side-effects (so far) is to make the config files read-only.
vs code does not natively support locking extension versions unsing devcontainer.json or configuratin file. you need to manually install specific version of extenson after you are attached to it or you can create script to install specific version of extensions and run the script as postAttachCommand . maybe there are other ways too but i am not so familiar but extension version gets stripped to ensure that the latest compatible version is installed to avoiding potential issues of having outdated or incompatible extensions