WSL with VScode

When you are using vscode from wsl in Microsoft Windows System,  there might be an issue that whenever we open Terminal inside VScode, terminal  defaults to the VSCode setup Directory.

To fix this issue, open ~/.bashrc using nano or vi.

Paste this block of code


CALLER="$PWD"
APP="${CALLER##*/}"
if [ "$APP" == "Microsoft VS Code" ]; then
cd $OLDPWD
fi

 

Now when you open  terminal in VScode, it will load current workspace directory.