There are many potential reasons which could prevent VSCode remote ssh integrated terminal from being able to open files via "code" command.
Quick Fix:
To get vs-code to open remotely then try add this line in your .bashrc
alias code="${HOME}/.vscode-server/bin/$(ls -t1 ${HOME}/.vscode-server/bin | head -n 1)/bin/remote-cli/code"
Now you can open a file using code -r filename.txt
to open a file in the integrated terminal.
The -r
parameter re-uses the current window.
More verbose Explanation:
From an integrated VS-Code terminal on the remote host:
# run this and verify the current user, show the .sock file and permissions are ok.
echo $VSCODE_IPC_HOOK_CLI
# also check path and make sure you've got some entry to ~/.vscode-server should appear:
echo $PATH
I'm not perfectly sure the best/proper way for the .vscode-server path to get set by the integrated terminal.
I think it's related to the terminal.defaultProfile
setting but I'm not 100% and may just be broken in my insider preview.
However I'm 100% sure if the ~/.vscode-server/bin/*/bin/remote-cli doesn't appear in the path it won't work, you can try to add it:
export PATH=$PATH:"~/.vscode-server/bin/**/bin/remote-cli"
then the command code -r filename.txt
will open the file in the integrated editor, however I think the alias solution in Quick Fix is easier/better.