In the context of VS Code Remote Development inside a container I can see that extensions to install can be specified in the devcontainers.json
file, as shown in the samples in the vscode-dev-containers repo, like this example:
"extensions": [
"dbaeumer.vscode-eslint"
]
I have a VSIX file based extension locally that I'd also like to specify here so that it gets installed into the container. But I'm not sure how best to declare it here, path-wise.
I looked in the output of the container build step and noticed that the local project directory is mounted into the container (linebreaks added for readability):
Run: docker run -a STDOUT -a STDERR -p 127.0.0.1:4004:4004
-v /Users/dj/local/projects/test1:/workspaces/test1
-v /Users/dj/.gitconfig:/root/.gitconfig
-l vsch.quality=insider
-l vsch.local.folder=/Users/dj/local/projects/test1
-l vsch.remote.devPort=9753
vsc-test1-304320e2e9560b5557f6f7871801047f
/bin/sh -c echo Container started ; while sleep 1; do :; done
so I placed my VSIX file in the root of the project (/Users/dj/local/projects/test1/vscode-cds-1.1.4.vsix
) and this was then available in the container. Adding the fully qualified path to this file in the container to the extensions
property thus:
"extensions": [
"dbaeumer.vscode-eslint",
"/workspaces/test1/vscode-cds-1.1.4.vsix"
]
did indeed result in a successful installation of this extension into the container:
Installing extensions...
Installing extension 'dbaeumer.vscode-eslint' v1.8.2...
Extension 'dbaeumer.vscode-eslint' v1.8.2 was successfully installed.
Extension 'vscode-cds-1.1.4.vsix' was successfully installed. <----
Great!
But this hack requires me to hard code the name of the directory in which the .devcontainer/
directory is (i.e. test1/
), which of course I want to avoid.
Is there a way of doing this without hard coding the whole project directory name in the devcontainer.json
file?
Thank you.