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.61k stars 275 forks source link

Snap: Built-in devcontainer CLI path uses old version #5629

Open Clockwork-Muse opened 2 years ago

Clockwork-Muse commented 2 years ago

Steps to Reproduce:

  1. Install remote extension pack
  2. Verify the path has a snap package version in the saved path. File paths include
    • ~/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/vscode-path
    • ~/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/vscode-app-root

When VSCode is installed as a snap, there are two paths: A versioned path (such as /snap/code/75/usr/share/code/code) and "current" path (/snap/code/current/usr/share/code/code) which is symlinked to a versioned path. The problem is that the remote container extension seems to capture the versioned path, which eventually disappears as snap updates VSCode (snap seems to keep the current and one previous release by default). These paths are used for - at minimum - driving the devcontainer cli, which means that after snap updates a mismatched version of the cli may be used (or simply no longer exist, which is how I discovered this).

StefanBrand commented 7 months ago

Is there a workaround? I've tried to replace 147 by current in the above files. This does nothing here.

Running which code > ~/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/vscode-path does something, but only opens code normally, without starting the devcontainer.

PS.: which code points to /snap/bin/code here.

losnappas commented 6 months ago

@StefanBrand your editor possibly added a newline at the end of the file while you did that, which breaks it.

Doing $ echo -n '/snap/code/current/usr/share/code/code' > vscode-path ; echo -n '/snap/code/current/usr/share/code/resources/app' > vscode-app-root fixed it for me.

i-ky commented 2 months ago

Doing $ echo -n '/snap/code/current/usr/share/code/code' > vscode-path ; echo -n '/snap/code/current/usr/share/code/resources/app' > vscode-app-root fixed it for me.

Thank you, this worked for me!

Let me just make paths absolute and reformat it so it is easier to copy-paste:

echo -n '/snap/code/current/usr/share/code/code' > ~/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/vscode-path
echo -n '/snap/code/current/usr/share/code/resources/app' > ~/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/cli-bin/vscode-app-root