Ignoring option install-extension: not supported for code-insiders

I am trying to run this file: dotfiles/plugins.sh at ae5e8d992e9479793d86c232ea82deb66b1e3f2a · sobolevn/dotfiles · GitHub

It contains several sh lines like code --install-extension teabyii.ayu,
but it fails to be executed in Codespaces.

Error:

root@codespaces_76fb96:~/dotfiles# code --install-extension teabyii.ayu
Ignoring option install-extension: not supported for code-insiders.
At least one file or folder must be provided.

What are the possible solutions here?

Hi @sobolevn, installing extensions as part of dotfiles poses some challenges, since dotfiles install runs in parallel with user connection, and there’s no guarantee you are connected by the time it runs, or even which VS Code version you are connecting from (insiders, stable, etc). Without knowing which VS Code version you are connecting from, you cannot know which version to install the extension into.

There are two alternative recommended methods for installing extensions automatically:

  1. Per-user extensions can be installed via settings sync in VS Code, which is enabled automatically in Codespaces. This will have a similar effect to dotfiles: they will be installed in all of your codespaces.
  2. Per-repo extensions can be specified in the devcontainer.json for a given repo. Then every user who creates a codespace in that repo will get that extension.

I would use (1) for extensions that are mostly personal preference like themes and other UI-related extensions, and (2) for things like language extensions, SDKs, debuggers, etc which are needed to build and run the project, and which everyone in that repo is going to need.

Hope that helps!

1 Like

Thanks for your help!

Settings sync kinda works, but some minor things are not clear:

  1. If I have to enable it everytime I spawn a new Codespace instance (cannot find any docs references on this one)
  2. I cannot modify settings in the “build time”. I had a plan to drop and modify some keys during the dotfiles installation process. For example, I am going to use light theme in Codespaces and a dark theme locally. Does settings sync support settings substitution?

For (1), you shouldn’t need to do anything to enable settings sync. It’s on automatically in Codespaces. Let us know if you are seeing something different.

For (2), I don’t think that’s supported currently. There’s not a great way to have Codespaces-specific config that is applied to all codespaces and not roamed back to desktop. cc @sandy081 who works on settings sync for VS Code.

1 Like

installing extensions as part of dotfiles poses some challenges, since dotfiles install runs in parallel with user connection, and there’s no guarantee you are connected by the time it runs

Might be a good idea to add some hooks like post_install.sh, where we would have access to the existing vscode install.