← ClaudeAtlas

wsl-vscode-doctorlisted

Diagnose and fix `code .` failing to launch, or opening a disconnected Windows-side VS Code instead of a WSL-connected (Remote-WSL) window, in a herdr-spawned WSL shell.
atman-33/workhub · ★ 1 · Code & Development · score 77
Install: claude install-skill atman-33/workhub
## Task Diagnose why `code .` doesn't work (or opens the wrong window) in this WSL shell, and patch `~/.zshrc` so it works going forward. ## Steps 1. **Check current state.** Run: ```bash command -v code echo "WSL_DISTRO_NAME=$WSL_DISTRO_NAME" echo "$PATH" | tr ':' '\n' | grep -i "Microsoft VS Code" ``` > **Why check both?** The `code` launcher script shipped by the Windows > VS Code install detects "am I in WSL" via `$WSL_DISTRO_NAME`. Without > it, `code .` still runs, but it skips routing through the Remote-WSL > extension and opens a disconnected Windows-side window instead. Completion criterion: `code` resolves on `PATH` AND `WSL_DISTRO_NAME` is set. If both are true, report "already configured" and stop — no further steps needed. 2. **Locate the VS Code Windows install** (don't hardcode a username): ```bash VSCODE_BIN=$(ls -d /mnt/c/Users/*/AppData/Local/Programs/"Microsoft VS Code"/bin 2>/dev/null | head -1) ``` Completion criterion: `$VSCODE_BIN` is a directory containing a `code` file. If nothing is found, report that VS Code isn't installed on the Windows side and stop. 3. **Find a known-good `WSL_DISTRO_NAME` value.** This session's own environment is the broken one, so borrow the value from another process on the same machine that already has it set correctly: ```bash for p in /proc/[0-9]*/environ; do v=$(tr '\0' '\n' < "$p" 2>/dev/null | grep '^WSL_DISTRO_NAME=') [ -n "$v" ] &&