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.55k stars 262 forks source link

An wrapper for xdg-open #3251

Open felipecrs opened 4 years ago

felipecrs commented 4 years ago

When developing using this extension, inside of any environment, it isn't possible to any CLI in the integrated terminal to open a link in the external browser. For example, gh needs a browser to do the login section. See:

image

It is totally normal since xdg-open isn't available in the container. If we are inside WSL we can at least use wslview with this trick https://github.com/cli/cli/issues/826#issuecomment-646528240.

However, since the vscode-server has access to the VS Code running on the host machine, I think it would be possible to write a wrapper for the xdg-open, similar to wslview in order to make this seamless.

One idea would be to put it in code itself, something like: code browse. It could be also useful for people using Codespaces or remote containers when they want to automate some steps such as in devcontainer.json's postCreateCommand put something like code browse localhost:3000/api/docs.

VS Code could then contribute to the integrated terminal with an environment variable BROWSER=" code browse", or even creating a shim and symlinking as xdg-open in order to make the CLIs to use this wrapper by default when inside the integrated terminal.

Notice I just said one example, but I think we can have many more over there.

chrmarti commented 4 years ago

/fyi @aeschli