microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 290 forks source link

devcontainer vscode settings not taking effect in remote container #7155

Open navels opened 2 years ago

navels commented 2 years ago

Maybe I'm not understanding how this is supposed to work . . .

I have a devcontainer.json to which I added some settings:

  "customizations": {
    "vscode": {
      "extensions": [...deleted for brevity...],
      "settings": {
        "rubyTestExplorer.testFramework": "rspec",
        "rubyTestExplorer.logpanel": true,
        "rubyTestExplorer.debugCommand": "rdebug-ide",
        "rubyTestExplorer.filePattern": [
          "*_spec.rb"
        ]
      }
    }

After rebuilding the devcontainer and restarting VSCode I'd expect these settings to be present in my remote container but they are not:

> cat ~/.vscode-server/data/Machine
{}
navels commented 2 years ago

Aha, I have my home directory in the container mounted to a persistent docker volume, that seems to make the difference . . . is that expected?

navels commented 2 years ago

Workaround seems to be whenever I need to change the vscode customizations (adding extensions, settings), I have to

rm -rf ~/.vscode-server

and restart vscode.

bamurtaugh commented 2 years ago

Transferring as this seems more specific to Remote-Containers than a specific template.

@chrmarti would be great to get your eyes on this one, as it seems unexpected to me.

chrmarti commented 2 years ago

The settings are in ~/.vscode-server including a marker file to remember we already copied them there. We could write the container's creation date into the marker file to detect when the container is newer than the settings and these need to be overwritten with the new settings. Other users might expect the current behavior though (e.g., when they have customized the settings).

navels commented 2 years ago

There is another problem I run into occasionally with vscode because I am persisting my home directory: https://github.com/microsoft/vscode-remote-release/issues/6860

What would mitigate both of these would be a configuration to allow an alternative location for storing the vscode server settings.

chrmarti commented 2 years ago

https://github.com/microsoft/vscode-remote-release/issues/6079 is tracking making the location of .vscode-server configurable.

arashbehi commented 1 year ago

Hi @chrmarti, so I realized that the InstallPath for the dev-container is still not configurable. The custom path for installing vscode-server on a remote machine is extremely valuable.

The scenario is as follows: 1-ssh into a remote machine on vscode(with custom InstallPath) 2-attach to running docker container. Here, the dev container vscode-server appears to default to the original home directory(prior to step 1), which in my case, negates the benefits of step 1.

Would it possible to provide such flexibility soon?