coder / vscode-coder

Open any Coder workspace in VS Code with a single click.
MIT License
66 stars 15 forks source link

feat: set `serverInstallPath` for the `<host>` automatically to the workspace dir #246

Open michaelbrewer opened 6 months ago

michaelbrewer commented 6 months ago

In some cases the $HOME dir is ephemeral, so when a workspace is restarted the ~/.vscode-server folder is lost and all of the extensions have to be installed from scratch.

But adding an entry to the settings.json to persistence volume would cache the installled extensions between restarts.

"remote.SSH.serverInstallPath": {
    "<host>": "/workspace/"
}
kylecarbs commented 6 months ago

How do you think it'd be best to address this?

Maybe we make a module that automatically writes this to the settings file?

michaelbrewer commented 6 months ago

Currently the user will have to figure out what the correct value for <host> and the also know the directory of the persistence volume for that workspace you are connecting to.

Coder workspace would know both things.

kylecarbs commented 6 months ago

We don't technically know the persistence, so I think a module that ensures settings exist with specific values would be best for this.

Would that work @michaelbrewer?

cc @matifali the module maker!

matifali commented 6 months ago

Yes, persistence isn't easy to know, and if we expose this path as a module input and use it to set the remote.SSH.serverInstallPath, it will probably override user settings. Most users prefer VS Code Web over code-server because of the settings sync. So, overwriting settings isn't a good idea. Let's wait for more opinions.

michaelbrewer commented 6 months ago

True. Right now I am documenting workarounds for users.

I might need to create symlinks from the home directory to the persistence volume used by my workspaces.

kylecarbs commented 6 months ago

A symlink of ~/.vscode-server would actually probably do the trick.

michaelbrewer commented 6 months ago

@kylecarbs sadly vscode wipes out any symlinks :( and linux does not allow hardlinks for directories.

kylecarbs commented 6 months ago

@michaelbrewer we might have to make an exception for this... I agree it's a valuable option and weird for us to not support.