Skip to content

Commit c6b8894

Browse files
authored
Start vscode in current directory by default
Current behavior is to start in $REPO_DIR if $CODE_WORKINGDIR is not set. However, in JupyterHubs, you want to default to starting in current working directory, which is often set to /home/jovyan or similar. Current working directory is already set to $REPO_DIR in mybinder.org by default, so this should be a no-op in mybinder.org while doing the expected thing on JupyterHubs.
1 parent 53b509d commit c6b8894

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jupyter_vscode_proxy/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ def _get_vscode_cmd(port):
77
executable = "code-server"
88
if not shutil.which(executable):
99
raise FileNotFoundError("Can not find code-server in PATH")
10-
11-
working_dir = os.getenv("CODE_WORKINGDIR", None)
12-
if working_dir is None:
13-
working_dir = os.getenv("REPO_DIR", ".")
10+
11+
# Start vscode in CODE_WORKINGDIR env variable if set
12+
# If not, start in 'current directory', which is $REPO_DIR in mybinder
13+
# but /home/jovyan (or equivalent) in JupyterHubs
14+
working_dir = os.getenv("CODE_WORKINGDIR", ".")
1415

1516
extensions_dir = os.getenv("CODE_EXTENSIONSDIR", None)
1617
extra_extensions_dir = os.getenv("CODE_EXTRA_EXTENSIONSDIR", None)

0 commit comments

Comments
 (0)