jupyterhub / jupyterhub/nbgitpuller
Document how to generate vscode links
- Dominant language
- Python
- Stars
- 237
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
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:
```md
## 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
- _From a discussion in Slack w/ @sean-morris and @yuvipanda _
- Follow up: https://github.com/jupyterhub/nbgitpuller/issues/397
Contributor guide
Assessment
This issue has not been assessed yet.