Skip to content

Document how to generate vscode links #396

@choldgraf

Description

@choldgraf

It is possible to generate VSCode links with nbgitpuller! These will open vscode and open the file you point it to. However the link is a bit hard to remember, so we should document it. Here are the instructions we agreed on:

## Generate VSCode links with nbgitpuller

NBGitpuller can launch VSCode and open a file on your JupyterHub. First, ensure that VSCode is installed on your hub user environment[LINK]. Then, create a URL with the following structure:

https://[YOUR HUB]/hub/user-redirect/git-pull?repo=[YOUR REPO]&urlpath=vscode%2F%3Fpayload%3D%5B%5B%22openFile%22%2C%22vscode-remote%3A%2F%2F[ESCAPED REPO ROOT][ESCAPED FILE PATH RELATIVE TO REPO ROOT]%22%5D%5D%0A

For example, the following URL will open a file called `Forest.java` in vscode on a hub called `high.cloudbank.2i2c.cloud`

https://high.cloudbank.2i2c.cloud/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fsean-morris%2Fs2-w8&urlpath=vscode%2F%3Fpayload%3D%5B%5B%22openFile%22%2C%22vscode-remote%3A%2F%2F%2Fhome%2Fjovyan%2Fs2-w8%2FForest.java%22%5D%5D%0A

See [link to issue] for an issue tracking us adding this to the nbgitpuller link generator.

### Caveats and gotchas

- Note the `%22%5D%5D%0A` at the end of the URL after the file path, this is required!
- This assumes your hub mounts directories at `/home/jovyan`, which is the default for Z2JH, but may not be true for your hub! For example, TLJH JupyterHubs use `/home/[USERNAME]` so this link structure won't work for now!

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions