2

I'm using WSL 2 for Windows, and I'm currently working on a ddev repo where I am creating a development environment using ddev and VSCode. On initiation of the ddev environment, I am starting up all my containers. With my custom "ddev code" command, I am attaching VSCode to the web container via the hex representation of the web container using

'code --folder-uri="vscode-remote://attached-container+646465762d646465762d7673636f64652d646576636f6e7461696e65722d64727570616c392d74656d706c6174652d776562%/var/www/html"'

Now, I would like to automatically enable a bunch of extensions and settings. Currently, I am using workspace settings in my projects folder structure in the form of .vscode/settings.json and extension settings in the form of .vscode/extensions.json. But this is just a workaround, since VSCode will use these settings as "workspace settings" and not "devcontainer settings". I would like to define the settings and install the extensions directly on my attached VSCode container rather than in my workspace settings, since I can only use "recommendations" in the extensions.json, because it is seen as a workspace.

I know I can set the settings and extensions under "AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\imageConfigs" or "nameConfigs" but I would like to have them in Ubuntu or rather in my project's folder directory. I also know that there is the devcontainer.json for standalone VSCode Containers where you can set the Docker files and settings/extensions, but how can I use such a file for my attached container?

Another way would be to install the extensions via command after attaching VSCode using

code --install-extension <extension-id>

But this will only install them locally. And executing this command in the web Container via ssh will throw an error.

Maybe someone knows a solution? If further information is needed I can of course provide it :)

Here is the repository I am working on: https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template

EDIT: Maybe this issue from our repo can also give more insight: https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template/issues/28

Grevil
  • 21
  • 2

0 Answers0